nixops-libvirtd icon indicating copy to clipboard operation
nixops-libvirtd copied to clipboard

Error trying to deploy: type object 'libvirt' has no attribute 'open'

Open onny opened this issue 4 years ago • 5 comments
trafficstars

Hey, I followed the example mentioned on the Readme.md but somehow the Python script seems to fail:

$ nixops deploy -d example-libvirtd
Traceback (most recent call last):
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/bin/..nixops-wrapped-wrapped", line 991, in <module>
    args.op()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/bin/..nixops-wrapped-wrapped", line 412, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1052, in run_with_notify
    f()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 1063, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 996, in _deploy
    nixops.parallel.run_tasks(nr_workers=-1, tasks=self.active_resources.itervalues(), worker_fun=worker)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/parallel.py", line 44, in thread_fun
    result_queue.put((worker_fun(t), None, t.name))
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/deployment.py", line 969, in worker
    r.create(self.definitions[r.name], check=check, allow_reboot=allow_reboot, allow_recreate=allow_recreate)
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/backends/libvirtd.py", line 129, in create
    self.connect()
  File "/nix/store/6rdrwjdaba0xhzil64acz3hfdmlxw5m4-nixops-1.7/lib/python2.7/site-packages/nixops/backends/libvirtd.py", line 75, in connect
    self.conn = libvirt.open('qemu:///system')
AttributeError: type object 'libvirt' has no attribute 'open'

Best regards Jonas

onny avatar Apr 25 '21 11:04 onny

Maybe this issue can be solved by migrating to Python 3, see https://github.com/nix-community/nixops-libvirtd/issues/24 . The Python 2 libvirt package is marked as insecure :(

onny avatar Apr 25 '21 11:04 onny

Upgraded to nixopsUnstable and now it seems to work. Closing this for now.

onny avatar Apr 26 '21 21:04 onny

I guess I'll leave this open as long NixOps 2.0 haven't reached the stable release channel

onny avatar Apr 27 '21 15:04 onny

With the package nixopsUnstable (aka NixOps 2.0) deployments will fail with the error:

AttributeError: 'Deployment' object has no attribute '_eval_flags'

This has been reported here before: https://github.com/nix-community/nixops-libvirtd/issues/29

That means it's impossible to use nixops-libvirtd with either NixOps v1 or v2. Unless there is something that I missed here, this package is broken and unsuable on recent versions of nixpkgs.

jlamur avatar Apr 02 '22 19:04 jlamur

@jlamur, that particular issue is fixed by https://github.com/nix-community/nixops-libvirtd/pull/33

deepfire avatar Aug 13 '23 22:08 deepfire