diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 453f20acf02f8b62658831156cfa84ab83800fa8..742dc07db6a1560a5b81390c7946a53a29fa60a9 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -1869,6 +1869,7 @@ virStorageBackendRedoPloopUpdate(virStorageSourcePtr target, struct stat *sb, /* * virStorageBackendUpdateVolTargetInfo + * @voltype: Volume type * @target: target definition ptr of volume to update * @withBlockVolFormat: true if caller determined a block file * @openflags: various VolOpenCheckMode flags to handle errors on open @@ -1881,7 +1882,8 @@ virStorageBackendRedoPloopUpdate(virStorageSourcePtr target, struct stat *sb, * be returned if the caller passed a readflagsflag. */ int -virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, +virStorageBackendUpdateVolTargetInfo(virStorageVolType voltype, + virStorageSourcePtr target, bool withBlockVolFormat, unsigned int openflags, unsigned int readflags) @@ -1898,7 +1900,7 @@ virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd, &sb)) < 0) goto cleanup; - if (target->type == VIR_STORAGE_VOL_FILE && + if (voltype == VIR_STORAGE_VOL_FILE && target->format != VIR_STORAGE_FILE_NONE) { if (S_ISDIR(sb.st_mode)) { if (virStorageBackendIsPloopDir(target->path)) { @@ -1969,13 +1971,15 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol, { int ret; - if ((ret = virStorageBackendUpdateVolTargetInfo(&vol->target, + if ((ret = virStorageBackendUpdateVolTargetInfo(vol->type, + &vol->target, withBlockVolFormat, openflags, readflags)) < 0) return ret; if (vol->target.backingStore && - (ret = virStorageBackendUpdateVolTargetInfo(vol->target.backingStore, + (ret = virStorageBackendUpdateVolTargetInfo(VIR_STORAGE_VOL_FILE, + vol->target.backingStore, withBlockVolFormat, VIR_STORAGE_VOL_OPEN_DEFAULT | VIR_STORAGE_VOL_OPEN_NOERROR, diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h index 3f0403907474ddd4f2023057a6941154c8e8b93a..b00b0f897819709041a999cf448411b794496699 100644 --- a/src/storage/storage_backend.h +++ b/src/storage/storage_backend.h @@ -226,7 +226,8 @@ int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol, bool withBlockVolFormat, unsigned int openflags, unsigned int readflags); -int virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target, +int virStorageBackendUpdateVolTargetInfo(virStorageVolType voltype, + virStorageSourcePtr target, bool withBlockVolFormat, unsigned int openflags, unsigned int readflags); diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index c3f7959380c66bf3c4bd9e773f3ef5894a7a9e4e..ecf74de491d7bbd030a1b7cbe50f3b897f017e26 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -875,7 +875,8 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED, vol->type = VIR_STORAGE_VOL_PLOOP; if (vol->target.backingStore) { - ignore_value(virStorageBackendUpdateVolTargetInfo(vol->target.backingStore, + ignore_value(virStorageBackendUpdateVolTargetInfo(VIR_STORAGE_VOL_FILE, + vol->target.backingStore, false, VIR_STORAGE_VOL_OPEN_DEFAULT, 0)); /* If this failed, the backing file is currently unavailable,