From: GSI <GSI@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] libvirt: add service for controlling guests marked "autostart"
Date: Wed, 09 Mar 2022 21:24:11 +0100 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36068@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
There is a new pull request by GSI against master on the void-packages repository
https://github.com/GSI/void-packages libvirtd-guests
https://github.com/void-linux/void-packages/pull/36068
libvirt: add service for controlling guests marked "autostart"
#### Testing the changes
- I tested the changes in this PR: **YES**
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-musl)
A patch file from https://github.com/void-linux/void-packages/pull/36068.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-libvirtd-guests-36068.patch --]
[-- Type: text/x-diff, Size: 2589 bytes --]
From 78970706c4708ffeef09e596cdced2ec05b1e9d1 Mon Sep 17 00:00:00 2001
From: GSI2022 <2022@groovy-skills.com>
Date: Wed, 9 Mar 2022 21:16:30 +0100
Subject: [PATCH] libvirt: add service for controlling guests marked
"autostart"
---
srcpkgs/libvirt/files/libvirtd-guests/finish | 24 ++++++++++++++++++++
srcpkgs/libvirt/files/libvirtd-guests/run | 11 +++++++++
srcpkgs/libvirt/template | 2 +-
3 files changed, 36 insertions(+), 1 deletion(-)
create mode 100755 srcpkgs/libvirt/files/libvirtd-guests/finish
create mode 100755 srcpkgs/libvirt/files/libvirtd-guests/run
diff --git a/srcpkgs/libvirt/files/libvirtd-guests/finish b/srcpkgs/libvirt/files/libvirtd-guests/finish
new file mode 100755
index 000000000000..3e25b8cd2ce0
--- /dev/null
+++ b/srcpkgs/libvirt/files/libvirtd-guests/finish
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# Command guests to shut down and wait for them to finish.
+# A reasonable grace period should be set via the SVWAIT environment variable.
+# Example: SVWAIT=300 sv stop libvirtd-guests
+#
+# Note that the "libvirtd-guests" service only handles guests marked "autostart".
+
+request_guest_shutdown () {
+ local guests="${1}"
+ echo "$guests" | while read g ; do virsh shutdown "$g" ; done
+}
+
+guests=`virsh list --name --autostart | sed '/^$/d'`
+request_guest_shutdown "$guests"
+
+# Wait until guests are powered off.
+while [ "$guests" != "" ] ; do
+ # Apparently certain (Windows) guests want to be asked multiple
+ # times to shut down.
+ request_guest_shutdown "$guests"
+ sleep 1
+ guests=`virsh list --name --autostart | sed '/^$/d'`
+done
diff --git a/srcpkgs/libvirt/files/libvirtd-guests/run b/srcpkgs/libvirt/files/libvirtd-guests/run
new file mode 100755
index 000000000000..4ba801fb5f91
--- /dev/null
+++ b/srcpkgs/libvirt/files/libvirtd-guests/run
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+guests=`virsh list --name --autostart --state-shutoff`
+
+echo "$guests" | while read g ; do
+ if [ "$g" != '' ] ; then
+ virsh start "$g"
+ fi
+done
+
+pause
diff --git a/srcpkgs/libvirt/template b/srcpkgs/libvirt/template
index 1568aa905a56..65071b566485 100644
--- a/srcpkgs/libvirt/template
+++ b/srcpkgs/libvirt/template
@@ -89,7 +89,7 @@ post_install() {
local _services _srv
# runit services; libvirtd is for legacy use
- _services="libvirt-generic libvirtd virtqemud virtvboxd virtxend
+ _services="libvirt-generic libvirtd libvirtd-guests virtqemud virtvboxd virtxend
virtlxcd virtlockd virtlogd virtproxyd virtinterfaced virtnetworkd
virtnodedevd virtnwfilterd virtsecretd virtstoraged"
for _srv in $_services; do
next reply other threads:[~2022-03-09 20:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 20:24 GSI [this message]
2022-06-28 2:16 ` github-actions
2022-06-28 10:34 ` GSI
2022-09-28 2:14 ` github-actions
2022-10-13 2:15 ` [PR PATCH] [Closed]: " github-actions
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-36068@inbox.vuxu.org \
--to=gsi@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).