[PATCH v3 1/5] qemu: add disk post parse to qemublocktest

Or Ozeri posted 5 patches 4 years, 4 months ago
There is a newer version of this series
[PATCH v3 1/5] qemu: add disk post parse to qemublocktest
Posted by Or Ozeri 4 years, 4 months ago
The post parse callback is part of the real (non-test) processing flow.
This commit adds it (for disks) to the qemublocktest flow as well.
Specifically, this will be needed for tests that use luks encryption,
so that the default encryption engine (which is added in an upcoming commit)
will be overridden by qemu.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
---
 src/qemu/qemu_domain.c | 2 +-
 src/qemu/qemu_domain.h | 3 +++
 tests/qemublocktest.c  | 3 +++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a755f8678e..288a40bca6 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5259,7 +5259,7 @@ qemuDomainDeviceDiskDefPostParseRestoreSecAlias(virDomainDiskDef *disk,
 }
 
 
-static int
+int
 qemuDomainDeviceDiskDefPostParse(virDomainDiskDef *disk,
                                  unsigned int parseFlags)
 {
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 64f92988b7..0642e44fbc 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -872,6 +872,9 @@ int qemuDomainSecretPrepare(virQEMUDriver *driver,
 int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
                                     virQEMUCaps *qemuCaps);
 
+int qemuDomainDeviceDiskDefPostParse(virDomainDiskDef *disk,
+                                     unsigned int parseFlags);
+
 int qemuDomainPrepareChannel(virDomainChrDef *chr,
                              const char *domainChannelTargetDir)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 3e61e923a9..0e4bb146c9 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -276,6 +276,9 @@ testQemuDiskXMLToProps(const void *opaque)
                                        VIR_DOMAIN_DEF_PARSE_STATUS)))
         return -1;
 
+    if (qemuDomainDeviceDiskDefPostParse(disk, 0) < 0)
+        return -1;
+
     if (!(vmdef = virDomainDefNew(data->driver->xmlopt)))
         return -1;
 
-- 
2.25.1

Re: [PATCH v3 1/5] qemu: add disk post parse to qemublocktest
Posted by Peter Krempa 4 years, 4 months ago
On Wed, Oct 06, 2021 at 05:18:42 -0500, Or Ozeri wrote:
> The post parse callback is part of the real (non-test) processing flow.
> This commit adds it (for disks) to the qemublocktest flow as well.
> Specifically, this will be needed for tests that use luks encryption,
> so that the default encryption engine (which is added in an upcoming commit)
> will be overridden by qemu.
> 
> Signed-off-by: Or Ozeri <oro@il.ibm.com>
> ---
>  src/qemu/qemu_domain.c | 2 +-
>  src/qemu/qemu_domain.h | 3 +++
>  tests/qemublocktest.c  | 3 +++
>  3 files changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>