pylxd: Not able to issue migration

Hi everyone,

I’m trying to Live Migrate a very simple container (an empty alpine/edge one) though two different machines If I use the LXD cli interface the migration works pretty well But if I try using pylxd API I got some errors, the code is pretty simple:

from pylxd import Client

#client_local = Client()

client_local=Client(endpoint='https://127.0.0.1:8443',cert=('lxd.crt','lxd.key'),verify=False)
client_local.authenticate('fog')
client_remote=Client(endpoint='https://192.168.1.106:8443',cert=('lxd.crt','lxd.key'),verify=False)
print('Trusted {}'.format(client_remote.trusted))
client_remote.authenticate('fog')
print('Trusted {}'.format(client_remote.trusted))

cont = client_local.containers.get('testm')
cont.migrate(client_remote,wait=True)

I’m using endpoint also for localhost otherwise I get

ValueError: Cannot migrate from a local client connection

The error that I get is this one:

Traceback (most recent call last):
  File "migration.py", line 13, in <module>
    cont.migrate(client_remote,wait=True)
  File "/home/ubuntu/.local/lib/python3.5/site-packages/pylxd/models/container.py", line 267, in migrate
    self.generate_migration_data(), wait=wait)
  File "/home/ubuntu/.local/lib/python3.5/site-packages/pylxd/models/container.py", line 278, in generate_migration_data
    operation = self.client.operations.get(response.json()['operation'])
  File "/home/ubuntu/.local/lib/python3.5/site-packages/pylxd/models/operation.py", line 38, in get
    return cls(_client=client, **response.json()['metadata'])
  File "/home/ubuntu/.local/lib/python3.5/site-packages/pylxd/models/operation.py", line 43, in __init__
    setattr(self, key, value)
AttributeError: 'Operation' object has no attribute 'description'

I’m misusing the API?

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

Yes, I’m pretty sure that 2.2.5 has a fix to this; latest is 2.2.7, but it as an execute issue that I’m looking into that became much more apparent with lxd 3.0.2. lxd 3.2 has less of an issue, but if you use lots of ‘execute’ statements from pylxd, then 2.2.6 might be better until I fix the issue and get 2.2.8 out.