|
|
735c6b |
From 659a0e3cda2f5561abe45ccc10afc41014d1a331 Mon Sep 17 00:00:00 2001
|
|
|
735c6b |
Message-Id: <659a0e3cda2f5561abe45ccc10afc41014d1a331@dist-git>
|
|
|
735c6b |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
735c6b |
Date: Tue, 31 Jan 2023 14:37:40 +0100
|
|
|
735c6b |
Subject: [PATCH] qemu: command: Handle FD passing commandline via
|
|
|
735c6b |
qemuBuildBlockStorageSourceAttachDataCommandline
|
|
|
735c6b |
|
|
|
735c6b |
Copy the pointer to qemuFDPass into struct qemuBlockStorageSourceAttachData
|
|
|
735c6b |
so that it can be used from qemuBuildBlockStorageSourceAttachDataCommandline
|
|
|
735c6b |
rather than looping again in qemuBuildDiskSourceCommandLineFDs.
|
|
|
735c6b |
|
|
|
735c6b |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
735c6b |
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
735c6b |
(cherry picked from commit 65f14232fb031b57fad085a2e8792da87c97173f)
|
|
|
735c6b |
|
|
|
735c6b |
https://bugzilla.redhat.com/show_bug.cgi?id=2040272
|
|
|
735c6b |
---
|
|
|
735c6b |
src/qemu/qemu_block.h | 2 ++
|
|
|
735c6b |
src/qemu/qemu_command.c | 26 +++----------------
|
|
|
735c6b |
.../disk-source-fd.x86_64-latest.args | 6 ++---
|
|
|
735c6b |
3 files changed, 9 insertions(+), 25 deletions(-)
|
|
|
735c6b |
|
|
|
735c6b |
diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h
|
|
|
735c6b |
index eac986e0f0..5a61a19da2 100644
|
|
|
735c6b |
--- a/src/qemu/qemu_block.h
|
|
|
735c6b |
+++ b/src/qemu/qemu_block.h
|
|
|
735c6b |
@@ -99,6 +99,8 @@ struct qemuBlockStorageSourceAttachData {
|
|
|
735c6b |
char *tlsAlias;
|
|
|
735c6b |
virJSONValue *tlsKeySecretProps;
|
|
|
735c6b |
char *tlsKeySecretAlias;
|
|
|
735c6b |
+
|
|
|
735c6b |
+ qemuFDPass *fdpass;
|
|
|
735c6b |
};
|
|
|
735c6b |
|
|
|
735c6b |
|
|
|
735c6b |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
735c6b |
index b96f2d33c1..5edad046d5 100644
|
|
|
735c6b |
--- a/src/qemu/qemu_command.c
|
|
|
735c6b |
+++ b/src/qemu/qemu_command.c
|
|
|
735c6b |
@@ -2119,6 +2119,8 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
|
|
|
735c6b |
return -1;
|
|
|
735c6b |
}
|
|
|
735c6b |
|
|
|
735c6b |
+ qemuFDPassTransferCommand(data->fdpass, cmd);
|
|
|
735c6b |
+
|
|
|
735c6b |
if (data->storageProps) {
|
|
|
735c6b |
if (!(tmp = virJSONValueToString(data->storageProps, false)))
|
|
|
735c6b |
return -1;
|
|
|
735c6b |
@@ -2147,25 +2149,6 @@ qemuBuildBlockStorageSourceAttachDataCommandline(virCommand *cmd,
|
|
|
735c6b |
}
|
|
|
735c6b |
|
|
|
735c6b |
|
|
|
735c6b |
-static int
|
|
|
735c6b |
-qemuBuildDiskSourceCommandLineFDs(virCommand *cmd,
|
|
|
735c6b |
- virDomainDiskDef *disk)
|
|
|
735c6b |
-{
|
|
|
735c6b |
- virStorageSource *n;
|
|
|
735c6b |
-
|
|
|
735c6b |
- for (n = disk->src; virStorageSourceIsBacking(n); n = n->backingStore) {
|
|
|
735c6b |
- qemuDomainStorageSourcePrivate *srcpriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(n);
|
|
|
735c6b |
-
|
|
|
735c6b |
- if (!srcpriv || !srcpriv->fdpass)
|
|
|
735c6b |
- continue;
|
|
|
735c6b |
-
|
|
|
735c6b |
- qemuFDPassTransferCommand(srcpriv->fdpass, cmd);
|
|
|
735c6b |
- }
|
|
|
735c6b |
-
|
|
|
735c6b |
- return 0;
|
|
|
735c6b |
-}
|
|
|
735c6b |
-
|
|
|
735c6b |
-
|
|
|
735c6b |
static int
|
|
|
735c6b |
qemuBuildDiskSourceCommandLine(virCommand *cmd,
|
|
|
735c6b |
virDomainDiskDef *disk,
|
|
|
735c6b |
@@ -2183,9 +2166,6 @@ qemuBuildDiskSourceCommandLine(virCommand *cmd,
|
|
|
735c6b |
if (virStorageSourceIsEmpty(disk->src))
|
|
|
735c6b |
return 0;
|
|
|
735c6b |
|
|
|
735c6b |
- if (qemuBuildDiskSourceCommandLineFDs(cmd, disk) < 0)
|
|
|
735c6b |
- return -1;
|
|
|
735c6b |
-
|
|
|
735c6b |
if (!(data = qemuBuildStorageSourceChainAttachPrepareBlockdev(disk->src)))
|
|
|
735c6b |
return -1;
|
|
|
735c6b |
|
|
|
735c6b |
@@ -10537,6 +10517,8 @@ qemuBuildStorageSourceAttachPrepareCommon(virStorageSource *src,
|
|
|
735c6b |
|
|
|
735c6b |
tlsKeySecretAlias = srcpriv->tlsKeySecret->alias;
|
|
|
735c6b |
}
|
|
|
735c6b |
+
|
|
|
735c6b |
+ data->fdpass = srcpriv->fdpass;
|
|
|
735c6b |
}
|
|
|
735c6b |
|
|
|
735c6b |
if (src->haveTLS == VIR_TRISTATE_BOOL_YES &&
|
|
|
735c6b |
diff --git a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
|
|
735c6b |
index b4a81acfc7..a7ddd65000 100644
|
|
|
735c6b |
--- a/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
|
|
735c6b |
+++ b/tests/qemuxml2argvdata/disk-source-fd.x86_64-latest.args
|
|
|
735c6b |
@@ -33,13 +33,13 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
|
|
735c6b |
-blockdev '{"driver":"file","filename":"/dev/fdset/2","node-name":"libvirt-4-storage","auto-read-only":true,"discard":"unmap"}' \
|
|
|
735c6b |
-blockdev '{"node-name":"libvirt-4-format","read-only":false,"driver":"qcow2","file":"libvirt-4-storage"}' \
|
|
|
735c6b |
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x2","drive":"libvirt-4-format","id":"virtio-disk4","bootindex":1}' \
|
|
|
735c6b |
--add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
|
|
|
735c6b |
--add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
|
|
|
735c6b |
--add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
|
|
|
735c6b |
-blockdev '{"driver":"file","filename":"/var/lib/libvirt/images/rhel7.1484071876","node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}' \
|
|
|
735c6b |
-blockdev '{"node-name":"libvirt-3-format","read-only":true,"driver":"qcow2","file":"libvirt-3-storage","backing":null}' \
|
|
|
735c6b |
+-add-fd set=1,fd=777,opaque=libvirt-2-storage0 \
|
|
|
735c6b |
+-add-fd set=1,fd=778,opaque=libvirt-2-storage1 \
|
|
|
735c6b |
-blockdev '{"driver":"file","filename":"/dev/fdset/1","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}' \
|
|
|
735c6b |
-blockdev '{"node-name":"libvirt-2-format","read-only":true,"driver":"qcow2","file":"libvirt-2-storage","backing":"libvirt-3-format"}' \
|
|
|
735c6b |
+-add-fd set=0,fd=704,opaque=libvirt-1-storage0 \
|
|
|
735c6b |
-blockdev '{"driver":"file","filename":"/dev/fdset/0","node-name":"libvirt-1-storage","read-only":false,"discard":"unmap"}' \
|
|
|
735c6b |
-blockdev '{"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":"libvirt-2-format"}' \
|
|
|
735c6b |
-device '{"driver":"virtio-blk-pci","bus":"pci.0","addr":"0x3","drive":"libvirt-1-format","id":"virtio-disk5"}' \
|
|
|
735c6b |
--
|
|
|
735c6b |
2.39.1
|
|
|
735c6b |
|