{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/29280526","id":29280526,"diff_hunk":"@@ -80,14 +84,82 @@ def setUp(self):\n     return Tests\n \n \n-def cinder_client_from_environment():\n+@implementer(INovaVolumeManager)\n+class TidyNovaVolumeManager(\n+        proxyForInterface(INovaVolumeManager, 'original')\n+):\n+    def __init__(self, original):\n+        \"\"\"\n+        :param INovaVolumeManager original: An instance of\n+            ``novaclient.v2.volumes.VolumeManager``.\n+        \"\"\"\n+        self.original = original\n+        self._attached_volumes = []\n+\n+    def create_server_volume(self, server_id, volume_id, device):\n+        \"\"\"\n+        Wrap ``original.create_server_volume`` so as to record the\n+        volumes that have been attached by this API so that they can\n+        be later detached.\n+        \"\"\"\n+        nova_attached_volume = self.original.create_server_volume(\n+            server_id=server_id, \n+            volume_id=volume_id, \n+            device=device,\n+        )\n+        self._attached_volumes.append((server_id, nova_attached_volume))\n+        return nova_attached_volume\n+        \n+    def _cleanup(self):\n+        \"\"\"\n+        Detach any volumes that were attached by this API instance.\n+        \"\"\"\n+        for server_id, volume in self._attached_volumes:\n+            self.original.delete_server_volume(\n+                server_id=server_id,\n+                attachment_id=volume.id\n+            )\n+        # Don't return until all the volumes have been detached.\n+        for server_id, nova_volume in self._attached_volumes:\n+            wait_for_volume(\n+                volume_manager=self.original,\n+                expected_volume=nova_volume,\n+                expected_status=u'available',\n+            )\n+            \n+\n+\n+class INovaVolumeManagerTestsMixin(object):\n+    \"\"\"\n+    Tests for ``INovaVolumeManager`` implementations.\n+    \"\"\"\n+    def test_interface(self):\n+        \"\"\"\n+        ``client`` provides ``INovaVolumeManager``.\n+        \"\"\"\n+        self.assertTrue(verifyObject(INovaVolumeManager, self.client))\n+\n+\n+def make_inovavolumemanager_tests(client_factory):\n+    \"\"\"\n+    Build a ``TestCase`` for verifying that an implementation of\n+    ``INovaVolumeManager`` adheres to that interface.\n+    \"\"\"\n+    class Tests(INovaVolumeManagerTestsMixin, SynchronousTestCase):\n+        def setUp(self):\n+            self.client = client_factory(test_case=self)\n+\n+    return Tests\n+\n+\n+def client_from_environment(client_factory):\n     \"\"\"\n-    Create a ``cinderclient.v1.client.Client`` using credentials from a config\n+    Create an openstack API client using credentials from a config","path":"flocker/node/agents/testtools.py","position":99,"original_position":99,"commit_id":"25ecaa3588aeb1a7055d27a7601c8f02f22e90b9","original_commit_id":"25ecaa3588aeb1a7055d27a7601c8f02f22e90b9","user":{"login":"wallrj","id":978965,"avatar_url":"https://avatars.githubusercontent.com/u/978965?v=3","gravatar_id":"","url":"https://api.github.com/users/wallrj","html_url":"https://github.com/wallrj","followers_url":"https://api.github.com/users/wallrj/followers","following_url":"https://api.github.com/users/wallrj/following{/other_user}","gists_url":"https://api.github.com/users/wallrj/gists{/gist_id}","starred_url":"https://api.github.com/users/wallrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallrj/subscriptions","organizations_url":"https://api.github.com/users/wallrj/orgs","repos_url":"https://api.github.com/users/wallrj/repos","events_url":"https://api.github.com/users/wallrj/events{/privacy}","received_events_url":"https://api.github.com/users/wallrj/received_events","type":"User","site_admin":false},"body":"It actually returns a client_factory, curried  with the   correct `session` and `region` arguments.\r\nThat way it can be used for creating both Nova and Cinder clients whose `version` arguments are different.","created_at":"2015-04-28T19:42:59Z","updated_at":"2015-04-28T19:42:59Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1347#discussion_r29280526","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/29280526"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1347#discussion_r29280526"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347","id":34301990,"html_url":"https://github.com/ClusterHQ/flocker/pull/1347","diff_url":"https://github.com/ClusterHQ/flocker/pull/1347.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1347.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1347","number":1347,"state":"open","locked":false,"title":"[FLOC-1485] OpenStack CinderBlockAPI attach","user":{"login":"wallrj","id":978965,"avatar_url":"https://avatars.githubusercontent.com/u/978965?v=3","gravatar_id":"","url":"https://api.github.com/users/wallrj","html_url":"https://github.com/wallrj","followers_url":"https://api.github.com/users/wallrj/followers","following_url":"https://api.github.com/users/wallrj/following{/other_user}","gists_url":"https://api.github.com/users/wallrj/gists{/gist_id}","starred_url":"https://api.github.com/users/wallrj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallrj/subscriptions","organizations_url":"https://api.github.com/users/wallrj/orgs","repos_url":"https://api.github.com/users/wallrj/repos","events_url":"https://api.github.com/users/wallrj/events{/privacy}","received_events_url":"https://api.github.com/users/wallrj/received_events","type":"User","site_admin":false},"body":"Design / Partial Implementation for https://clusterhq.atlassian.net/browse/FLOC-1485\r\n\r\nThis required the use of the Nova API for attaching a volume to a server.\r\nThe Cinder API is still required in order to add metadata to a volume.\r\n\r\nThe tests assume Rackspace authentication and attach related tests will only pass on a Rackspace VM.\r\n\r\nTests can be run as follows:\r\n\r\n```\r\nsudo /usr/bin/env CLOUD_CONFIG_FILE=$HOME/acceptance.yml $(type -p trial) flocker.node.agents.functional.test_cinder.CinderBlockDeviceAPIInterfaceTests\r\n```","created_at":"2015-04-28T19:25:06Z","updated_at":"2015-04-28T19:42:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88ca1f426922f31b94b4a5a3a726de9f54755dea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1347/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/25ecaa3588aeb1a7055d27a7601c8f02f22e90b9","head":{"label":"ClusterHQ:openstack-attach-FLOC-1485","ref":"openstack-attach-FLOC-1485","sha":"25ecaa3588aeb1a7055d27a7601c8f02f22e90b9","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-28T17:30:15Z","pushed_at":"2015-04-28T19:28:18Z","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":53997,"stargazers_count":1371,"watchers_count":1371,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":76,"mirror_url":null,"open_issues_count":21,"forks":76,"open_issues":21,"watchers":1371,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"c09759fe2ec92b1310b6522cc43ca05cbc355bf8","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-28T17:30:15Z","pushed_at":"2015-04-28T19:28:18Z","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":53997,"stargazers_count":1371,"watchers_count":1371,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":76,"mirror_url":null,"open_issues_count":21,"forks":76,"open_issues":21,"watchers":1371,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1347"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1347"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1347/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1347/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/25ecaa3588aeb1a7055d27a7601c8f02f22e90b9"}}}}