[libvirt] [PATCH] storage: fix broken backing chain

Eric Blake eblake at redhat.com
Thu Nov 8 23:10:09 UTC 2012


On 11/07/2012 06:53 AM, Philipp Hahn wrote:
> 82507838 refactured the code to keep both the raw and canonicalized form

s/refactured/refactored/

> of the backingStore, which breaks badly when the storage pool contains a
> storage volume, which is missing its backing store file:
>  # ./daemon/libvirtd -l
>  2012-11-07 12:43:33.279+0000: 22175: info : libvirt version: 1.0.0
>  2012-11-07 12:43:33.279+0000: 22175: error : absolutePathFromBaseFile:542 : Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
>  2012-11-07 12:43:33.280+0000: 22175: error : storageDriverAutostart:115 : Failed to autostart storage pool 'default': Can't canonicalize path '/var/lib/libvirt/images/base.qcow2': No such file or directory
> 
> This is because virStorageFileGetMetadataFromBuf() aborts with -1 if the
> filename of the backingStore can not be canonicalized:
>  #0  absolutePathFromBaseFile () at util/storage_file.c:541
>  #1  virStorageFileGetMetadataFromBuf () at util/storage_file.c:728
>  #2  virStorageFileGetMetadataFromFD () at util/storage_file.c:932
>  #3  virStorageBackendProbeTarget () at storage/storage_backend_fs.c:94
>  #4  virStorageBackendFileSystemRefresh () at storage/storage_backend_fs.c:849
>  #5  storagePoolStart () at storage/storage_driver.c:700
>  #6  virStoragePoolCreate () at libvirt.c:12471
>  ...
> 
> Treat files which miss their backing file as standalone files.

Makes sense; I don't know of anything better that we can do.

ACK and pushed.

> 
> Signed-off-by: Philipp Hahn <hahn at univention.de>
> ---
>  src/util/storage_file.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/storage_file.c b/src/util/storage_file.c
> index e9771d7..2249212 100644
> --- a/src/util/storage_file.c
> +++ b/src/util/storage_file.c
> @@ -727,8 +727,9 @@ virStorageFileGetMetadataFromBuf(int format,
>                  meta->backingStoreRaw = meta->backingStore;
>                  meta->backingStore = absolutePathFromBaseFile(path, backing);
>                  if (meta->backingStore == NULL) {
> -                    VIR_FREE(backing);
> -                    return -1;
> +                    /* the backing file is (currently) unavailable, treat this
> +                     * file as standalone */
> +                    backingFormat = VIR_STORAGE_FILE_NONE;
>                  }
>              }
>              VIR_FREE(backing);
> 

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121108/165a247a/attachment-0001.sig>


More information about the libvir-list mailing list