{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin-server/pulls/comments/32258960","id":32258960,"diff_hunk":"@@ -3222,14 +3222,25 @@ def self.rpc_find_all_available(opts=nil)\n               end\n             end\n \n+            # Ignore least_preferred_servers if all servers are considered least preferred\n+            if least_preferred_servers.present?\n+              ignore_least_preferred_servers = false\n+              server_identities = server_infos.map {|server_info| server_info.name}\n+              if server_identities.all? {|identity| least_preferred_servers.include?(identity)}\n+                ignore_least_preferred_servers = true\n+              end\n+            end\n+\n             # Find least preferred zones\n             least_preferred_zone_ids = []\n-            least_preferred_servers.each do |server_identity|\n-              next unless server_identity\n-              server = District.find_server(server_identity, districts)\n-              least_preferred_zone_ids << server.zone_id if server.zone_id\n-            end if least_preferred_servers.present?\n-            least_preferred_zone_ids = least_preferred_zone_ids.uniq\n+            unless ignore_least_preferred_servers\n+              least_preferred_servers.each do |server_identity|\n+                next unless server_identity\n+                server = District.find_server(server_identity, districts)\n+                least_preferred_zone_ids << server.zone_id if server.zone_id\n+              end\n+              least_preferred_zone_ids = least_preferred_zone_ids.uniq\n+            end","path":"plugins/msg-broker/mcollective/lib/openshift/mcollective_application_container_proxy.rb","position":28,"original_position":28,"commit_id":"733f0ebde607e7b5cebd5cf0a2ba9cad9e54d50c","original_commit_id":"733f0ebde607e7b5cebd5cf0a2ba9cad9e54d50c","user":{"login":"danmcp","id":492994,"avatar_url":"https://avatars.githubusercontent.com/u/492994?v=3","gravatar_id":"","url":"https://api.github.com/users/danmcp","html_url":"https://github.com/danmcp","followers_url":"https://api.github.com/users/danmcp/followers","following_url":"https://api.github.com/users/danmcp/following{/other_user}","gists_url":"https://api.github.com/users/danmcp/gists{/gist_id}","starred_url":"https://api.github.com/users/danmcp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danmcp/subscriptions","organizations_url":"https://api.github.com/users/danmcp/orgs","repos_url":"https://api.github.com/users/danmcp/repos","events_url":"https://api.github.com/users/danmcp/events{/privacy}","received_events_url":"https://api.github.com/users/danmcp/received_events","type":"User","site_admin":false},"body":"Should this also include the block below?","created_at":"2015-06-11T19:35:47Z","updated_at":"2015-06-11T19:35:47Z","html_url":"https://github.com/openshift/origin-server/pull/6160#discussion_r32258960","pull_request_url":"https://api.github.com/repos/openshift/origin-server/pulls/6160","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/comments/32258960"},"html":{"href":"https://github.com/openshift/origin-server/pull/6160#discussion_r32258960"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/6160"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin-server/pulls/6160","id":37292248,"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","issue_url":"https://api.github.com/repos/openshift/origin-server/issues/6160","number":6160,"state":"open","locked":false,"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},"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.","created_at":"2015-06-09T19:53:31Z","updated_at":"2015-06-11T19:35:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e24f1394bf9d186e732c226c07ea5d038594fbd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin-server/pulls/6160/commits","review_comments_url":"https://api.github.com/repos/openshift/origin-server/pulls/6160/comments","review_comment_url":"https://api.github.com/repos/openshift/origin-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin-server/issues/6160/comments","statuses_url":"https://api.github.com/repos/openshift/origin-server/statuses/733f0ebde607e7b5cebd5cf0a2ba9cad9e54d50c","head":{"label":"tiwillia:bz1228373","ref":"bz1228373","sha":"733f0ebde607e7b5cebd5cf0a2ba9cad9e54d50c","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},"repo":{"id":24206311,"name":"origin-server","full_name":"tiwillia/origin-server","owner":{"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},"private":false,"html_url":"https://github.com/tiwillia/origin-server","description":"Public open source repository for the OpenShift Origin server components","fork":true,"url":"https://api.github.com/repos/tiwillia/origin-server","forks_url":"https://api.github.com/repos/tiwillia/origin-server/forks","keys_url":"https://api.github.com/repos/tiwillia/origin-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tiwillia/origin-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tiwillia/origin-server/teams","hooks_url":"https://api.github.com/repos/tiwillia/origin-server/hooks","issue_events_url":"https://api.github.com/repos/tiwillia/origin-server/issues/events{/number}","events_url":"https://api.github.com/repos/tiwillia/origin-server/events","assignees_url":"https://api.github.com/repos/tiwillia/origin-server/assignees{/user}","branches_url":"https://api.github.com/repos/tiwillia/origin-server/branches{/branch}","tags_url":"https://api.github.com/repos/tiwillia/origin-server/tags","blobs_url":"https://api.github.com/repos/tiwillia/origin-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tiwillia/origin-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tiwillia/origin-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/tiwillia/origin-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tiwillia/origin-server/statuses/{sha}","languages_url":"https://api.github.com/repos/tiwillia/origin-server/languages","stargazers_url":"https://api.github.com/repos/tiwillia/origin-server/stargazers","contributors_url":"https://api.github.com/repos/tiwillia/origin-server/contributors","subscribers_url":"https://api.github.com/repos/tiwillia/origin-server/subscribers","subscription_url":"https://api.github.com/repos/tiwillia/origin-server/subscription","commits_url":"https://api.github.com/repos/tiwillia/origin-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/tiwillia/origin-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/tiwillia/origin-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/tiwillia/origin-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/tiwillia/origin-server/contents/{+path}","compare_url":"https://api.github.com/repos/tiwillia/origin-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tiwillia/origin-server/merges","archive_url":"https://api.github.com/repos/tiwillia/origin-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tiwillia/origin-server/downloads","issues_url":"https://api.github.com/repos/tiwillia/origin-server/issues{/number}","pulls_url":"https://api.github.com/repos/tiwillia/origin-server/pulls{/number}","milestones_url":"https://api.github.com/repos/tiwillia/origin-server/milestones{/number}","notifications_url":"https://api.github.com/repos/tiwillia/origin-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tiwillia/origin-server/labels{/name}","releases_url":"https://api.github.com/repos/tiwillia/origin-server/releases{/id}","created_at":"2014-09-18T21:45:19Z","updated_at":"2015-05-08T14:28:17Z","pushed_at":"2015-06-11T18:21:48Z","git_url":"git://github.com/tiwillia/origin-server.git","ssh_url":"git@github.com:tiwillia/origin-server.git","clone_url":"https://github.com/tiwillia/origin-server.git","svn_url":"https://github.com/tiwillia/origin-server","homepage":"http://openshift.github.io","size":79988,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"d27a34034d99c2b893628296c48f4a2c8022c4eb","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":4097634,"name":"origin-server","full_name":"openshift/origin-server","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin-server","description":"Public open source repository for the OpenShift Origin server components","fork":false,"url":"https://api.github.com/repos/openshift/origin-server","forks_url":"https://api.github.com/repos/openshift/origin-server/forks","keys_url":"https://api.github.com/repos/openshift/origin-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin-server/teams","hooks_url":"https://api.github.com/repos/openshift/origin-server/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin-server/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin-server/events","assignees_url":"https://api.github.com/repos/openshift/origin-server/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin-server/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin-server/tags","blobs_url":"https://api.github.com/repos/openshift/origin-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin-server/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin-server/languages","stargazers_url":"https://api.github.com/repos/openshift/origin-server/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin-server/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin-server/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin-server/subscription","commits_url":"https://api.github.com/repos/openshift/origin-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin-server/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin-server/merges","archive_url":"https://api.github.com/repos/openshift/origin-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin-server/downloads","issues_url":"https://api.github.com/repos/openshift/origin-server/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin-server/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin-server/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin-server/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin-server/releases{/id}","created_at":"2012-04-21T16:43:10Z","updated_at":"2015-06-11T13:31:53Z","pushed_at":"2015-06-11T19:10:16Z","git_url":"git://github.com/openshift/origin-server.git","ssh_url":"git@github.com:openshift/origin-server.git","clone_url":"https://github.com/openshift/origin-server.git","svn_url":"https://github.com/openshift/origin-server","homepage":"http://openshift.github.io","size":1326080,"stargazers_count":824,"watchers_count":824,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":507,"mirror_url":null,"open_issues_count":60,"forks":507,"open_issues":60,"watchers":824,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/6160"},"html":{"href":"https://github.com/openshift/origin-server/pull/6160"},"issue":{"href":"https://api.github.com/repos/openshift/origin-server/issues/6160"},"comments":{"href":"https://api.github.com/repos/openshift/origin-server/issues/6160/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/6160/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin-server/pulls/6160/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin-server/statuses/733f0ebde607e7b5cebd5cf0a2ba9cad9e54d50c"}}}}