Bug 1590544

Summary: RFE: split autostart code
Product: [Community] Virtualization Tools Reporter: Yuri Arabadji <yuri>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: NEW --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: berrange, libvirt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yuri Arabadji 2018-06-12 20:09:09 UTC
We're doing some nasty things with storage (blkdevs mangling, DM, caching, etc) and would like the libvirtd availability and domain auto-starting be split into separate entities, so that we could hook into the middle.

Currently, on libvirtd startup, domains marked as such are autostarted. Which means there's no way for us to either:
1) start libvirtd.service; do our work that involves using libvirt routines; start "autostarted" domains
2) do our work involving communication with libvirtd daemon (e.g. virsh domblklist) before it's started; proceed with libvirtd startup (which would start autostart'ed domains)

We can't use hooks in 1) (otherwise I wouldn't log this RFE) because https://www.libvirt.org/hooks.html#recursive AND because (probably?) hook would be invoked after domains are autostart'ed.

Ideas are welcome.

Thanks.

Comment 1 Daniel Berrangé 2018-06-13 09:19:10 UTC
Honestly if you have such complex ordering requirements wrt autostart, the best approach is to not use libvirt's autostart feature at all. Create your own system unit file that depends on libvirtd.service, and have this do startup of storage and guests in whatever manner you need.

Comment 2 Yuri Arabadji 2018-06-13 13:32:14 UTC
Thanks, Daniel, that's one of the direction we're heading to. 

But still, this enhancement would be a good addition to https://bugzilla.redhat.com/show_bug.cgi?id=1401054 . I mean, if you have split the shutdown part, why not split the start-up.