Skip to content

Commit

Permalink
Revert "Changed the implementation of Containers.migration to match t…
Browse files Browse the repository at this point in the history
…he 'lxc move <container_name> <remote_name>:' behaviour"

This reverts commit 1361198.

Signed-off-by: gabrik <[email protected]>
  • Loading branch information
gabrik committed Jul 11, 2018
1 parent 1361198 commit 3800604
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions pylxd/models/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,25 +421,9 @@ def migrate(self, new_client, wait=False):
"""
if self.api.scheme in ('http+unix',):
raise ValueError('Cannot migrate from a local client connection')

if self.status.upper() == 'RUNNING':
try:
res = new_client.containers.create(
self.generate_migration_data(), wait=wait)
except LXDAPIException as e:
if '{}'.format(e) == "The container is already running":
self.delete()
return new_client.containers.get(self.name)
else:
raise e
self.delete()
return res
else:
res = new_client.containers.create(
self.generate_migration_data(), wait=wait)
self.delete()
return res

return new_client.containers.create(
self.generate_migration_data(), wait=wait)

def generate_migration_data(self):
"""Generate the migration data.
Expand Down

0 comments on commit 3800604

Please sign in to comment.