[libvirt] [PATCH] Refresh QEMU driver caps in getCapabilities
Cole Robinson
crobinso at redhat.com
Mon May 4 19:08:20 UTC 2009
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.
Thanks,
Cole
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-refresh-qemu-caps-02.patch
Type: text/x-patch
Size: 2456 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20090504/89d7b577/attachment-0001.bin>
More information about the libvir-list
mailing list