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

Re: [libvirt] storage_backend_fs.c Bug



On Tue, Feb 17, 2009 at 09:44:24AM -0500, Cole Robinson wrote:
> Jim Meyering wrote:
> > Russell <russellhaering 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 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

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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