{"action":"created","comment":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/27028125","id":27028125,"diff_hunk":"@@ -1309,6 +1309,263 @@ def test_container_with_volume(self):\n )\n \n \n+class UpdateContainerConfigurationTestsMixin(APITestsMixin):\n+    \"\"\"\n+    Tests for the container configuration update endpoint at\n+    ``/containers/<containername>``.\n+    \"\"\"\n+    def _create_container(self):\n+        \"\"\"\n+        Utility function to create a container configuration via the API.\n+        Also creates a second container not manipulated in the tests, to\n+        ensure that unrelated applications do not get modified, moved or\n+        wiped out.\n+        \"\"\"\n+        saving = self.persistence_service.save(Deployment(\n+            nodes={\n+                Node(\n+                    hostname=self.NODE_A,\n+                    applications=[\n+                        Application(\n+                            name='leavemealone',\n+                            image=DockerImage.from_string('busybox'),\n+                        ),\n+                    ]\n+                ),\n+                Node(hostname=self.NODE_B),\n+            }\n+        ))\n+\n+        saving.addCallback(lambda _: self.assertResponseCode(\n+            b\"POST\", b\"/configuration/containers\",\n+            {\n+                u\"host\": self.NODE_A,\n+                u\"name\": u\"mycontainer\",\n+                u\"image\": u\"busybox\"\n+            }, CREATED\n+        ))\n+\n+        return saving\n+\n+    def test_update_same_host(self):\n+        \"\"\"\n+        An API request to update a named container's host to the same host\n+        on which it is already running results in an unchanged configuration.\n+        \"\"\"\n+        d = self._create_container()\n+\n+        d.addCallback(lambda _: self.assertResponseCode(\n+            b\"POST\", b\"/configuration/containers/mycontainer\",\n+            {u\"host\": self.NODE_A}, OK\n+        ))\n+\n+        def updated(_):\n+            deployment = self.persistence_service.get()\n+            expected = Deployment(\n+                nodes={\n+                    Node(\n+                        hostname=self.NODE_A,\n+                        applications=[\n+                            Application(\n+                                name='leavemealone',\n+                                image=DockerImage.from_string('busybox'),\n+                            ),\n+                            Application(\n+                                name='mycontainer',\n+                                image=DockerImage.from_string('busybox')\n+                            ),\n+                        ]\n+                    ),\n+                    Node(hostname=self.NODE_B),\n+                }\n+            )\n+            self.assertEqual(deployment, expected)\n+\n+        d.addCallback(updated)\n+        return d\n+\n+    def test_update_new_host(self):\n+        \"\"\"\n+        An API request to update a named container's host to a different host\n+        results in an updated configuration.\n+        \"\"\"\n+        d = self._create_container()\n+\n+        d.addCallback(lambda _: self.assertResponseCode(\n+            b\"POST\", b\"/configuration/containers/mycontainer\",\n+            {u\"host\": self.NODE_B}, OK\n+        ))\n+\n+        def updated(_):\n+            deployment = self.persistence_service.get()\n+            expected = Deployment(\n+                nodes={\n+                    Node(\n+                        hostname=self.NODE_A,\n+                        applications=[\n+                            Application(\n+                                name='leavemealone',\n+                                image=DockerImage.from_string('busybox'),\n+                            ),\n+                        ]\n+                    ),\n+                    Node(\n+                        hostname=self.NODE_B,\n+                        applications=[\n+                            Application(\n+                                name='mycontainer',\n+                                image=DockerImage.from_string('busybox')\n+                            ),\n+                        ]\n+                    ),\n+                }\n+            )\n+            self.assertEqual(deployment, expected)\n+\n+        d.addCallback(updated)\n+        return d\n+\n+    def test_update_moves_dataset(self):\n+        \"\"\"\n+        An API request to update a named container's host to a different host\n+        where the container has an attached dataset results in an updated\n+        configuration, with the dataset's primary host also moved to the new\n+        container host.\n+        \"\"\"\n+        manifestation = _manifestation()\n+        application = Application(\n+            name='postgres',","path":"flocker/control/test/test_httpapi.py","position":129,"original_position":129,"commit_id":"5144aa03a627dd053c871dd56d8c5ed6b32373cc","original_commit_id":"5144aa03a627dd053c871dd56d8c5ed6b32373cc","user":{"login":"exarkun","id":254565,"avatar_url":"https://avatars.githubusercontent.com/u/254565?v=3","gravatar_id":"","url":"https://api.github.com/users/exarkun","html_url":"https://github.com/exarkun","followers_url":"https://api.github.com/users/exarkun/followers","following_url":"https://api.github.com/users/exarkun/following{/other_user}","gists_url":"https://api.github.com/users/exarkun/gists{/gist_id}","starred_url":"https://api.github.com/users/exarkun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exarkun/subscriptions","organizations_url":"https://api.github.com/users/exarkun/orgs","repos_url":"https://api.github.com/users/exarkun/repos","events_url":"https://api.github.com/users/exarkun/events{/privacy}","received_events_url":"https://api.github.com/users/exarkun/received_events","type":"User","site_admin":false},"body":"`u\"postgres\"`","created_at":"2015-03-24T13:47:45Z","updated_at":"2015-03-24T13:47:45Z","html_url":"https://github.com/ClusterHQ/flocker/pull/1239#discussion_r27028125","pull_request_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239","_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments/27028125"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1239#discussion_r27028125"},"pull_request":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239"}}},"pull_request":{"url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239","id":31737011,"html_url":"https://github.com/ClusterHQ/flocker/pull/1239","diff_url":"https://github.com/ClusterHQ/flocker/pull/1239.diff","patch_url":"https://github.com/ClusterHQ/flocker/pull/1239.patch","issue_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1239","number":1239,"state":"open","locked":false,"title":"[FLOC-1578] Move container API","user":{"login":"dwgebler","id":646585,"avatar_url":"https://avatars.githubusercontent.com/u/646585?v=3","gravatar_id":"","url":"https://api.github.com/users/dwgebler","html_url":"https://github.com/dwgebler","followers_url":"https://api.github.com/users/dwgebler/followers","following_url":"https://api.github.com/users/dwgebler/following{/other_user}","gists_url":"https://api.github.com/users/dwgebler/gists{/gist_id}","starred_url":"https://api.github.com/users/dwgebler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwgebler/subscriptions","organizations_url":"https://api.github.com/users/dwgebler/orgs","repos_url":"https://api.github.com/users/dwgebler/repos","events_url":"https://api.github.com/users/dwgebler/events{/privacy}","received_events_url":"https://api.github.com/users/dwgebler/received_events","type":"User","site_admin":false},"body":"Fixes FLOC-1578","created_at":"2015-03-23T14:32:28Z","updated_at":"2015-03-24T13:47:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1b5201352eef330d0901b9bfdfe3b4ce8e156ee","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239/commits","review_comments_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239/comments","review_comment_url":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ClusterHQ/flocker/issues/1239/comments","statuses_url":"https://api.github.com/repos/ClusterHQ/flocker/statuses/5144aa03a627dd053c871dd56d8c5ed6b32373cc","head":{"label":"ClusterHQ:move-container-api-FLOC-1578","ref":"move-container-api-FLOC-1578","sha":"5144aa03a627dd053c871dd56d8c5ed6b32373cc","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-03-24T09:06:46Z","pushed_at":"2015-03-24T13:42:47Z","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":45651,"stargazers_count":1290,"watchers_count":1290,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":20,"forks":66,"open_issues":20,"watchers":1290,"default_branch":"master"}},"base":{"label":"ClusterHQ:master","ref":"master","sha":"87c89f895bbf6320d7b4ecc1cbfb9d8ec6366840","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-03-24T09:06:46Z","pushed_at":"2015-03-24T13:42:47Z","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":45651,"stargazers_count":1290,"watchers_count":1290,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":66,"mirror_url":null,"open_issues_count":20,"forks":66,"open_issues":20,"watchers":1290,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239"},"html":{"href":"https://github.com/ClusterHQ/flocker/pull/1239"},"issue":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1239"},"comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/issues/1239/comments"},"review_comments":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239/comments"},"review_comment":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ClusterHQ/flocker/pulls/1239/commits"},"statuses":{"href":"https://api.github.com/repos/ClusterHQ/flocker/statuses/5144aa03a627dd053c871dd56d8c5ed6b32373cc"}}}}