{"action":"created","comment":{"url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/comments/47926251","id":47926251,"diff_hunk":"@@ -192,23 +235,131 @@ private boolean checkVmIsStarted() {\n \t\tdis.setInstanceIds(Collections.singletonList(this.machineId));\n \n \t\tDescribeInstancesResult disresult = this.ec2Api.describeInstances( dis );\n+\t\t// Obtain availability zone (for later use, eg. volume attachment).\n+\t\tthis.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone();\n \t\treturn \"running\".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName());\n \t}\n+\t\n+\t/**\n+\t * Check whether EBS volume creation/attachment is requested.\n+\t * @return true if requested, false otherwise\n+\t */\n+\tprivate boolean volumeRequested() {\n+\t\treturn Boolean.parseBoolean(this.targetProperties.get(Ec2Constants.USE_BLOCK_STORAGE));\n+\t}\n+\t\n+\t/**\n+\t * Create volume for EBS.\n+\t * @return volume ID if successful creation, null otherwise (or if nothing to do)\n+\t */\n+\tprivate String createVolume(String snapshotId, int size) {\n+\t\tString volumeType = this.targetProperties.get(Ec2Constants.VOLUME_TYPE);\n+\t\tif(volumeType == null) volumeType = \"standard\";\n+\t\t\n+\t\tCreateVolumeRequest createVolumeRequest = new CreateVolumeRequest()\n+\t\t  .withAvailabilityZone(this.availabilityZone)\n+\t\t  .withVolumeType(volumeType)\n+\t\t  .withSize(size); // The size of the volume, in gigabytes.\n+\n+\t\t// EC2 snapshot IDs start with \"snap-\"...\n+\t\tif(! Utils.isEmptyOrWhitespaces(snapshotId) && snapshotId.startsWith(\"snap-\"))\n+\t\t\tcreateVolumeRequest.withSnapshotId(snapshotId);\n+\t\t\n+\t\tCreateVolumeResult createVolumeResult = this.ec2Api.createVolume(createVolumeRequest);\n+\t\treturn createVolumeResult.getVolume().getVolumeId();\n+\t}\n+\t\n+\t/**\n+\t * Check whether volume is created.\n+\t * @param volumeId the EBS volume ID\n+\t * @return true if volume created, false otherwise\n+\t */\n+\tprivate boolean volumeCreated(String volumeId) {\n+\t\tDescribeVolumesRequest dvs = new DescribeVolumesRequest();\n+        ArrayList<String> volumeIds = new ArrayList<String>();\n+        volumeIds.add(volumeId);\n+        dvs.setVolumeIds(volumeIds);\n+        DescribeVolumesResult dvsresult = null;\n+        try {\n+        \tdvsresult = this.ec2Api.describeVolumes(dvs);\n+        } catch(Exception e) {\n+        \tdvsresult = null;\n+        }\n+        \n+        return dvsresult != null && \"available\".equals(dvsresult.getVolumes().get(0).getState());\n+\t}\n \n+\t/**\n+\t * Lookup volume, by ID or Name tag.\n+\t * @param volumeIdOrName the EBS volume ID or Name tag\n+\t * @return The volume ID of 1st matching volume found, null if no volume found\n+\t */\n+\tprivate String lookupVolume(String volumeIdOrName) {\n+\t\t\n+\t\tif(! Utils.isEmptyOrWhitespaces(volumeIdOrName)) {\n+\t\t\t// Lookup by volume ID\n+\t\t\tDescribeVolumesRequest dvs = new DescribeVolumesRequest(Collections.singletonList(volumeIdOrName));\n+\t\t\tDescribeVolumesResult dvsresult = null;\n+\t\t\t\n+\t\t\ttry {\n+\t\t\t\tdvsresult = this.ec2Api.describeVolumes(dvs);\n+\t\t\t} catch(Exception e) {\n+\t\t\t\tdvsresult = null;\n+\t\t\t}\n+\n+\t\t\t// If not found, lookup by name\n+\t\t\tif(dvsresult == null || dvsresult.getVolumes() == null || dvsresult.getVolumes().size() < 1) {\n+\t\t\t\tdvs = new DescribeVolumesRequest().withFilters(new Filter().withName(\"tag:Name\").withValues(volumeIdOrName));\n+\t\t\t\ttry {\n+\t\t\t\t\tdvsresult = this.ec2Api.describeVolumes(dvs);\n+\t\t\t\t} catch(Exception e) {\n+\t\t\t\t\tdvsresult = null;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\tif(dvsresult == null || dvsresult.getVolumes() == null || dvsresult.getVolumes().size() < 1)\n+\t\t\t\treturn null;\n+\t\t\telse\n+\t\t\t\treturn dvsresult.getVolumes().get(0).getVolumeId();\n+\t\t}\n+\t\t\n+\t\treturn null;\n+\t}\n \n \t/**\n-\t * Associates storage with the VM.\n-\t * @return true if there is nothing more to do about elastic IP configuration, false otherwise\n+\t * Attach volume for EBS.","path":"core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2MachineConfigurator.java","position":285,"original_position":285,"commit_id":"4ae3f124f3796ae3f787f42a972eb4a7424eacd2","original_commit_id":"4ae3f124f3796ae3f787f42a972eb4a7424eacd2","user":{"login":"vincent-zurczak","id":1104790,"avatar_url":"https://avatars.githubusercontent.com/u/1104790?v=3","gravatar_id":"","url":"https://api.github.com/users/vincent-zurczak","html_url":"https://github.com/vincent-zurczak","followers_url":"https://api.github.com/users/vincent-zurczak/followers","following_url":"https://api.github.com/users/vincent-zurczak/following{/other_user}","gists_url":"https://api.github.com/users/vincent-zurczak/gists{/gist_id}","starred_url":"https://api.github.com/users/vincent-zurczak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincent-zurczak/subscriptions","organizations_url":"https://api.github.com/users/vincent-zurczak/orgs","repos_url":"https://api.github.com/users/vincent-zurczak/repos","events_url":"https://api.github.com/users/vincent-zurczak/events{/privacy}","received_events_url":"https://api.github.com/users/vincent-zurczak/received_events","type":"User","site_admin":false},"body":"Javadoc verbs must use the third person of the singular. `Attaches`","created_at":"2015-12-17T16:26:55Z","updated_at":"2015-12-17T16:26:55Z","html_url":"https://github.com/roboconf/roboconf-platform/pull/534#discussion_r47926251","pull_request_url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534","_links":{"self":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/comments/47926251"},"html":{"href":"https://github.com/roboconf/roboconf-platform/pull/534#discussion_r47926251"},"pull_request":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534"}}},"pull_request":{"url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534","id":53717814,"html_url":"https://github.com/roboconf/roboconf-platform/pull/534","diff_url":"https://github.com/roboconf/roboconf-platform/pull/534.diff","patch_url":"https://github.com/roboconf/roboconf-platform/pull/534.patch","issue_url":"https://api.github.com/repos/roboconf/roboconf-platform/issues/534","number":534,"state":"open","locked":false,"title":"EBS block storage support for EC2","user":{"login":"gibello","id":1230975,"avatar_url":"https://avatars.githubusercontent.com/u/1230975?v=3","gravatar_id":"","url":"https://api.github.com/users/gibello","html_url":"https://github.com/gibello","followers_url":"https://api.github.com/users/gibello/followers","following_url":"https://api.github.com/users/gibello/following{/other_user}","gists_url":"https://api.github.com/users/gibello/gists{/gist_id}","starred_url":"https://api.github.com/users/gibello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gibello/subscriptions","organizations_url":"https://api.github.com/users/gibello/orgs","repos_url":"https://api.github.com/users/gibello/repos","events_url":"https://api.github.com/users/gibello/events{/privacy}","received_events_url":"https://api.github.com/users/gibello/received_events","type":"User","site_admin":false},"body":"Closes #513 ","created_at":"2015-12-15T15:29:29Z","updated_at":"2015-12-17T16:26:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4e874938051ed85a18b8da531fcaca6cb29cd12d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534/commits","review_comments_url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534/comments","review_comment_url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/roboconf/roboconf-platform/issues/534/comments","statuses_url":"https://api.github.com/repos/roboconf/roboconf-platform/statuses/4ae3f124f3796ae3f787f42a972eb4a7424eacd2","head":{"label":"gibello:roboconf","ref":"roboconf","sha":"4ae3f124f3796ae3f787f42a972eb4a7424eacd2","user":{"login":"gibello","id":1230975,"avatar_url":"https://avatars.githubusercontent.com/u/1230975?v=3","gravatar_id":"","url":"https://api.github.com/users/gibello","html_url":"https://github.com/gibello","followers_url":"https://api.github.com/users/gibello/followers","following_url":"https://api.github.com/users/gibello/following{/other_user}","gists_url":"https://api.github.com/users/gibello/gists{/gist_id}","starred_url":"https://api.github.com/users/gibello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gibello/subscriptions","organizations_url":"https://api.github.com/users/gibello/orgs","repos_url":"https://api.github.com/users/gibello/repos","events_url":"https://api.github.com/users/gibello/events{/privacy}","received_events_url":"https://api.github.com/users/gibello/received_events","type":"User","site_admin":false},"repo":{"id":18062047,"name":"roboconf","full_name":"gibello/roboconf","owner":{"login":"gibello","id":1230975,"avatar_url":"https://avatars.githubusercontent.com/u/1230975?v=3","gravatar_id":"","url":"https://api.github.com/users/gibello","html_url":"https://github.com/gibello","followers_url":"https://api.github.com/users/gibello/followers","following_url":"https://api.github.com/users/gibello/following{/other_user}","gists_url":"https://api.github.com/users/gibello/gists{/gist_id}","starred_url":"https://api.github.com/users/gibello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gibello/subscriptions","organizations_url":"https://api.github.com/users/gibello/orgs","repos_url":"https://api.github.com/users/gibello/repos","events_url":"https://api.github.com/users/gibello/events{/privacy}","received_events_url":"https://api.github.com/users/gibello/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gibello/roboconf","description":"Core platform","fork":true,"url":"https://api.github.com/repos/gibello/roboconf","forks_url":"https://api.github.com/repos/gibello/roboconf/forks","keys_url":"https://api.github.com/repos/gibello/roboconf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gibello/roboconf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gibello/roboconf/teams","hooks_url":"https://api.github.com/repos/gibello/roboconf/hooks","issue_events_url":"https://api.github.com/repos/gibello/roboconf/issues/events{/number}","events_url":"https://api.github.com/repos/gibello/roboconf/events","assignees_url":"https://api.github.com/repos/gibello/roboconf/assignees{/user}","branches_url":"https://api.github.com/repos/gibello/roboconf/branches{/branch}","tags_url":"https://api.github.com/repos/gibello/roboconf/tags","blobs_url":"https://api.github.com/repos/gibello/roboconf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gibello/roboconf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gibello/roboconf/git/refs{/sha}","trees_url":"https://api.github.com/repos/gibello/roboconf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gibello/roboconf/statuses/{sha}","languages_url":"https://api.github.com/repos/gibello/roboconf/languages","stargazers_url":"https://api.github.com/repos/gibello/roboconf/stargazers","contributors_url":"https://api.github.com/repos/gibello/roboconf/contributors","subscribers_url":"https://api.github.com/repos/gibello/roboconf/subscribers","subscription_url":"https://api.github.com/repos/gibello/roboconf/subscription","commits_url":"https://api.github.com/repos/gibello/roboconf/commits{/sha}","git_commits_url":"https://api.github.com/repos/gibello/roboconf/git/commits{/sha}","comments_url":"https://api.github.com/repos/gibello/roboconf/comments{/number}","issue_comment_url":"https://api.github.com/repos/gibello/roboconf/issues/comments{/number}","contents_url":"https://api.github.com/repos/gibello/roboconf/contents/{+path}","compare_url":"https://api.github.com/repos/gibello/roboconf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gibello/roboconf/merges","archive_url":"https://api.github.com/repos/gibello/roboconf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gibello/roboconf/downloads","issues_url":"https://api.github.com/repos/gibello/roboconf/issues{/number}","pulls_url":"https://api.github.com/repos/gibello/roboconf/pulls{/number}","milestones_url":"https://api.github.com/repos/gibello/roboconf/milestones{/number}","notifications_url":"https://api.github.com/repos/gibello/roboconf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gibello/roboconf/labels{/name}","releases_url":"https://api.github.com/repos/gibello/roboconf/releases{/id}","created_at":"2014-03-24T12:40:20Z","updated_at":"2015-05-04T15:50:59Z","pushed_at":"2015-12-15T15:26:37Z","git_url":"git://github.com/gibello/roboconf.git","ssh_url":"git@github.com:gibello/roboconf.git","clone_url":"https://github.com/gibello/roboconf.git","svn_url":"https://github.com/gibello/roboconf","homepage":"","size":7098,"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":"roboconf:master","ref":"master","sha":"1fa346203875b91b362701248e418c733dbfaa84","user":{"login":"roboconf","id":6438255,"avatar_url":"https://avatars.githubusercontent.com/u/6438255?v=3","gravatar_id":"","url":"https://api.github.com/users/roboconf","html_url":"https://github.com/roboconf","followers_url":"https://api.github.com/users/roboconf/followers","following_url":"https://api.github.com/users/roboconf/following{/other_user}","gists_url":"https://api.github.com/users/roboconf/gists{/gist_id}","starred_url":"https://api.github.com/users/roboconf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboconf/subscriptions","organizations_url":"https://api.github.com/users/roboconf/orgs","repos_url":"https://api.github.com/users/roboconf/repos","events_url":"https://api.github.com/users/roboconf/events{/privacy}","received_events_url":"https://api.github.com/users/roboconf/received_events","type":"Organization","site_admin":false},"repo":{"id":17637707,"name":"roboconf-platform","full_name":"roboconf/roboconf-platform","owner":{"login":"roboconf","id":6438255,"avatar_url":"https://avatars.githubusercontent.com/u/6438255?v=3","gravatar_id":"","url":"https://api.github.com/users/roboconf","html_url":"https://github.com/roboconf","followers_url":"https://api.github.com/users/roboconf/followers","following_url":"https://api.github.com/users/roboconf/following{/other_user}","gists_url":"https://api.github.com/users/roboconf/gists{/gist_id}","starred_url":"https://api.github.com/users/roboconf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/roboconf/subscriptions","organizations_url":"https://api.github.com/users/roboconf/orgs","repos_url":"https://api.github.com/users/roboconf/repos","events_url":"https://api.github.com/users/roboconf/events{/privacy}","received_events_url":"https://api.github.com/users/roboconf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/roboconf/roboconf-platform","description":"The core modules and the platform","fork":false,"url":"https://api.github.com/repos/roboconf/roboconf-platform","forks_url":"https://api.github.com/repos/roboconf/roboconf-platform/forks","keys_url":"https://api.github.com/repos/roboconf/roboconf-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/roboconf/roboconf-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/roboconf/roboconf-platform/teams","hooks_url":"https://api.github.com/repos/roboconf/roboconf-platform/hooks","issue_events_url":"https://api.github.com/repos/roboconf/roboconf-platform/issues/events{/number}","events_url":"https://api.github.com/repos/roboconf/roboconf-platform/events","assignees_url":"https://api.github.com/repos/roboconf/roboconf-platform/assignees{/user}","branches_url":"https://api.github.com/repos/roboconf/roboconf-platform/branches{/branch}","tags_url":"https://api.github.com/repos/roboconf/roboconf-platform/tags","blobs_url":"https://api.github.com/repos/roboconf/roboconf-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/roboconf/roboconf-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/roboconf/roboconf-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/roboconf/roboconf-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/roboconf/roboconf-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/roboconf/roboconf-platform/languages","stargazers_url":"https://api.github.com/repos/roboconf/roboconf-platform/stargazers","contributors_url":"https://api.github.com/repos/roboconf/roboconf-platform/contributors","subscribers_url":"https://api.github.com/repos/roboconf/roboconf-platform/subscribers","subscription_url":"https://api.github.com/repos/roboconf/roboconf-platform/subscription","commits_url":"https://api.github.com/repos/roboconf/roboconf-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/roboconf/roboconf-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/roboconf/roboconf-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/roboconf/roboconf-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/roboconf/roboconf-platform/contents/{+path}","compare_url":"https://api.github.com/repos/roboconf/roboconf-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/roboconf/roboconf-platform/merges","archive_url":"https://api.github.com/repos/roboconf/roboconf-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/roboconf/roboconf-platform/downloads","issues_url":"https://api.github.com/repos/roboconf/roboconf-platform/issues{/number}","pulls_url":"https://api.github.com/repos/roboconf/roboconf-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/roboconf/roboconf-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/roboconf/roboconf-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/roboconf/roboconf-platform/labels{/name}","releases_url":"https://api.github.com/repos/roboconf/roboconf-platform/releases{/id}","created_at":"2014-03-11T16:29:42Z","updated_at":"2015-11-15T23:09:34Z","pushed_at":"2015-12-15T15:29:29Z","git_url":"git://github.com/roboconf/roboconf-platform.git","ssh_url":"git@github.com:roboconf/roboconf-platform.git","clone_url":"https://github.com/roboconf/roboconf-platform.git","svn_url":"https://github.com/roboconf/roboconf-platform","homepage":"","size":7105,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":9,"mirror_url":null,"open_issues_count":83,"forks":9,"open_issues":83,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534"},"html":{"href":"https://github.com/roboconf/roboconf-platform/pull/534"},"issue":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/issues/534"},"comments":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/issues/534/comments"},"review_comments":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534/comments"},"review_comment":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/pulls/534/commits"},"statuses":{"href":"https://api.github.com/repos/roboconf/roboconf-platform/statuses/4ae3f124f3796ae3f787f42a972eb4a7424eacd2"}}}}