Call the post-processing function so that we can validate that it does
the correct thing.
virDomainBackupAlignDisks requires disk definitions to be present so
let's fake them by copying disks from the backup definition and add one
extra disk 'vdextradisk'.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
.../backup-pull-encrypted.xml | 1 +
.../backup-pull-internal-invalid.xml | 1 +
.../backup-pull-seclabel.xml | 1 +
tests/domainbackupxml2xmlout/backup-pull.xml | 1 +
.../backup-push-encrypted.xml | 1 +
.../backup-push-seclabel.xml | 1 +
tests/domainbackupxml2xmlout/backup-push.xml | 1 +
tests/domainbackupxml2xmlout/empty.xml | 8 ++++-
tests/genericxml2xmltest.c | 36 +++++++++++++++++++
9 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/tests/domainbackupxml2xmlout/backup-pull-encrypted.xml
b/tests/domainbackupxml2xmlout/backup-pull-encrypted.xml
index ea9dcf72b9..3c3042111d 100644
--- a/tests/domainbackupxml2xmlout/backup-pull-encrypted.xml
+++ b/tests/domainbackupxml2xmlout/backup-pull-encrypted.xml
@@ -26,5 +26,6 @@
</encryption>
</scratch>
</disk>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/backup-pull-internal-invalid.xml
b/tests/domainbackupxml2xmlout/backup-pull-internal-invalid.xml
index ba8f7ca3ab..9702978ce0 100644
--- a/tests/domainbackupxml2xmlout/backup-pull-internal-invalid.xml
+++ b/tests/domainbackupxml2xmlout/backup-pull-internal-invalid.xml
@@ -26,6 +26,7 @@
</encryption>
</scratch>
</disk>
+ <disk name='vdextradisk' backup='no'/>
</disks>
<privateData>
<objects>
diff --git a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
index 450f007d3a..38330394f7 100644
--- a/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
+++ b/tests/domainbackupxml2xmlout/backup-pull-seclabel.xml
@@ -14,5 +14,6 @@
<seclabel model='dac' relabel='no'/>
</scratch>
</disk>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/backup-pull.xml
b/tests/domainbackupxml2xmlout/backup-pull.xml
index 24fce9c0e7..4952270a5a 100644
--- a/tests/domainbackupxml2xmlout/backup-pull.xml
+++ b/tests/domainbackupxml2xmlout/backup-pull.xml
@@ -6,5 +6,6 @@
<scratch file='/path/to/file'/>
</disk>
<disk name='hda' backup='no'/>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/backup-push-encrypted.xml
b/tests/domainbackupxml2xmlout/backup-push-encrypted.xml
index a955340964..2a5aad93cd 100644
--- a/tests/domainbackupxml2xmlout/backup-push-encrypted.xml
+++ b/tests/domainbackupxml2xmlout/backup-push-encrypted.xml
@@ -25,5 +25,6 @@
</encryption>
</target>
</disk>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/backup-push-seclabel.xml
b/tests/domainbackupxml2xmlout/backup-push-seclabel.xml
index 9986889ba3..59af3e6a6c 100644
--- a/tests/domainbackupxml2xmlout/backup-push-seclabel.xml
+++ b/tests/domainbackupxml2xmlout/backup-push-seclabel.xml
@@ -13,5 +13,6 @@
<seclabel model='dac' relabel='no'/>
</target>
</disk>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/backup-push.xml
b/tests/domainbackupxml2xmlout/backup-push.xml
index 1997c814ae..bc11a93d94 100644
--- a/tests/domainbackupxml2xmlout/backup-push.xml
+++ b/tests/domainbackupxml2xmlout/backup-push.xml
@@ -6,5 +6,6 @@
<target file='/path/to/file'/>
</disk>
<disk name='hda' backup='no'/>
+ <disk name='vdextradisk' backup='no'/>
</disks>
</domainbackup>
diff --git a/tests/domainbackupxml2xmlout/empty.xml
b/tests/domainbackupxml2xmlout/empty.xml
index b1ba4953be..52d2b4f0af 100644
--- a/tests/domainbackupxml2xmlout/empty.xml
+++ b/tests/domainbackupxml2xmlout/empty.xml
@@ -1 +1,7 @@
-<domainbackup mode='push'/>
+<domainbackup mode='push'>
+ <disks>
+ <disk name='vdextradisk' backup='yes' type='file'>
+ <target file='/fake/vdextradisk.qcow2.SUFFIX'/>
+ </disk>
+ </disks>
+</domainbackup>
diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c
index 2c1e8616dd..8b9b0bafb6 100644
--- a/tests/genericxml2xmltest.c
+++ b/tests/genericxml2xmltest.c
@@ -51,6 +51,23 @@ struct testCompareBackupXMLData {
};
+static virDomainDiskDefPtr
+testCompareBackupXMLGetFakeDomdisk(const char *dst)
+{
+ virDomainDiskDefPtr domdisk = NULL;
+
+ if (!(domdisk = virDomainDiskDefNew(NULL)))
+ abort();
+
+ domdisk->dst = g_strdup(dst);
+ domdisk->src->type = VIR_STORAGE_TYPE_FILE;
+ domdisk->src->format = VIR_STORAGE_FILE_QCOW2;
+ domdisk->src->path = g_strdup_printf("/fake/%s.qcow2", dst);
+
+ return domdisk;
+}
+
+
static int
testCompareBackupXML(const void *opaque)
{
@@ -63,6 +80,8 @@ testCompareBackupXML(const void *opaque)
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
g_autofree char *actual = NULL;
unsigned int parseFlags = 0;
+ g_autoptr(virDomainDef) fakedef = NULL;
+ size_t i;
if (data->internal)
parseFlags |= VIR_DOMAIN_BACKUP_PARSE_INTERNAL;
@@ -80,6 +99,23 @@ testCompareBackupXML(const void *opaque)
return -1;
}
+ /* create a fake definition and fill it with disks */
+ if (!(fakedef = virDomainDefNew()))
+ return -1;
+
+ fakedef->ndisks = backup->ndisks + 1;
+ fakedef->disks = g_new0(virDomainDiskDefPtr, fakedef->ndisks);
+
+ for (i = 0; i < backup->ndisks; i++)
+ fakedef->disks[i] =
testCompareBackupXMLGetFakeDomdisk(backup->disks[i].name);
+
+ fakedef->disks[fakedef->ndisks -1 ] =
testCompareBackupXMLGetFakeDomdisk("vdextradisk");
+
+ if (virDomainBackupAlignDisks(backup, fakedef, "SUFFIX") < 0) {
+ VIR_TEST_VERBOSE("failed to align backup def '%s'", file_in);
+ return -1;
+ }
+
if (virDomainBackupDefFormat(&buf, backup, data->internal) < 0) {
VIR_TEST_VERBOSE("failed to format backup def '%s'", file_in);
return -1;
--
2.26.2