diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-29 15:25:30 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-05-30 10:03:03 -0700 |
commit | ce0508b14feb969555e8f8ecb1c2a7e6a3d48339 (patch) | |
tree | 4274b4c5da07fc58776eba2284af7ae8e11b2058 /src/property/libvirt.lisp | |
parent | edbba484918f6de83680a5b29e561fba981e05e9 (diff) | |
download | consfigurator-ce0508b14feb969555e8f8ecb1c2a7e6a3d48339.tar.gz |
add LIBVIRT:STARTED
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/property/libvirt.lisp')
-rw-r--r-- | src/property/libvirt.lisp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/property/libvirt.lisp b/src/property/libvirt.lisp index d2de264..0617e46 100644 --- a/src/property/libvirt.lisp +++ b/src/property/libvirt.lisp @@ -93,6 +93,19 @@ subcommand of virsh(1) to convert the running domain into a transient domain." (declare (ignore arguments)) (mrun "virsh" "undefine" (get-hostname host)))) +(defprop started :posix (host) + "Ensure the libvirt domain for the host designated by HOST is started. +(I.e., if HOST is a string, ensure the domain named HOST is started; if HOST +is a HOST value, start the libvirt domain whose name is HOST's hostname.)" + (:desc #?"libvirt domain ${(get-hostname host)} started") + (:check + ;; The "State" column in the output of 'virsh list' is to be ignored here; + ;; 'virsh start' will do nothing if the VM appears at all in the output of + ;; 'virsh list'. + (member (get-hostname host) (mapcar #'cadr (virsh-get-columns "list")) + :test #'string=)) + (:apply (mrun "virsh" "start" (get-hostname host)))) + (defun virsh-get-columns (&rest arguments) "Run a virsh command that is expected to yield tabular output, with the given list of ARGUMENTS, and return the rows." |