{"action":"created","comment":{"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments/65417992","id":65417992,"diff_hunk":"@@ -0,0 +1,78 @@\n+package org.jenkinsci.plugins.ewm.strategies;\n+\n+import org.jenkinsci.plugins.ewm.definitions.Disk;\n+import org.jenkinsci.plugins.ewm.definitions.DiskPool;\n+\n+import javax.annotation.Nonnull;\n+import java.util.List;\n+\n+/**\n+ * Abstract class for defining a disk allocation strategy.\n+ * Each disk allocation strategy should extend this class and provide its own implementation of disk allocation.\n+ *\n+ * @author Alexandru Somai\n+ */\n+public abstract class DiskAllocationStrategy {\n+\n+    private final String diskPoolId;\n+    private final List<DiskPool> diskPools;\n+\n+    protected DiskAllocationStrategy(@Nonnull String diskPoolId, @Nonnull List<DiskPool> diskPools) {\n+        this.diskPoolId = diskPoolId;\n+        this.diskPools = diskPools;\n+    }\n+\n+    /**\n+     * Allocates a disk from the given disk pool.\n+     *\n+     * @return the allocated disk pool\n+     * @throws RuntimeException if the disk pool doesn't have defined any {@link Disk} entries\n+     * @see DiskAllocationStrategy#findDiskPool()\n+     * @see DiskAllocationStrategy#allocateDisk(List) ()\n+     */\n+    @Nonnull\n+    public Disk allocateDisk() {\n+        DiskPool diskPool = findDiskPool();\n+\n+        List<Disk> disks = diskPool.getDisks();\n+        if (disks.isEmpty()) {\n+            String message = String.format(\"No Disks were defined in the global config for Disk Pool '%s'\", diskPoolId);\n+            throw new RuntimeException(message);","path":"src/main/java/org/jenkinsci/plugins/ewm/strategies/DiskAllocationStrategy.java","position":40,"original_position":40,"commit_id":"7553d198fe42d199f1895fc30093ac4454d31dad","original_commit_id":"7553d198fe42d199f1895fc30093ac4454d31dad","user":{"login":"martinda","id":164060,"avatar_url":"https://avatars.githubusercontent.com/u/164060?v=3","gravatar_id":"","url":"https://api.github.com/users/martinda","html_url":"https://github.com/martinda","followers_url":"https://api.github.com/users/martinda/followers","following_url":"https://api.github.com/users/martinda/following{/other_user}","gists_url":"https://api.github.com/users/martinda/gists{/gist_id}","starred_url":"https://api.github.com/users/martinda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinda/subscriptions","organizations_url":"https://api.github.com/users/martinda/orgs","repos_url":"https://api.github.com/users/martinda/repos","events_url":"https://api.github.com/users/martinda/events{/privacy}","received_events_url":"https://api.github.com/users/martinda/received_events","type":"User","site_admin":false},"body":"@alexsomai, it is the `AbortException` I was thinking about on Monday at the meeting.","created_at":"2016-06-01T18:36:18Z","updated_at":"2016-06-01T18:36:18Z","html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3#discussion_r65417992","pull_request_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments/65417992"},"html":{"href":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3#discussion_r65417992"},"pull_request":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3","id":71913515,"html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3","diff_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3.diff","patch_url":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3.patch","issue_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/3","number":3,"state":"open","locked":false,"title":"[JENKINS-35192] Implement the exwsAllocate step for the upstream job","user":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"body":"This is the implementation of the exwsAllocate step for the upstream job.\r\n\r\nCC @oleg-nenashev  @martinda","created_at":"2016-05-30T15:08:32Z","updated_at":"2016-06-01T18:36:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2e4f87e98faacb73c30861efafdc9867f021f9cb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3/commits","review_comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3/comments","review_comment_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/3/comments","statuses_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/7553d198fe42d199f1895fc30093ac4454d31dad","head":{"label":"alexsomai:exws-allocate-step","ref":"exws-allocate-step","sha":"7553d198fe42d199f1895fc30093ac4454d31dad","user":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"repo":{"id":59319962,"name":"external-workspace-manager-plugin","full_name":"alexsomai/external-workspace-manager-plugin","owner":{"login":"alexsomai","id":5720977,"avatar_url":"https://avatars.githubusercontent.com/u/5720977?v=3","gravatar_id":"","url":"https://api.github.com/users/alexsomai","html_url":"https://github.com/alexsomai","followers_url":"https://api.github.com/users/alexsomai/followers","following_url":"https://api.github.com/users/alexsomai/following{/other_user}","gists_url":"https://api.github.com/users/alexsomai/gists{/gist_id}","starred_url":"https://api.github.com/users/alexsomai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexsomai/subscriptions","organizations_url":"https://api.github.com/users/alexsomai/orgs","repos_url":"https://api.github.com/users/alexsomai/repos","events_url":"https://api.github.com/users/alexsomai/events{/privacy}","received_events_url":"https://api.github.com/users/alexsomai/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexsomai/external-workspace-manager-plugin","description":"","fork":true,"url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin","forks_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/forks","keys_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/teams","hooks_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/hooks","issue_events_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/events","assignees_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/tags","blobs_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/languages","stargazers_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/stargazers","contributors_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/contributors","subscribers_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/subscribers","subscription_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/subscription","commits_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/merges","archive_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/downloads","issues_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/labels{/name}","releases_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/alexsomai/external-workspace-manager-plugin/deployments","created_at":"2016-05-20T19:11:36Z","updated_at":"2016-05-16T12:57:05Z","pushed_at":"2016-06-01T15:59:26Z","git_url":"git://github.com/alexsomai/external-workspace-manager-plugin.git","ssh_url":"git@github.com:alexsomai/external-workspace-manager-plugin.git","clone_url":"https://github.com/alexsomai/external-workspace-manager-plugin.git","svn_url":"https://github.com/alexsomai/external-workspace-manager-plugin","homepage":"","size":37,"stargazers_count":0,"watchers_count":0,"language":null,"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":"jenkinsci:global-config","ref":"global-config","sha":"0cb7bf163c12b40829fa06e8e33c9f41d2554ca8","user":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"repo":{"id":58932444,"name":"external-workspace-manager-plugin","full_name":"jenkinsci/external-workspace-manager-plugin","owner":{"login":"jenkinsci","id":107424,"avatar_url":"https://avatars.githubusercontent.com/u/107424?v=3","gravatar_id":"","url":"https://api.github.com/users/jenkinsci","html_url":"https://github.com/jenkinsci","followers_url":"https://api.github.com/users/jenkinsci/followers","following_url":"https://api.github.com/users/jenkinsci/following{/other_user}","gists_url":"https://api.github.com/users/jenkinsci/gists{/gist_id}","starred_url":"https://api.github.com/users/jenkinsci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jenkinsci/subscriptions","organizations_url":"https://api.github.com/users/jenkinsci/orgs","repos_url":"https://api.github.com/users/jenkinsci/repos","events_url":"https://api.github.com/users/jenkinsci/events{/privacy}","received_events_url":"https://api.github.com/users/jenkinsci/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jenkinsci/external-workspace-manager-plugin","description":"","fork":false,"url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin","forks_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/forks","keys_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/teams","hooks_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/hooks","issue_events_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/events","assignees_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/tags","blobs_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/languages","stargazers_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/stargazers","contributors_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/contributors","subscribers_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/subscribers","subscription_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/subscription","commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/merges","archive_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/downloads","issues_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/labels{/name}","releases_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/deployments","created_at":"2016-05-16T12:57:04Z","updated_at":"2016-05-28T20:03:37Z","pushed_at":"2016-06-01T18:07:18Z","git_url":"git://github.com/jenkinsci/external-workspace-manager-plugin.git","ssh_url":"git@github.com:jenkinsci/external-workspace-manager-plugin.git","clone_url":"https://github.com/jenkinsci/external-workspace-manager-plugin.git","svn_url":"https://github.com/jenkinsci/external-workspace-manager-plugin","homepage":"","size":39,"stargazers_count":1,"watchers_count":1,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":2,"forks":3,"open_issues":2,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3"},"html":{"href":"https://github.com/jenkinsci/external-workspace-manager-plugin/pull/3"},"issue":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/3"},"comments":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/jenkinsci/external-workspace-manager-plugin/statuses/7553d198fe42d199f1895fc30093ac4454d31dad"}}}}
{"actor":{"display_login":"martinda"}}