Re: [PATCHv3 4/4] storage: probe qcow2 volumes in gluster pool

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

 



On 11/12/2013 09:00 AM, Peter Krempa wrote:
> On 11/12/13 05:19, Eric Blake wrote:
>> Putting together pieces from previous patches, it is now possible
>> for 'virsh dumpxml --pool gluster volname' to report metadata
> 
> Did you mean 'virsh vol-dumpxml --pool ... '?

Yes.

>>
>> +static int
> 
> This function is declared as an int, but ...
> 
>> +virStorageBackendGlusterReadHeader(glfs_fd_t *fd,
>> +                                   const char *name,
>> +                                   int maxlen,
>> +                                   char **buf)
>> +{
>> +    char *s;
>> +    size_t nread = 0;
> 
> .. returns size_t. This could overflow normally, but is guarded by
> maxlen. Okay.

I'll improve the types.

>> +    if (!(fd = glfs_open(state->vol, name, O_RDONLY| O_NONBLOCK | O_NOCTTY))) {
>> +        if ((errno == ENOENT || errno == ELOOP) &&
>> +            S_ISLNK(st->st_mode)) {
>> +            VIR_WARN("ignoring dangling symlink '%s'", name);
>> +            ret = 0;
>> +        } else {
>> +            virReportSystemError(errno, _("cannot open volume '%s'"), name);
>> +        }
>> +        goto cleanup;
>> +    }
> 
> Now that you actually open the volume file and probe it, you need to
> kill the comment added in previous patch:
> 
> +    if (VIR_ALLOC(vol) < 0 ||
> +        VIR_STRDUP(vol->name, name) < 0 ||
> +        virAsprintf(&vol->key, "%s%s/%s",
> +                    *pool == '/' ? "" : "/", pool, vol->name) < 0)
> +        goto cleanup;
> +
> +    /* FIXME - must open files to determine if they are non-raw */
> +    vol->type = VIR_STORAGE_VOL_NETWORK;
> +    vol->target.format = VIR_STORAGE_FILE_RAW;
> +    vol->capacity = vol->allocation = st->st_size;

Good catch.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]