]> xenbits.xensource.com Git - libvirt.git/commit
storage: Fix virStorageBackendUpdateVolTargetInfo type check
authorJohn Ferlan <jferlan@redhat.com>
Tue, 6 Dec 2016 11:17:20 +0000 (06:17 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 18 Jan 2017 11:09:38 +0000 (06:09 -0500)
commitd04bb05fb7e9bf057b88032ffcd6709d1b70daef
tree152b55a16daf58f675a971e02c91b65d3c9e3f78
parent77831d212e2a2ec92e24811b133944f98f3a2d0a
storage: Fix virStorageBackendUpdateVolTargetInfo type check

For volume processing in virStorageBackendUpdateVolTargetInfo to get
the capacity commit id 'a760ba3a7' added the ability to probe a volume
that didn't list a target format. Unfortunately, the code used the
virStorageSource  (e.g. target->type - virStorageType) rather than
virStorageVolDef (e.g. vol->type - virStorageVolType) in order to
make the comparison. As it turns out target->type for a volume is
not filled in at all for a voldef as the code relies on vol->type.
Ironically the result is that only VIR_STORAGE_VOL_BLOCK's would get
their capacity updated.

This patch will adjust the code to check the "vol->type" field instead
as an argument. This way for a voldef, the correct comparison is made.

Additionally for a backingStore, the 'type' field is never filled in;
however, since we know that the provided path is a location at which
the backing store can be accessed on the local filesystem thus just
pass VIR_STORAGE_VOL_FILE in order to satisfy the adjusted voltype
check. Whether it's a FILE or a BLOCK only matters if we're trying to
get more data based on the target->format.
src/storage/storage_backend.c
src/storage/storage_backend.h
src/storage/storage_backend_fs.c