[libvirt] [RFC PATCH 7/8] qemu: Prepare basic APIs to handle invalid defs

Daniel P. Berrange berrange at redhat.com
Tue Sep 22 12:48:01 UTC 2015


On Tue, Sep 22, 2015 at 02:15:53PM +0200, Martin Kletzander wrote:
> In order for the user to be able to fix broken domains function
> qemuDomainGetXMLDesc() needs to be able to lookup invalid domain
> definitions and handle them properly.  When redefined, function
> qemuDomainDefineXMLFlags() must clear the 'invalid XML' reason.  As a
> nice addition, qemuDomainGetState() can lookup such domains without any
> other change and that allows virsh not only to get their status, but
> also to list them.

Hmm, that's an interesting approach to the problem. I wonder though
if we could do things slightly differently such that we don't need
to change so many APIs.

eg, just have a 'bool error' field in virDomainDefPtr. When loading
the XML fails, populate a virDomainObjPtr/DefPtr as normal, but set
the error field. Now we merely need to change the qemuDomainStart
method, so it refuses to launch a VM with the 'error' flag set. All
the other APIs could be essentially unchanged. Sure it would not
be useful to allow things like virDomainAttachDevice, etc on such
broken domains, but for sake of simplicity we can avoid touching
all the methods except start.


Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list