
On 11/07/12 11:04, Ruben Kerkhof wrote:
Hi list,
I'd like to check if a domain has autostart enabled. I do this now by looking if there's a symlink in /etc/libvirt/qemu/autostart, but it feels a bit hackish.
Is this something that could be added to virsh? Something like virsh get-autostart domain would be great.
For now there are two options how to check the autostart flag: 1) virsh dominfo - This is suitable to check for the state of a single guest. Unfortunately we have just this one output option where it is embedded with other information about the guest: $ virsh dominfo tr Id: 1 Name: tr UUID: 17f42b42-9fdd-81e3-4a93-a75021a707d3 OS Type: hvm State: running CPU(s): 1 CPU time: 200.5s Max memory: 53248 KiB Used memory: 53248 KiB Persistent: yes Autostart: enable <- here! Managed save: no Security model: none Security DOI: 0 2) use virsh list --all --autostart to list guests that have the autostart flag enabled (also note that there are script-friendly outputs for virsh list --name and --uuid): $ virsh list --all --autostart Id Name State ---------------------------------------------------- 1 tr running - Bare shut off We're planing on adding the autostart flag as an XML element and a few other improvements of autostaring guests.
Kind regards,
Ruben
Peter