{"action":"created","comment":{"url":"https://api.github.com/repos/rancher/cattle/pulls/comments/45145367","id":45145367,"diff_hunk":"@@ -106,49 +110,59 @@ protected void addComputeConstraints(AllocationAttempt attempt, List<Constraint>\n     protected void addStorageConstraints(AllocationAttempt attempt, List<Constraint> constraints) {\n         for (Map.Entry<Volume, Set<StoragePool>> entry : attempt.getPools().entrySet()) {\n             Volume volume = entry.getKey();\n-            List<? extends VolumeStoragePoolMap> vspms = mapDao.findNonRemoved(VolumeStoragePoolMap.class, Volume.class, volume.getId());\n-            boolean alreadyMappedToPool = vspms.size() > 0;\n+            boolean alreadyMappedToPool = entry.getValue().size() > 0;\n             VolumeValidStoragePoolConstraint volumeToPoolConstraint = new VolumeValidStoragePoolConstraint(volume, alreadyMappedToPool);\n-            if (alreadyMappedToPool) {","path":"code/iaas/allocator/src/main/java/io/cattle/platform/allocator/constraint/BaseConstraintsProvider.java","position":45,"original_position":45,"commit_id":"8c5b2e3f65510750ae10e93542db4ee06e251358","original_commit_id":"8c5b2e3f65510750ae10e93542db4ee06e251358","user":{"login":"cjellick","id":2473240,"avatar_url":"https://avatars.githubusercontent.com/u/2473240?v=3","gravatar_id":"","url":"https://api.github.com/users/cjellick","html_url":"https://github.com/cjellick","followers_url":"https://api.github.com/users/cjellick/followers","following_url":"https://api.github.com/users/cjellick/following{/other_user}","gists_url":"https://api.github.com/users/cjellick/gists{/gist_id}","starred_url":"https://api.github.com/users/cjellick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjellick/subscriptions","organizations_url":"https://api.github.com/users/cjellick/orgs","repos_url":"https://api.github.com/users/cjellick/repos","events_url":"https://api.github.com/users/cjellick/events{/privacy}","received_events_url":"https://api.github.com/users/cjellick/received_events","type":"User","site_admin":false},"body":"@ibuildthecloud I added all this alreadyMappedToPool in my last PR when fixing allocation bugs. But, I realized that my `mapDao.findNonRemoved(VolumeStoragePoolMap.class ...)` lookup was just duplicating what was already done here: https://github.com/rancher/cattle/blob/0c4066f9fd2652f99d29989c2a29065f0378c20e/code/iaas/allocator/src/main/java/io/cattle/platform/allocator/service/AbstractAllocator.java#L161\r\nand that the only real change we needed was that if the pools set returned by entry.getValue() was not empty, make the constraint an \"exact\" match.\r\n\r\nSo, my changes in this method actually simplify the logic back to before my last fix but then add the additional constraints needed to properly allocate stand-alone volumes.","created_at":"2015-11-18T00:45:17Z","updated_at":"2015-11-18T00:45:17Z","html_url":"https://github.com/rancher/cattle/pull/1071#discussion_r45145367","pull_request_url":"https://api.github.com/repos/rancher/cattle/pulls/1071","_links":{"self":{"href":"https://api.github.com/repos/rancher/cattle/pulls/comments/45145367"},"html":{"href":"https://github.com/rancher/cattle/pull/1071#discussion_r45145367"},"pull_request":{"href":"https://api.github.com/repos/rancher/cattle/pulls/1071"}}},"pull_request":{"url":"https://api.github.com/repos/rancher/cattle/pulls/1071","id":51014368,"html_url":"https://github.com/rancher/cattle/pull/1071","diff_url":"https://github.com/rancher/cattle/pull/1071.diff","patch_url":"https://github.com/rancher/cattle/pull/1071.patch","issue_url":"https://api.github.com/repos/rancher/cattle/issues/1071","number":1071,"state":"open","locked":false,"title":"Fix volume storage pool allocation","user":{"login":"cjellick","id":2473240,"avatar_url":"https://avatars.githubusercontent.com/u/2473240?v=3","gravatar_id":"","url":"https://api.github.com/users/cjellick","html_url":"https://github.com/cjellick","followers_url":"https://api.github.com/users/cjellick/followers","following_url":"https://api.github.com/users/cjellick/following{/other_user}","gists_url":"https://api.github.com/users/cjellick/gists{/gist_id}","starred_url":"https://api.github.com/users/cjellick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjellick/subscriptions","organizations_url":"https://api.github.com/users/cjellick/orgs","repos_url":"https://api.github.com/users/cjellick/repos","events_url":"https://api.github.com/users/cjellick/events{/privacy}","received_events_url":"https://api.github.com/users/cjellick/received_events","type":"User","site_admin":false},"body":"If the volume's driver matches an existing storage pool driver name,\r\nrestrict the allocation to that storage pool;\r\notherwise, allow it to allocate to any pool that is not managed by\r\nrancher.","created_at":"2015-11-17T22:26:18Z","updated_at":"2015-11-18T00:45:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78c9f51d006724aeb348de5c80f2a08f724a845c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rancher/cattle/pulls/1071/commits","review_comments_url":"https://api.github.com/repos/rancher/cattle/pulls/1071/comments","review_comment_url":"https://api.github.com/repos/rancher/cattle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rancher/cattle/issues/1071/comments","statuses_url":"https://api.github.com/repos/rancher/cattle/statuses/8c5b2e3f65510750ae10e93542db4ee06e251358","head":{"label":"cjellick:volume-crud","ref":"volume-crud","sha":"8c5b2e3f65510750ae10e93542db4ee06e251358","user":{"login":"cjellick","id":2473240,"avatar_url":"https://avatars.githubusercontent.com/u/2473240?v=3","gravatar_id":"","url":"https://api.github.com/users/cjellick","html_url":"https://github.com/cjellick","followers_url":"https://api.github.com/users/cjellick/followers","following_url":"https://api.github.com/users/cjellick/following{/other_user}","gists_url":"https://api.github.com/users/cjellick/gists{/gist_id}","starred_url":"https://api.github.com/users/cjellick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjellick/subscriptions","organizations_url":"https://api.github.com/users/cjellick/orgs","repos_url":"https://api.github.com/users/cjellick/repos","events_url":"https://api.github.com/users/cjellick/events{/privacy}","received_events_url":"https://api.github.com/users/cjellick/received_events","type":"User","site_admin":false},"repo":{"id":26793817,"name":"cattle","full_name":"cjellick/cattle","owner":{"login":"cjellick","id":2473240,"avatar_url":"https://avatars.githubusercontent.com/u/2473240?v=3","gravatar_id":"","url":"https://api.github.com/users/cjellick","html_url":"https://github.com/cjellick","followers_url":"https://api.github.com/users/cjellick/followers","following_url":"https://api.github.com/users/cjellick/following{/other_user}","gists_url":"https://api.github.com/users/cjellick/gists{/gist_id}","starred_url":"https://api.github.com/users/cjellick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjellick/subscriptions","organizations_url":"https://api.github.com/users/cjellick/orgs","repos_url":"https://api.github.com/users/cjellick/repos","events_url":"https://api.github.com/users/cjellick/events{/privacy}","received_events_url":"https://api.github.com/users/cjellick/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cjellick/cattle","description":"Infrastructure orchestration platform","fork":true,"url":"https://api.github.com/repos/cjellick/cattle","forks_url":"https://api.github.com/repos/cjellick/cattle/forks","keys_url":"https://api.github.com/repos/cjellick/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cjellick/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cjellick/cattle/teams","hooks_url":"https://api.github.com/repos/cjellick/cattle/hooks","issue_events_url":"https://api.github.com/repos/cjellick/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/cjellick/cattle/events","assignees_url":"https://api.github.com/repos/cjellick/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/cjellick/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/cjellick/cattle/tags","blobs_url":"https://api.github.com/repos/cjellick/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cjellick/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cjellick/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/cjellick/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cjellick/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/cjellick/cattle/languages","stargazers_url":"https://api.github.com/repos/cjellick/cattle/stargazers","contributors_url":"https://api.github.com/repos/cjellick/cattle/contributors","subscribers_url":"https://api.github.com/repos/cjellick/cattle/subscribers","subscription_url":"https://api.github.com/repos/cjellick/cattle/subscription","commits_url":"https://api.github.com/repos/cjellick/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/cjellick/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/cjellick/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/cjellick/cattle/issues/comments{/number}","contents_url":"https://api.github.com/repos/cjellick/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/cjellick/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cjellick/cattle/merges","archive_url":"https://api.github.com/repos/cjellick/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cjellick/cattle/downloads","issues_url":"https://api.github.com/repos/cjellick/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/cjellick/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/cjellick/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/cjellick/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cjellick/cattle/labels{/name}","releases_url":"https://api.github.com/repos/cjellick/cattle/releases{/id}","created_at":"2014-11-18T05:41:56Z","updated_at":"2015-04-02T20:43:46Z","pushed_at":"2015-11-18T00:33:26Z","git_url":"git://github.com/cjellick/cattle.git","ssh_url":"git@github.com:cjellick/cattle.git","clone_url":"https://github.com/cjellick/cattle.git","svn_url":"https://github.com/cjellick/cattle","homepage":"","size":21476,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"rancher:master","ref":"master","sha":"e64e529a74dcb71d1d3779a6603be335dea6569a","user":{"login":"rancher","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancher","html_url":"https://github.com/rancher","followers_url":"https://api.github.com/users/rancher/followers","following_url":"https://api.github.com/users/rancher/following{/other_user}","gists_url":"https://api.github.com/users/rancher/gists{/gist_id}","starred_url":"https://api.github.com/users/rancher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancher/subscriptions","organizations_url":"https://api.github.com/users/rancher/orgs","repos_url":"https://api.github.com/users/rancher/repos","events_url":"https://api.github.com/users/rancher/events{/privacy}","received_events_url":"https://api.github.com/users/rancher/received_events","type":"Organization","site_admin":false},"repo":{"id":18023059,"name":"cattle","full_name":"rancher/cattle","owner":{"login":"rancher","id":9343010,"avatar_url":"https://avatars.githubusercontent.com/u/9343010?v=3","gravatar_id":"","url":"https://api.github.com/users/rancher","html_url":"https://github.com/rancher","followers_url":"https://api.github.com/users/rancher/followers","following_url":"https://api.github.com/users/rancher/following{/other_user}","gists_url":"https://api.github.com/users/rancher/gists{/gist_id}","starred_url":"https://api.github.com/users/rancher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rancher/subscriptions","organizations_url":"https://api.github.com/users/rancher/orgs","repos_url":"https://api.github.com/users/rancher/repos","events_url":"https://api.github.com/users/rancher/events{/privacy}","received_events_url":"https://api.github.com/users/rancher/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/rancher/cattle","description":"Infrastructure orchestration platform","fork":false,"url":"https://api.github.com/repos/rancher/cattle","forks_url":"https://api.github.com/repos/rancher/cattle/forks","keys_url":"https://api.github.com/repos/rancher/cattle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rancher/cattle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rancher/cattle/teams","hooks_url":"https://api.github.com/repos/rancher/cattle/hooks","issue_events_url":"https://api.github.com/repos/rancher/cattle/issues/events{/number}","events_url":"https://api.github.com/repos/rancher/cattle/events","assignees_url":"https://api.github.com/repos/rancher/cattle/assignees{/user}","branches_url":"https://api.github.com/repos/rancher/cattle/branches{/branch}","tags_url":"https://api.github.com/repos/rancher/cattle/tags","blobs_url":"https://api.github.com/repos/rancher/cattle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rancher/cattle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rancher/cattle/git/refs{/sha}","trees_url":"https://api.github.com/repos/rancher/cattle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rancher/cattle/statuses/{sha}","languages_url":"https://api.github.com/repos/rancher/cattle/languages","stargazers_url":"https://api.github.com/repos/rancher/cattle/stargazers","contributors_url":"https://api.github.com/repos/rancher/cattle/contributors","subscribers_url":"https://api.github.com/repos/rancher/cattle/subscribers","subscription_url":"https://api.github.com/repos/rancher/cattle/subscription","commits_url":"https://api.github.com/repos/rancher/cattle/commits{/sha}","git_commits_url":"https://api.github.com/repos/rancher/cattle/git/commits{/sha}","comments_url":"https://api.github.com/repos/rancher/cattle/comments{/number}","issue_comment_url":"https://api.github.com/repos/rancher/cattle/issues/comments{/number}","contents_url":"https://api.github.com/repos/rancher/cattle/contents/{+path}","compare_url":"https://api.github.com/repos/rancher/cattle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rancher/cattle/merges","archive_url":"https://api.github.com/repos/rancher/cattle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rancher/cattle/downloads","issues_url":"https://api.github.com/repos/rancher/cattle/issues{/number}","pulls_url":"https://api.github.com/repos/rancher/cattle/pulls{/number}","milestones_url":"https://api.github.com/repos/rancher/cattle/milestones{/number}","notifications_url":"https://api.github.com/repos/rancher/cattle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rancher/cattle/labels{/name}","releases_url":"https://api.github.com/repos/rancher/cattle/releases{/id}","created_at":"2014-03-23T00:19:52Z","updated_at":"2015-11-17T04:02:08Z","pushed_at":"2015-11-18T00:38:40Z","git_url":"git://github.com/rancher/cattle.git","ssh_url":"git@github.com:rancher/cattle.git","clone_url":"https://github.com/rancher/cattle.git","svn_url":"https://github.com/rancher/cattle","homepage":"","size":25207,"stargazers_count":175,"watchers_count":175,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":81,"forks":55,"open_issues":81,"watchers":175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rancher/cattle/pulls/1071"},"html":{"href":"https://github.com/rancher/cattle/pull/1071"},"issue":{"href":"https://api.github.com/repos/rancher/cattle/issues/1071"},"comments":{"href":"https://api.github.com/repos/rancher/cattle/issues/1071/comments"},"review_comments":{"href":"https://api.github.com/repos/rancher/cattle/pulls/1071/comments"},"review_comment":{"href":"https://api.github.com/repos/rancher/cattle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rancher/cattle/pulls/1071/commits"},"statuses":{"href":"https://api.github.com/repos/rancher/cattle/statuses/8c5b2e3f65510750ae10e93542db4ee06e251358"}}}}