[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 8/8] Add domainSuspend/Resume to libxl driver



Am Donnerstag 24 März 2011 16:55:23 schrieb Jim Fehlig:
> Markus Groß wrote:
> > ---
> >  src/libxl/libxl_driver.c |  114 +++++++++++++++++++++++++++++++++++++++++++++-
> >  1 files changed, 112 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> > index 4b31197..669c170 100644
> > --- a/src/libxl/libxl_driver.c
> > +++ b/src/libxl/libxl_driver.c
> > @@ -1041,6 +1041,116 @@ libxlDomainLookupByName(virConnectPtr conn, const char *name)
> >  }
> >  
> >  static int
> > +libxlDomainSuspend(virDomainPtr dom)
> > +{
> > +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> > +    virDomainObjPtr vm;
> > +    libxlDomainObjPrivatePtr priv;
> > +    virDomainEventPtr event = NULL;
> > +    int ret = -1;
> > +
> > +    libxlDriverLock(driver);
> > +    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> >   
> 
> Is there any reason the driver can't be unlocked here?

Thanks for pointing that out. I think it will be sufficient to limit the locking to the libxlDomainEventQueue call.

> > +    }
> > +
> > +    if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
> > +        goto cleanup;
> > +
> > +    ret = 0;
> > +
> > +cleanup:
> > +    if (vm)
> > +        virDomainObjUnlock(vm);
> > +    if (event)
> > +        libxlDomainEventQueue(driver, event);
> > +    libxlDriverUnlock(driver);
> > +    return ret;
> > +}
> > +
> > +
> > +static int
> > +libxlDomainResume(virDomainPtr dom)
> > +{
> > +    libxlDriverPrivatePtr driver = dom->conn->privateData;
> > +    virDomainObjPtr vm;
> > +    libxlDomainObjPrivatePtr priv;
> > +    virDomainEventPtr event = NULL;
> > +    int ret = -1;
> > +
> > +    libxlDriverLock(driver);
> > +    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
> >   
> 
> Same question here about unlocking the driver.

See my answer above.


Thanks,
Markus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]