[libvirt] [PATCH] Refresh QEMU driver caps in getCapabilities

Daniel Veillard veillard at redhat.com
Wed May 6 13:14:29 UTC 2009


On Mon, May 04, 2009 at 03:08:20PM -0400, Cole Robinson wrote:
> Daniel P. Berrange wrote:
> > On Tue, Apr 28, 2009 at 12:25:41PM -0400, Cole Robinson wrote:
> > 
> > 
> >> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> >> index 79ee072..6b5c17f 100644
> >> --- a/src/qemu_driver.c
> >> +++ b/src/qemu_driver.c
> >> @@ -1872,10 +1872,12 @@ static int qemudGetNodeInfo(virConnectPtr conn,
> >>  
> >>  static char *qemudGetCapabilities(virConnectPtr conn) {
> >>      struct qemud_driver *driver = conn->privateData;
> >> -    char *xml;
> >> +    char *xml = NULL;
> >>  
> >>      qemuDriverLock(driver);
> >> -    if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
> >> +    virCapabilitiesFree(qemu_driver->caps);
> >> +    if ((qemu_driver->caps = qemudCapsInit()) == NULL ||
> >> +        (xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
> >>          virReportOOMError(conn);
> >>      qemuDriverUnlock(driver);
> > 
> > The thing to be wary of now, is that all use of driver->caps needs
> > to be protected by the driver mutex. Most usages are OK, but I
> > spotted a couple that are not.
> > 
> > Daniel
> 
> Okay, updated patch attached. The only unsafe caps usage I found was in
> qemudNodeGetSecurityModel, not sure if you spotted any others.

  That patch looks fine to me, any reason not to apply it ?

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list