[libvirt] storage_backend_fs.c Bug

Cole Robinson crobinso at redhat.com
Tue Feb 17 14:51:39 UTC 2009


Daniel P. Berrange wrote:
> On Tue, Feb 17, 2009 at 09:44:24AM -0500, Cole Robinson wrote:
>> Jim Meyering wrote:
>>> Russell <russellhaering at gmail.com> wrote:
>>>> Line 1133 of storage_backend_fs.c in 0.6.0:
>>>>
>>>>         if (vol->target.backingStore != NULL) {
>>>>             virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
>>>>                                   _("copy-on-write image not supported with "
>>>>                                     "qcow-create"));
>>>>             return -1;
>>>>         }
>>>>
>>>> virStorageVolTarget has no member called backingStore, resulting in
>>>> compile errors.
>>> Thanks for the report.
>>> Here's a patch:
>>>
>>> >From 5ba834b615a90df49da46d3f3c74cee1f9a5adec Mon Sep 17 00:00:00 2001
>>> From: Jim Meyering <meyering at redhat.com>
>>> Date: Tue, 17 Feb 2009 11:05:41 +0100
>>> Subject: [PATCH] fix compile-error when configured without qemu-img
>>>
>>> * src/storage_backend_fs.c (virStorageBackendFileSystemVolCreate):
>>> Test vol->target.path, not vol->target.backingStore.
>>> Reported by Russell Haering.
>>> ---
>>>  src/storage_backend_fs.c |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/src/storage_backend_fs.c b/src/storage_backend_fs.c
>>> index 240de96..488f578 100644
>>> --- a/src/storage_backend_fs.c
>>> +++ b/src/storage_backend_fs.c
>>> @@ -1130,7 +1130,7 @@ virStorageBackendFileSystemVolCreate(virConnectPtr conn,
>>>                                    vol->target.format);
>>>              return -1;
>>>          }
>>> -        if (vol->target.backingStore != NULL) {
>>> +        if (vol->target.path != NULL) {
>>>              virStorageReportError(conn, VIR_ERR_NO_SUPPORT,
>>>                                    _("copy-on-write image not supported with "
>>>                                      "qcow-create"));
>> That will fix the compilation failure, but doesn't match the error
>> message. I think the correct fix is:
>>
>> -        if (vol->target.backingStore != NULL) {
>> +        if (vol->backingStore != NULL) {
> 
> No, it should be
> 
>    if (vol->backingStore.path != NULL) {
> 
> 
> Both 'backingStore' and 'target are embedded instances of virStorageVolTarget
> struct, so you have to check the 'path' field of that struct for NULL
> 

Ahh, yes that's right. I wasn't thinking clearly. ACK to the above.

- Cole




More information about the libvir-list mailing list