diff --git a/80-qemu-ga.rules b/80-qemu-ga.rules new file mode 100644 index 00000000..26defbfd --- /dev/null +++ b/80-qemu-ga.rules @@ -0,0 +1 @@ +SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-ga.service" diff --git a/qemu-ga.service b/qemu-ga.service new file mode 100644 index 00000000..d1a4df6d --- /dev/null +++ b/qemu-ga.service @@ -0,0 +1,11 @@ +[Unit] +Description=QEMU Guest Agent +Documentation=http://wiki.qemu.org/Features/QAPI/GuestAgent +BindsTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device +After=dev-virtio\x2dports-org.qemu.guest_agent.0.device + +[Service] +Type=simple +ExecStart=-/usr/bin/qemu-ga +Restart=always +RestartSec=0 diff --git a/qemu-testsuite.changes b/qemu-testsuite.changes index 7af75e7b..7b163718 100644 --- a/qemu-testsuite.changes +++ b/qemu-testsuite.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Nov 19 11:23:26 UTC 2015 - tampakrap@opensuse.org + +- Add systemd unit file and udev rules for qemu guest agent + - taken from the SLE12 / Leap package, see boo#955707 + ------------------------------------------------------------------- Wed Oct 28 18:53:37 UTC 2015 - afaerber@suse.de diff --git a/qemu-testsuite.spec b/qemu-testsuite.spec index 58384d09..4150f828 100644 --- a/qemu-testsuite.spec +++ b/qemu-testsuite.spec @@ -62,6 +62,8 @@ Source4: qemu-kvm.1.gz Source5: 60-kvm.rules Source6: ksm.service Source7: 60-kvm.x86.rules +Source8: 80-qemu-ga.rules +Source9: qemu-ga.service # Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch # This patch queue is auto-generated from https://github.com/openSUSE/qemu Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch @@ -497,6 +499,9 @@ This sub-package contains various tools, including a bridge helper. Summary: Universal CPU emulator -- Guest agent Group: System/Emulators/PC Provides: qemu:%_bindir/qemu-ga +%if 0%{?with_systemd} +%{?systemd_requires} +%endif %description guest-agent QEMU is an extremely well-performing CPU emulator that allows you to @@ -890,6 +895,8 @@ install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules %endif %endif install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service +install -D -p -m 0644 %{SOURCE8} %{buildroot}%{_udevrulesdir}/80-qemu-ga.rule +install -D -p -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/qemu-ga.service %fdupes -s $RPM_BUILD_ROOT %else # qemu-testsuite @@ -910,9 +917,6 @@ install -D -m 644 check-report.xml %{buildroot}%{_datadir}/qemu/check-report.xml %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu -%pre guest-agent -%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null - %if %{kvm_available} %post %if 0%{?with_systemd} @@ -933,7 +937,24 @@ fi %verify_permissions %_libexecdir/qemu-bridge-helper %endif +%pre guest-agent +%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null %if 0%{?with_systemd} +%service_add_pre qemu-ga.service + +%preun guest-agent +%service_del_preun qemu-ga.service + +%post guest-agent +if [ "$(readlink -f /proc/1/root)" = "/" ]; then + /sbin/udevadm control --reload-rules || : + /sbin/udevadm trigger || : +fi +%service_add_post qemu-ga.service + +%postun guest-agent +%service_del_postun qemu-ga.service + %pre ksm %service_add_pre ksm.service @@ -1117,8 +1138,10 @@ fi %files guest-agent %defattr(-, root, root) %attr(755,root,kvm) %_bindir/qemu-ga - %if 0%{?with_systemd} +%{_unitdir}/qemu-ga.service +%{_udevrulesdir}/80-qemu-ga.rules + %files ksm %defattr(-, root, root) %{_unitdir}/ksm.service diff --git a/qemu.changes b/qemu.changes index 7af75e7b..7b163718 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Nov 19 11:23:26 UTC 2015 - tampakrap@opensuse.org + +- Add systemd unit file and udev rules for qemu guest agent + - taken from the SLE12 / Leap package, see boo#955707 + ------------------------------------------------------------------- Wed Oct 28 18:53:37 UTC 2015 - afaerber@suse.de diff --git a/qemu.spec b/qemu.spec index 5dbf22a0..ab4df843 100644 --- a/qemu.spec +++ b/qemu.spec @@ -62,6 +62,8 @@ Source4: qemu-kvm.1.gz Source5: 60-kvm.rules Source6: ksm.service Source7: 60-kvm.x86.rules +Source8: 80-qemu-ga.rules +Source9: qemu-ga.service # Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch # This patch queue is auto-generated from https://github.com/openSUSE/qemu Patch0001: 0001-XXX-dont-dump-core-on-sigabort.patch @@ -497,6 +499,9 @@ This sub-package contains various tools, including a bridge helper. Summary: Universal CPU emulator -- Guest agent Group: System/Emulators/PC Provides: qemu:%_bindir/qemu-ga +%if 0%{?with_systemd} +%{?systemd_requires} +%endif %description guest-agent QEMU is an extremely well-performing CPU emulator that allows you to @@ -890,6 +895,8 @@ install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules %endif %endif install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service +install -D -p -m 0644 %{SOURCE8} %{buildroot}%{_udevrulesdir}/80-qemu-ga.rule +install -D -p -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/qemu-ga.service %fdupes -s $RPM_BUILD_ROOT %else # qemu-testsuite @@ -910,9 +917,6 @@ install -D -m 644 check-report.xml %{buildroot}%{_datadir}/qemu/check-report.xml %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu -%pre guest-agent -%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null - %if %{kvm_available} %post %if 0%{?with_systemd} @@ -933,7 +937,24 @@ fi %verify_permissions %_libexecdir/qemu-bridge-helper %endif +%pre guest-agent +%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null %if 0%{?with_systemd} +%service_add_pre qemu-ga.service + +%preun guest-agent +%service_del_preun qemu-ga.service + +%post guest-agent +if [ "$(readlink -f /proc/1/root)" = "/" ]; then + /sbin/udevadm control --reload-rules || : + /sbin/udevadm trigger || : +fi +%service_add_post qemu-ga.service + +%postun guest-agent +%service_del_postun qemu-ga.service + %pre ksm %service_add_pre ksm.service @@ -1117,8 +1138,10 @@ fi %files guest-agent %defattr(-, root, root) %attr(755,root,kvm) %_bindir/qemu-ga - %if 0%{?with_systemd} +%{_unitdir}/qemu-ga.service +%{_udevrulesdir}/80-qemu-ga.rules + %files ksm %defattr(-, root, root) %{_unitdir}/ksm.service diff --git a/qemu.spec.in b/qemu.spec.in index b71a972e..46899a01 100644 --- a/qemu.spec.in +++ b/qemu.spec.in @@ -62,6 +62,8 @@ Source4: qemu-kvm.1.gz Source5: 60-kvm.rules Source6: ksm.service Source7: 60-kvm.x86.rules +Source8: 80-qemu-ga.rules +Source9: qemu-ga.service # Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch # This patch queue is auto-generated from https://github.com/openSUSE/qemu PATCH_FILES @@ -458,6 +460,9 @@ This sub-package contains various tools, including a bridge helper. Summary: Universal CPU emulator -- Guest agent Group: System/Emulators/PC Provides: qemu:%_bindir/qemu-ga +%if 0%{?with_systemd} +%{?systemd_requires} +%endif %description guest-agent QEMU is an extremely well-performing CPU emulator that allows you to @@ -812,6 +817,8 @@ install -D -m 644 %{SOURCE5} %{buildroot}%{_udevrulesdir}/60-kvm.rules %endif %endif install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service +install -D -p -m 0644 %{SOURCE8} %{buildroot}%{_udevrulesdir}/80-qemu-ga.rule +install -D -p -m 0644 %{SOURCE9} %{buildroot}%{_unitdir}/qemu-ga.service %fdupes -s $RPM_BUILD_ROOT %else # qemu-testsuite @@ -832,8 +839,6 @@ install -D -m 644 check-report.xml %{buildroot}%{_datadir}/qemu/check-report.xml %{_sbindir}/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \ -c "qemu user" qemu -%pre guest-agent -%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null %if %{kvm_available} %post @@ -855,7 +860,24 @@ fi %verify_permissions %_libexecdir/qemu-bridge-helper %endif +%pre guest-agent +%{_bindir}/getent group kvm >/dev/null || %{_sbindir}/groupadd -r kvm 2>/dev/null %if 0%{?with_systemd} +%service_add_pre qemu-ga.service + +%preun guest-agent +%service_del_preun qemu-ga.service + +%post guest-agent +if [ "$(readlink -f /proc/1/root)" = "/" ]; then + /sbin/udevadm control --reload-rules || : + /sbin/udevadm trigger || : +fi +%service_add_post qemu-ga.service + +%postun guest-agent +%service_del_postun qemu-ga.service + %pre ksm %service_add_pre ksm.service @@ -1039,8 +1061,10 @@ fi %files guest-agent %defattr(-, root, root) %attr(755,root,kvm) %_bindir/qemu-ga - %if 0%{?with_systemd} +%{_unitdir}/qemu-ga.service +%{_udevrulesdir}/80-qemu-ga.rules + %files ksm %defattr(-, root, root) %{_unitdir}/ksm.service