[libvirt] [PATCH] Refresh QEMU driver caps in getCapabilities
Cole Robinson
crobinso at redhat.com
Wed May 6 14:21:00 UTC 2009
On 05/06/2009 09:14 AM, Daniel Veillard wrote:
> 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
>
Nope! I've pushed it now.
Thanks,
Cole
More information about the libvir-list
mailing list