- propogate data-file to cmdline - determine data-file within disk chain - enable live disk insertion Signed-off-by: Nikolai Barybin <nikolai.barybin@xxxxxxxxxxxxx> --- src/qemu/qemu_block.c | 14 ++++++++++++++ src/qemu/qemu_command.c | 5 +++++ src/qemu/qemu_domain.c | 14 +++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 3c1305ec84..1915d5f5fd 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1302,6 +1302,13 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageSource *src, NULL) < 0) return -1; + if (src->dataFileStore) { + if (virJSONValueObjectAdd(&props, + "s:data-file", qemuBlockStorageSourceGetEffectiveNodename(src->dataFileStore), + NULL) < 0) + return -1; + } + return 0; } @@ -1859,6 +1866,13 @@ qemuBlockStorageSourceChainDetachPrepareBlockdev(virStorageSource *src) return NULL; VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); + + if (n->dataFileStore) { + if (!(backend = qemuBlockStorageSourceDetachPrepare(n->dataFileStore))) + return NULL; + + VIR_APPEND_ELEMENT(data->srcdata, data->nsrcdata, backend); + } } return g_steal_pointer(&data); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f4430275dc..cdc80cee73 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -11018,6 +11018,11 @@ qemuBuildStorageSourceChainAttachPrepareBlockdev(virStorageSource *top) if (qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n, n->backingStore) < 0) return NULL; + + if (n->dataFileStore && + qemuBuildStorageSourceChainAttachPrepareBlockdevOne(data, n->dataFileStore, + n->dataFileStore->backingStore) < 0) + return NULL; } return g_steal_pointer(&data); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 393c7dcac1..d0700db3be 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6242,9 +6242,17 @@ qemuDomainDetermineDiskChain(virQEMUDriver *driver, true) < 0) return -1; + if (src->dataFileStore && + qemuDomainPrepareStorageSource(src->dataFileStore, vm, disk, cfg) < 0) + return -1; + for (n = src->backingStore; virStorageSourceIsBacking(n); n = n->backingStore) { if (qemuDomainPrepareStorageSource(n, vm, disk, cfg) < 0) return -1; + + if (n->dataFileStore && + qemuDomainPrepareStorageSource(n->dataFileStore, vm, disk, cfg) < 0) + return -1; } if (qemuDomainStorageSourceValidateDepth(disksrc, 0, disk->dst) < 0) @@ -9438,7 +9446,7 @@ qemuDomainPrepareDiskSourceData(virDomainDiskDef *disk, return; /* transfer properties valid only for the top level image */ - if (src == disk->src) + if (src == disk->src || src == disk->src->dataFileStore) src->detect_zeroes = disk->detect_zeroes; /* transfer properties valid for the full chain */ @@ -9667,6 +9675,10 @@ qemuDomainPrepareDiskSourceBlockdev(virDomainDiskDef *disk, for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) { if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0) return -1; + + if (n->dataFileStore && + qemuDomainPrepareStorageSourceBlockdev(disk, n->dataFileStore, priv, cfg) < 0) + return -1; } return 0; -- 2.43.5