KR> Verifying the volume exists isn't enough to prove the disk_pool
KR> struct is the proper pool. We need to verify the volume is in the
KR> pool of a given pool struct.
Hmm, that's bizarre. Why don't all images show up in all pools then?
I definitely agree with the second statement, but I find it
interesting that we haven't seen this until now...
KR> static bool _diskpool_is_member(virConnectPtr conn,
KR> const struct disk_pool *pool,
KR> - const char *file)
KR> + const char *file,
KR> + virStorageVolPtr vol)
KR> {
This change (well, the dependent one below) means that this code won't
compile on libvirt < 0.4.0.
KR> - virStorageVolPtr vol = NULL;
KR> bool result = false;
KR> + virStoragePoolPtr pool_vol = NULL;
KR> + const char *pool_name = NULL;
KR> - vol = virStorageVolLookupByPath(conn, file);
KR> - if (vol != NULL)
KR> - result = true;
KR> -
KR> + pool_vol = virStoragePoolLookupByVolume(vol);
KR> + if (vol != NULL) {
KR> + pool_name = virStoragePoolGetName(pool_vol);
KR> + if ((pool_name != NULL) && (STREQC(pool_name,
pool->tag)))
KR> + result = true;
KR> + }
Why make the caller do the lookup? I can't see any reason why the
virStorageVolLookupByPath() should be moved to the caller, which its
part of the pool implementation and would work just fine here.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com