On Thu, Nov 08, 2012 at 03:42:49PM +0100, Daniel P. Berrange wrote: > On Thu, Nov 08, 2012 at 03:41:12PM +0100, Peter Krempa wrote: > > On 11/08/12 15:13, Daniel P. Berrange wrote: > > >On Wed, Nov 07, 2012 at 11:32:22AM +0100, Peter Krempa wrote: > > >>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. > > > > > >I don't think the XML should be in the business of having the > > >autostart flag, as this is not guest configuration information. > > >Having it in the XML introduces the problem of maintaining the > > >correct synchronization between the autostart symlink and the > > >XML description. > > > > Yes, that will be troublesome. It's unfortunate we still have to use > > the symlink approach. > > > > > > > >Further, in the future I'd like to actually replace our current > > >autostart code, with code that just sets up systemd units to > > >deal with autostart. > > > > > >In such a scenario, the user will be able to toggle autostart > > >directly using systemd, so we don't want libvirt duplicating > > >that info in the XML since it won't be aware of when systemd > > >changes the autostart flag. > > > > Note that there are still distros that are doing everything possible > > to avoid having systemd. It wouldn't be nice if we broke > > autostarting there. > > Of course, not least RHEL-5 and RHEL-6. If we did support systemd, > we would have a compile time option to use systemd vs our current > autostart code. Can we make this runtime then? Some distroy like Debian have systemd optional so toggling this based on systemd actually being used would be most helpful. Cheers, -- Guido -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list