It will be necessary to initialize various aspects for the detected members of the backing chain. Add a function that will handle it and call it from qemuDomainPrepareDiskSource and qemuDomainDetermineDiskChain
Signed-off-by: Peter Krempa <pkre...@redhat.com> --- src/qemu/qemu_domain.c | 48 ++++++++++++++++++++++++++++++++++++++++++------ src/qemu/qemu_domain.h | 6 ++++++ 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 580e0f830d..009fb9daf3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7399,6 +7399,7 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, { virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virStorageSourcePtr src = disk->src; + qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; uid_t uid; gid_t gid; @@ -7467,6 +7468,10 @@ qemuDomainDetermineDiskChain(virQEMUDriverPtr driver, report_broken) < 0) goto cleanup; + /* fill in data for the rest of the chain */ + if (qemuDomainPrepareDiskSourceChain(disk, src, cfg, priv->qemuCaps) < 0) + goto cleanup; + ret = 0; cleanup: @@ -11803,6 +11808,41 @@ qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver, } +/** + * qemuDomainPrepareDiskSourceChain: + * + * @disk: Disk config object + * @src: source to start from + * @cfg: qemu driver config object + * + * Prepares various aspects of the disk source and it's backing chain. This + * function should be also called for detected backing chains. If @src is NULL + * the root source is used. + */ +int +qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk, + virStorageSourcePtr src, + virQEMUDriverConfigPtr cfg, + virQEMUCapsPtr qemuCaps) +{ + virStorageSourcePtr n; + + if (!src) + src = disk->src; + + for (n = src; virStorageSourceIsBacking(n); n = n->backingStore) { + if (n->type == VIR_STORAGE_TYPE_NETWORK && + n->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { + n->debug = true; + n->debugLevel = cfg->glusterDebugLevel; + } + } + + return 0; +} + + int qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, qemuDomainObjPrivatePtr priv, @@ -11814,12 +11854,8 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, if (qemuDomainSecretDiskPrepare(priv, disk) < 0) return -1; - if (disk->src->type == VIR_STORAGE_TYPE_NETWORK && - disk->src->protocol == VIR_STORAGE_NET_PROTOCOL_GLUSTER && - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_GLUSTER_DEBUG_LEVEL)) { - disk->src->debug = true; - disk->src->debugLevel = cfg->glusterDebugLevel; - } + if (qemuDomainPrepareDiskSourceChain(disk, NULL, cfg, priv->qemuCaps) < 0) + return -1; return 0; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 63d9fb6d21..21e12f6594 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -991,6 +991,12 @@ int qemuDomainCheckMigrationCapabilities(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob); +int +qemuDomainPrepareDiskSourceChain(virDomainDiskDefPtr disk, + virStorageSourcePtr src, + virQEMUDriverConfigPtr cfg, + virQEMUCapsPtr qemuCaps) + ATTRIBUTE_RETURN_CHECK; int qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, -- 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list