{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/29376086","id":29376086,"diff_hunk":"@@ -0,0 +1,198 @@\n+# Copyright Hybrid Logic Ltd.  See LICENSE file for details.\n+\n+\"\"\"\n+An EBS implementation of the ``IBlockDeviceAPI``.\n+\"\"\"\n+\n+from bitmath import Byte, GB\n+import time\n+from uuid import UUID\n+\n+from boto import ec2\n+from pyrsistent import PRecord, field\n+from zope.interface import implementer\n+\n+from .blockdevice import IBlockDeviceAPI, BlockDeviceVolume, UnknownVolume\n+\n+DATASET_ID_LABEL = u'flocker-dataset-id'\n+METADATA_VERSION_LABEL = u'flocker-metadata-version'\n+CLUSTER_ID_LABEL = u'flocker-cluster-id'\n+\n+\n+def ec2_client(region, zone, access_key_id, secret_access_key):\n+    \"\"\"\n+    Establish connection to EC2 client.\n+\n+    :param String region: The name of the EC2 region to connect to.\n+    :param String zone: The zone for the EC2 region to connect to.\n+    :param String access_key_id: \"aws_access_key_id\" credential for EC2.\n+    :param String secret_access_key: \"aws_secret_access_key\" EC2 credential.\n+\n+    :return: An ``_EC2`` giving information about EC2 client connection\n+        and EC2 instance zone.\n+    \"\"\"\n+    return _EC2(zone=zone,\n+                connection=ec2.connect_to_region(\n+                    region,\n+                    aws_access_key_id=access_key_id,\n+                    aws_secret_access_key=secret_access_key))\n+\n+\n+class _EC2(PRecord):\n+    \"\"\"\n+    :ivar string zone: The name of the zone for the connection.\n+    :ivar EC2Connection connection: Object representing connection to\n+        an EC2 instance.\n+    \"\"\"\n+    zone = field()\n+    connection = field()\n+\n+\n+@implementer(IBlockDeviceAPI)\n+class EBSBlockDeviceAPI(object):\n+    \"\"\"\n+    An EBS implementation of ``IBlockDeviceAPI`` which creates\n+    block devices in an EC2 cluster using Boto APIs.\n+    \"\"\"\n+    def __init__(self, ec2_client, cluster_id):\n+        \"\"\"\n+        Initialize EBS block device API instance.\n+\n+        :param ``_EC2`` ec2_client: PRecord storing EC2\n+            client connection and EC2 instance zone.","path":"flocker/node/agents/ebs.py","position":62,"original_position":62,"commit_id":"5747ee09ea8db80b488c4448df96bfd57b388da9","original_commit_id":"5747ee09ea8db80b488c4448df96bfd57b388da9","user":{"login":"myechuri","id":12038016,"avatar_url":"https://avatars.githubusercontent.com/u/12038016?v=3","gravatar_id":"","url":"https://api.github.com/users/myechuri","html_url":"https://github.com/myechuri","followers_url":"https://api.github.com/users/myechuri/followers","following_url":"https://api.github.com/users/myechuri/following{/other_user}","gists_url":"https://api.github.com/users/myechuri/gists{/gist_id}","starred_url":"https://api.github.com/users/myechuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myechuri/subscriptions","organizations_url":"https://api.github.com/users/myechuri/orgs","repos_url":"https://api.github.com/users/myechuri/repos","events_url":"https://api.github.com/users/myechuri/events{/privacy}","received_events_url":"https://api.github.com/users/myechuri/received_events","type":"User","site_admin":false},"body":"Fixed.","created_at":"2015-04-29T20:18:22Z","updated_at":"2015-04-29T20:18:22Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1349#discussion_r29376086","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/29376086"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1349#discussion_r29376086"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349","id":34328847,"html_url":"https://github.com/ClusterHQ/flocker/pull/1349","diff_url":"https://github.com/ClusterHQ/flocker/pull/1349.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1349.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1349","number":1349,"state":"open","locked":false,"title":"[FLOC-1762] Implement IBlockDeviceAPI.{create_volume, list_volumes,  destroy_volume} for EBS","user":{"login":"myechuri","id":12038016,"avatar_url":"https://avatars.githubusercontent.com/u/12038016?v=3","gravatar_id":"","url":"https://api.github.com/users/myechuri","html_url":"https://github.com/myechuri","followers_url":"https://api.github.com/users/myechuri/followers","following_url":"https://api.github.com/users/myechuri/following{/other_user}","gists_url":"https://api.github.com/users/myechuri/gists{/gist_id}","starred_url":"https://api.github.com/users/myechuri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myechuri/subscriptions","organizations_url":"https://api.github.com/users/myechuri/orgs","repos_url":"https://api.github.com/users/myechuri/repos","events_url":"https://api.github.com/users/myechuri/events{/privacy}","received_events_url":"https://api.github.com/users/myechuri/received_events","type":"User","site_admin":false},"body":"Fixes: https://clusterhq.atlassian.net/browse/FLOC-1762\r\n\r\nImplement IBlockDeviceAPI's {create_volume, list_volumes, destroy_volume} APIs and associated tests for EBS backend.","created_at":"2015-04-29T02:11:58Z","updated_at":"2015-04-29T20:18:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96ae94fce2dca6bcda9f14c09e9a0afb08dd6129","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1349/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/5747ee09ea8db80b488c4448df96bfd57b388da9","head":{"label":"ClusterHQ:EBS-IBlockDeviceAPI-FLOC-1762","ref":"EBS-IBlockDeviceAPI-FLOC-1762","sha":"5747ee09ea8db80b488c4448df96bfd57b388da9","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-04-29T20:11:36Z","pushed_at":"2015-04-29T17:56:05Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":54819,"stargazers_count":1380,"watchers_count":1380,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":76,"mirror_url":null,"open_issues_count":23,"forks":76,"open_issues":23,"watchers":1380,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"acd02521cab1b7a1e6fb7220d3b59b1ff2ce42b8","user":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"repo":{"id":19248542,"name":"flocker","full_name":"ClusterHQ/flocker","owner":{"login":"ClusterHQ","id":7913449,"avatar_url":"https://avatars.githubusercontent.com/u/7913449?v=3","gravatar_id":"","url":"https://api.github.com/users/ClusterHQ","html_url":"https://github.com/ClusterHQ","followers_url":"https://api.github.com/users/ClusterHQ/followers","following_url":"https://api.github.com/users/ClusterHQ/following{/other_user}","gists_url":"https://api.github.com/users/ClusterHQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ClusterHQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ClusterHQ/subscriptions","organizations_url":"https://api.github.com/users/ClusterHQ/orgs","repos_url":"https://api.github.com/users/ClusterHQ/repos","events_url":"https://api.github.com/users/ClusterHQ/events{/privacy}","received_events_url":"https://api.github.com/users/ClusterHQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ClusterHQ/flocker","description":"Easily manage Docker containers & their data","fork":false,"url":"https://api.github.com/repos/ClusterHQ/flocker","forks_url":"https://api.github.com/repos/ClusterHQ/flocker/forks","keys_url":"https://api.github.com/repos/ClusterHQ/flocker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ClusterHQ/flocker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ClusterHQ/flocker/teams","hooks_url":"https://api.github.com/repos/ClusterHQ/flocker/hooks","issue_events_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/events{/number}","events_url":"https://api.github.com/repos/ClusterHQ/flocker/events","assignees_url":"https://api.github.com/repos/ClusterHQ/flocker/assignees{/user}","branches_url":"https://api.github.com/repos/ClusterHQ/flocker/branches{/branch}","tags_url":"https://api.github.com/repos/ClusterHQ/flocker/tags","blobs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ClusterHQ/flocker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ClusterHQ/flocker/git/refs{/sha}","trees_url":"https://api.github.com/repos/ClusterHQ/flocker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/{sha}","languages_url":"https://api.github.com/repos/ClusterHQ/flocker/languages","stargazers_url":"https://api.github.com/repos/ClusterHQ/flocker/stargazers","contributors_url":"https://api.github.com/repos/ClusterHQ/flocker/contributors","subscribers_url":"https://api.github.com/repos/ClusterHQ/flocker/subscribers","subscription_url":"https://api.github.com/repos/ClusterHQ/flocker/subscription","commits_url":"https://api.github.com/repos/ClusterHQ/flocker/commits{/sha}","git_commits_url":"https://api.github.com/repos/ClusterHQ/flocker/git/commits{/sha}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/comments{/number}","issue_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/comments{/number}","contents_url":"https://api.github.com/repos/ClusterHQ/flocker/contents/{+path}","compare_url":"https://api.github.com/repos/ClusterHQ/flocker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ClusterHQ/flocker/merges","archive_url":"https://api.github.com/repos/ClusterHQ/flocker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ClusterHQ/flocker/downloads","issues_url":"https://api.github.com/repos/ClusterHQ/flocker/issues{/number}","pulls_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls{/number}","milestones_url":"https://api.github.com/repos/ClusterHQ/flocker/milestones{/number}","notifications_url":"https://api.github.com/repos/ClusterHQ/flocker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ClusterHQ/flocker/labels{/name}","releases_url":"https://api.github.com/repos/ClusterHQ/flocker/releases{/id}","created_at":"2014-04-28T18:02:14Z","updated_at":"2015-04-29T20:11:36Z","pushed_at":"2015-04-29T17:56:05Z","git_url":"git://github.com/ClusterHQ/flocker.git","ssh_url":"git@github.com:ClusterHQ/flocker.git","clone_url":"https://github.com/ClusterHQ/flocker.git","svn_url":"https://github.com/ClusterHQ/flocker","homepage":"https://clusterhq.com","size":54819,"stargazers_count":1380,"watchers_count":1380,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":76,"mirror_url":null,"open_issues_count":23,"forks":76,"open_issues":23,"watchers":1380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1349"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1349"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1349/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1349/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/5747ee09ea8db80b488c4448df96bfd57b388da9"}}}}