NixOS / nixops

NixOps is a tool for deploying to NixOS machines in a network or cloud.
https://nixos.org/nixops
GNU Lesser General Public License v3.0
1.83k stars 363 forks source link

Rely on qemu agent #847

Open teto opened 6 years ago

teto commented 6 years ago

I sometimes get:

client> waiting for SSH...
Traceback (most recent call last):
  File "/home/teto/nixops/scripts/nixops", line 983, in <module>
    args.op()
  File "/home/teto/nixops/scripts/nixops", line 406, in op_deploy
    max_concurrent_activate=args.max_concurrent_activate)
  File "/home/teto/nixops/nixops/deployment.py", line 1036, in deploy
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/home/teto/nixops/nixops/deployment.py", line 1028, in run_with_notify
    f()
  File "/home/teto/nixops/nixops/deployment.py", line 1036, in <lambda>
    self.run_with_notify('deploy', lambda: self._deploy(**kwargs))
  File "/home/teto/nixops/nixops/deployment.py", line 975, in _deploy
    nixops.parallel.run_tasks(nr_workers=-1, tasks=self.active_resources.itervalues(), worker_fun=worker)
  File "/home/teto/nixops/nixops/parallel.py", line 44, in thread_fun
    result_queue.put((worker_fun(t), None, t.name))
  File "/home/teto/nixops/nixops/deployment.py", line 948, in worker
    r.create(self.definitions[r.name], check=check, allow_reboot=allow_reboot, allow_recreate=allow_recreate)
  File "/home/teto/nixops/nixops/backends/libvirtd.py", line 144, in create
    self.start()
  File "/home/teto/nixops/nixops/backends/libvirtd.py", line 254, in start
    self._wait_for_ip(0)
  File "/home/teto/nixops/nixops/backends/libvirtd.py", line 229, in _wait_for_ip
    ip = self._parse_ip()
  File "/home/teto/nixops/nixops/backends/libvirtd.py", line 216, in _parse_ip
    ifaces = self.dom.interfaceAddresses(libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE, 0)
  File "/nix/store/zj4dq8ipqiwakj0hql5kdrsql11laf0g-python2.7-libvirt-3.10.0/lib/python2.7/site-packages/libvirt.py", line 1347, in interfaceAddresses
    if ret is None: raise libvirtError ('virDomainInterfaceAddresses() failed', dom=self)
libvirt.libvirtError: pointeur de réseau invalide dans virNetworkGetDHCPLeases

Iibvirtd parses DHCP requests but there is an alternative agent mode that might be more reliable (I am not sure, never tested). The query is then done with VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT instead of VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE.

teto commented 6 years ago

I thought I might play with it a bit: how can I add the qemu-agent to libvirt nixops machines ?

EDIT: found it but now i need to launch it; could use that https://github.com/NixOS/nixpkgs/issues/34722