From e73b8fb01f4b59926c8cccfdbeaea17ad7777220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 12 Oct 2022 15:53:00 +0200 Subject: [PATCH 1/2] Add guest agent device when creating VMs This is necessary for qemu-guest-agent to actually work --- site-cookbooks/kosmos_kvm/templates/create_vm.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/site-cookbooks/kosmos_kvm/templates/create_vm.erb b/site-cookbooks/kosmos_kvm/templates/create_vm.erb index fc8fbcb..0514f5d 100644 --- a/site-cookbooks/kosmos_kvm/templates/create_vm.erb +++ b/site-cookbooks/kosmos_kvm/templates/create_vm.erb @@ -86,5 +86,6 @@ virt-install \ --graphics none \ --serial pty \ --console pty \ + --channel unix,mode=bind,path=/var/lib/libvirt/qemu/guest01.agent,target_type=virtio,name=org.qemu.guest_agent.0 \ --autostart \ --import From 315cd247e5853edacba604b6ec168d4014eea95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Wed, 12 Oct 2022 15:55:08 +0200 Subject: [PATCH 2/2] Enable qemu-guest-agent after install This is actually automatically done for the service from the apt package, but I like specifying it explicitly as well. --- site-cookbooks/kosmos_kvm/recipes/guest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site-cookbooks/kosmos_kvm/recipes/guest.rb b/site-cookbooks/kosmos_kvm/recipes/guest.rb index 76052a7..e83f92a 100644 --- a/site-cookbooks/kosmos_kvm/recipes/guest.rb +++ b/site-cookbooks/kosmos_kvm/recipes/guest.rb @@ -6,5 +6,5 @@ package %w(qemu-guest-agent) service "qemu-guest-agent" do - action [:start] + action [:enable, :start] end