Re: [PATCH] Allow non-file disk backingStores

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

 



On 11/03/2010 09:50 AM, Adam Litke wrote:
> I am trying to use a qcow image with libvirt where the backing 'file' is a
> qemu-nbd server.  Unfortunately virDomainDiskDefForeachPath() assumes that
> backingStore is always a real file so something like 'nbd:0:3333' is rejected
> because a file with that name cannot be accessed.  Note that I am not worried
> about directly using nbd images.  That would require a new disk type with XML
> markup, etc.  I only want it to be permitted as a backingStore
> 
> The following patch implements danpb's suggestion:
>> I think I'm inclined to push the logic for skipping NBD one stage higher.
>> I'd rather expect virStorageFileGetMetadata() to return all backing
>> stores, even if not files. The virDomainDiskDefForeachPath() method
>> should definitely ignore non-file backing stores though.
>>
>> So what I'm thinking is to extend the virStorageFileMetadata struct and
>> just add a 'bool isFile' field to it. Default this field to true, unless
>> you see the prefix of nbd: in which case set it to false. The
>> virDomainDiskDefForeachPath() method can then skip over any backing
>> store with isFile == false
> 
> Signed-off-by: Adam Litke <agl@xxxxxxxxxx>
> Cc: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c  |    7 +++++++
>  src/util/storage_file.c |   16 +++++++++++++++-
>  src/util/storage_file.h |    1 +
>  3 files changed, 23 insertions(+), 1 deletions(-)

ACK, and I've pushed this after adjusting one nit.

> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index fe93711..2d11785 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -7813,6 +7813,13 @@ int virDomainDiskDefForeachPath(virDomainDiskDefPtr disk,
>          depth++;
>          nextpath = meta.backingStore;
>  
> +        /* Stop iterating if we reach a non-file backing store */
> +        if (nextpath && meta.backingStoreIsFile == false) {

When I know a variable is bool, then I prefer using 'var' or '!var'
rather than the more verbose 'var == true' or 'var == false'.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]