[libvirt] [PATCH] vz: implementation of domainCreateXML callback

Daniel P. Berrange berrange at redhat.com
Tue Nov 24 14:27:36 UTC 2015


On Tue, Nov 24, 2015 at 05:24:48PM +0300, Dmitry Guryanov wrote:
> On Fri, 2015-11-20 at 16:52 +0300, Mikhail Feoktistov wrote:
> > ---
> >  src/vz/vz_driver.c | 33 +++++++++++++++++++++++++++++++++
> >  1 file changed, 33 insertions(+)
> > 
> > diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
> > index 39f58a4..31dfb6a 100644
> > --- a/src/vz/vz_driver.c
> > +++ b/src/vz/vz_driver.c
> > @@ -979,6 +979,38 @@ vzDomainUndefine(virDomainPtr domain)
> >      return vzDomainUndefineFlags(domain, 0);
> >  }
> >  
> > +static virDomainPtr
> > +vzDomainCreateXML(virConnectPtr conn,
> > +                  const char *xml,
> > +                  unsigned int flags)
> > +{
> > +    virDomainPtr domain;
> > +    int ret;
> > +
> > +    virCheckFlags(VIR_DOMAIN_START_PAUSED, NULL);
> > +
> > +    domain = vzDomainDefineXMLFlags(conn, xml, 0);
> > +    if (domain == NULL)
> > +        return domain;
> > +
> > +    ret = vzDomainCreate(domain);
> > +    if (ret != 0) {
> > +        vzDomainUndefine(domain);
> > +        return NULL;
> > +    }
> > +
> > +    if (flags & VIR_DOMAIN_START_PAUSED) {
> > +        ret = vzDomainSuspend(domain);
> > +        if (ret != 0) {
> > +            vzDomainDestroy(domain);
> > +            vzDomainUndefine(domain);
> > +            return NULL;
> > +        }
> 
> I think we shouldn't allow this start paused operation. Because it means that
> domain shouldn't run any code before being paused, and with this implementation
> we start a domain, it does some work and only that you suspend it. Also suspend
> and paused states are different and we only support paused state for VMs.

Yeah, VIR_DOMAIN_START_PAUSED really needs to guarantee that the
guest OS does not execute any code at all, not even a tiny bit.

If a driver can't do that, apps can still fallback to manually pausing
the guest after starting it, if they are ok with those semantics, so
no need for drivers todo that fallback approach themselves.

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