{"action":"created","issue":{"url":"https://api.github.com/repos/openshift/origin-server/issues/6160","labels_url":"https://api.github.com/repos/openshift/origin-server/issues/6160/labels{/name}","comments_url":"https://api.github.com/repos/openshift/origin-server/issues/6160/comments","events_url":"https://api.github.com/repos/openshift/origin-server/issues/6160/events","html_url":"https://github.com/openshift/origin-server/pull/6160","id":86715544,"number":6160,"title":"Ignore least preferred servers if all servers are least preferred","user":{"login":"tiwillia","id":5197933,"avatar_url":"https://avatars.githubusercontent.com/u/5197933?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwillia","html_url":"https://github.com/tiwillia","followers_url":"https://api.github.com/users/tiwillia/followers","following_url":"https://api.github.com/users/tiwillia/following{/other_user}","gists_url":"https://api.github.com/users/tiwillia/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwillia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwillia/subscriptions","organizations_url":"https://api.github.com/users/tiwillia/orgs","repos_url":"https://api.github.com/users/tiwillia/repos","events_url":"https://api.github.com/users/tiwillia/events{/privacy}","received_events_url":"https://api.github.com/users/tiwillia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-09T19:53:31Z","updated_at":"2015-06-12T18:07:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openshift/origin-server/pulls/6160","html_url":"https://github.com/openshift/origin-server/pull/6160","diff_url":"https://github.com/openshift/origin-server/pull/6160.diff","patch_url":"https://github.com/openshift/origin-server/pull/6160.patch"},"body":"Bug 1228373\r\nBug link https://bugzilla.redhat.com/show_bug.cgi?id=1228373\r\n\r\nIf an application is already scaled out so that it has a gear on all available nodes, all nodes will be considered 'least_preferred_servers'. This will cause only one server to be returned from rpc_find_all_available, giving select_best_fit_node only one server to choose. This caused sparatic and uneven gear placement from highly scaled applications.\r\n\r\nThis fix will ignore the least_preferred_servers list if all available servers are included in the list."},"comment":{"url":"https://api.github.com/repos/openshift/origin-server/issues/comments/111577138","html_url":"https://github.com/openshift/origin-server/pull/6160#issuecomment-111577138","issue_url":"https://api.github.com/repos/openshift/origin-server/issues/6160","id":111577138,"user":{"login":"tiwillia","id":5197933,"avatar_url":"https://avatars.githubusercontent.com/u/5197933?v=3","gravatar_id":"","url":"https://api.github.com/users/tiwillia","html_url":"https://github.com/tiwillia","followers_url":"https://api.github.com/users/tiwillia/followers","following_url":"https://api.github.com/users/tiwillia/following{/other_user}","gists_url":"https://api.github.com/users/tiwillia/gists{/gist_id}","starred_url":"https://api.github.com/users/tiwillia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tiwillia/subscriptions","organizations_url":"https://api.github.com/users/tiwillia/orgs","repos_url":"https://api.github.com/users/tiwillia/repos","events_url":"https://api.github.com/users/tiwillia/events{/privacy}","received_events_url":"https://api.github.com/users/tiwillia/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T18:07:08Z","updated_at":"2015-06-12T18:07:08Z","body":"Moved where `ignore_least_preferred_servers` was set. If a region was not defined, it would never be set, meaning that all servers were deleted from `server_infos` at the end of the method. Tested again with current code:\r\n\r\nDistrict configuration:\r\n```\r\n{\"_id\"=>\"557afe8d84c8718aa0000001\",\r\n \"active_servers_size\"=>4,\r\n \"available_capacity\"=>5900,\r\n \"available_uids\"=>\"<5900 uids hidden>\",\r\n \"created_at\"=>2015-06-12 15:45:17 UTC,\r\n \"gear_size\"=>\"small\",\r\n \"max_capacity\"=>6000,\r\n \"max_uid\"=>6999,\r\n \"name\"=>\"small-district\",\r\n \"platform\"=>\"linux\",\r\n \"servers\"=>\r\n  [{\"_id\"=>\"557afeb484c87111af000001\",\r\n    \"active\"=>true,\r\n    \"name\"=>\"ip-10-99-165-109\",\r\n    \"region_id\"=>\"557aff0184c8713199000001\",\r\n    \"region_name\"=>\"RDU\",\r\n    \"unresponsive\"=>false,\r\n    \"zone_id\"=>\"557aff3b84c871dbb3000001\",\r\n    \"zone_name\"=>\"south\"},\r\n   {\"_id\"=>\"557afebf84c871a72b000001\",\r\n    \"active\"=>true,\r\n    \"name\"=>\"ip-10-61-190-123\",\r\n    \"region_id\"=>\"557aff0184c8713199000001\",\r\n    \"region_name\"=>\"RDU\",\r\n    \"unresponsive\"=>false,\r\n    \"zone_id\"=>\"557aff2d84c871fd9c000001\",\r\n    \"zone_name\"=>\"north\"},\r\n   {\"_id\"=>\"557afec884c871dbb9000001\",\r\n    \"active\"=>true,\r\n    \"name\"=>\"ip-10-71-180-79\",\r\n    \"region_id\"=>\"557aff0184c8713199000001\",\r\n    \"region_name\"=>\"RDU\",\r\n    \"unresponsive\"=>false,\r\n    \"zone_id\"=>\"557aff2d84c871fd9c000001\",\r\n    \"zone_name\"=>\"north\"},\r\n   {\"_id\"=>\"557b017584c8718d1f000001\",\r\n    \"active\"=>true,\r\n    \"name\"=>\"ip-10-16-180-140\",\r\n    \"region_id\"=>\"557aff0184c8713199000001\",\r\n    \"region_name\"=>\"RDU\",\r\n    \"unresponsive\"=>false,\r\n    \"zone_id\"=>\"557aff3b84c871dbb3000001\",\r\n    \"zone_name\"=>\"south\"}],\r\n \"updated_at\"=>2015-06-12 15:45:17 UTC,\r\n \"uuid\"=>\"066ef74a111a11e5a5360242ac110002\"}\r\n```\r\nCreated 1 ruby-1.9 application and scaled to a minimum of 100. Gear counts across nodes:\r\n\r\nHostname | zone | gears\r\n--------------|--------|----------\r\nip-10-71-180-79  | north | 25 \r\nip-10-61-190-123 | north | 39 \r\nip-10-99-165-109 | south | 17\r\nip-10-16-180-140 | south | 19\r\n\r\nRemoved regions/zones, tested again with one application scaled to 100 gears:\r\n\r\n\r\nHostname | gears\r\n--------------|--------\r\nip-10-71-180-79   | 30 \r\nip-10-61-190-123 | 23 \r\nip-10-99-165-109 | 14\r\nip-10-16-180-140 | 33\r\n\r\nGear placement is not nearly as erratic."}}