NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.65k stars 13.1k forks source link

QEMU guest agent not available in OpenStack Nova image #34722

Open joseph-long opened 6 years ago

joseph-long commented 6 years ago

I built an OpenStack VM image using https://github.com/NixOS/nixpkgs/blob/master/nixos/maintainers/scripts/openstack/nova-image.nix (specifically nix-build '<nixpkgs/nixos>' -A config.system.build.novaImage --arg configuration "{ imports = [ <nixpkgs/nixos/maintainers/scripts/openstack/nova-image.nix> ]; }") and the resulting image does not have qemu-ga available.

The administrators of the OpenStack deployment I'm using tell me this is essential, so I am looking at how to make it available. It seems like the qemu-ga binary is made available by installing qemu itself, though e.g. Gentoo's qemu-guest-agent ebuild seems to build only the guest agent.

If the guest agent is indeed required for things like snapshotting Nova VMs, it seems like nova-image.nix should ensure qemu is installed and a systemd unit created to start qemu-ga.

Technical details

joseph-long commented 6 years ago

Workaround

enable-qemu-guest-agent.nix

{config, pkgs, ...}:
{
  config = {
    # boot.kernelParams = [ "console=ttyS0" ];  ## Unclear if I can't see the console in the web UI because I'm missing this, or some other reason.
    environment.systemPackages = [ pkgs.qemu ];
    systemd.services.qemu-guest-agent = {
      description = "Run the QEMU Guest Agent";
      path = [ pkgs.qemu ];
      script = "qemu-ga";
      serviceConfig = {
        Restart = "always";
        RestartSec = 0;
      };
    };
    services.udev.extraRules = ''SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0",  TAG+="systemd" ENV{SYSTEMD_WANTS}="qemu-guest-agent.service"'';
  };
}

then the command to build the image becomes

nix-build '<nixpkgs/nixos>' -A config.system.build.novaImage --arg configuration "{ imports = [ <nixpkgs/nixos/maintainers/scripts/openstack/nova-image.nix> ./enable-qemu-guest-agent.nix ]; }"
teto commented 6 years ago

I would like to install qemu-agent in libvirtd images for nixops too. I believe it deserves its own name qemu-agent even if it's just an alias to qemu.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.