On Sat, Sep 07, 2024 at 17:15:35 +0300, Nikolai Barybin via Devel wrote:
- propogate data-file to cmdline
- determine data-file within disk chain
- enable live disk insertion
Signed-off-by: Nikolai Barybin <nikolai.barybin(a)virtuozzo.com>
---
src/qemu/qemu_block.c | 7 +++++++
src/qemu/qemu_command.c | 5 +++++
src/qemu/qemu_domain.c | 14 +++++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 6e90bae9f2..5d2a638a56 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -1301,6 +1301,13 @@ qemuBlockStorageSourceGetFormatQcow2Props(virStorageSource *src,
NULL) < 0)
return -1;
+ if (src->dataFileStore) {
+ if (virJSONValueObjectAdd(&props,
+ "s:data-file",
src->dataFileStore->nodenameformat,
You must not use the nodename* fields directly. In fact this doesn't
even work as raw files don't even have a 'format' node name any more.
This needs to be qemuBlockStorageSourceGetEffectiveNodename(src->dataFileStore)
+ NULL) < 0)
+ return -1;
+ }
+
return 0;
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1b992d8eed..503374f470 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -11178,6 +11178,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;
}
Missing corresponding changes to
qemuBlockStorageSourceChainDetachPrepareBlockdev(), thus when
hot-unplugging a disk the data file will not be unplugged.
return g_steal_pointer(&data);
Possibly as a separata patch you'll also need to forbid image creation
with data file, e.g. when creating snapshots.
'qemuBlockStorageSourceCreate' is the function to consider.