From: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
Libvirt logs and reports error when executing domblkinfo if vm
configured rbd storage and in inactive state.
The steps to reproduce the problem:
1. define and start domain with its storage configured rbd disk,
and corresponding disk label is 'vda'.
2. set vm in inactive state.
3. call 'virsh domblklinfo' as the following and problem reproduced.
$ virsh domblkinfo vm1 vda
error: internal error: missing storage backend for network files using
rbd protocol
Meanwhile, libvirtd log message also report the same error.
To fix this, validate the disk type if vm is inactive before
refreshing capacity and allocation limits of a given storage source
in qemuDomainGetBlockInfo in advance, if storage source type is
VIR_STORAGE_TYPE_NETWORK and net protocol is
VIR_STORAGE_NET_PROTOCAOL_RBD, set info to 0 like 'domblkinfo --all'
command does and return directly.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1724808
Signed-off-by: Hyman Huang(黄勇) <huangy81(a)chinatelecom.cn>
Signed-off-by: Pengcheng Deng <dengpc12(a)chinatelecom.cn>
---
src/qemu/qemu_driver.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c7cca64..bfe1fa2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -11118,6 +11118,19 @@ qemuDomainGetBlockInfo(virDomainPtr dom,
/* for inactive domains we have to peek into the files */
if (!virDomainObjIsActive(vm)) {
+ /* for rbd protocol, virStorageFileBackend not loaded if vm is inactive,
+ * so generate 0 based info like 'domblkinfo --all' does and return
directly
+ * */
+ if (virStorageSourceGetActualType(disk->src) == VIR_STORAGE_TYPE_NETWORK
&&
+ disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) {
+ info->capacity = 0;
+ info->allocation = 0;
+ info->physical = 0;
+
+ ret = 0;
+ goto endjob;
+ }
+
if ((qemuStorageLimitsRefresh(driver, cfg, vm, disk->src, false)) < 0)
goto endjob;
--
1.8.3.1