mirror of https://gitee.com/openkylin/libvirt.git
qemu: add disk post parse to qemublocktest
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> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
9ff311f105
commit
9696427ad6
|
@ -5218,7 +5218,7 @@ qemuDomainDeviceDiskDefPostParseRestoreSecAlias(virDomainDiskDef *disk,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
int
|
||||||
qemuDomainDeviceDiskDefPostParse(virDomainDiskDef *disk,
|
qemuDomainDeviceDiskDefPostParse(virDomainDiskDef *disk,
|
||||||
unsigned int parseFlags)
|
unsigned int parseFlags)
|
||||||
{
|
{
|
||||||
|
|
|
@ -857,6 +857,9 @@ int qemuDomainSecretPrepare(virQEMUDriver *driver,
|
||||||
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
|
int qemuDomainDeviceDefValidateDisk(const virDomainDiskDef *disk,
|
||||||
virQEMUCaps *qemuCaps);
|
virQEMUCaps *qemuCaps);
|
||||||
|
|
||||||
|
int qemuDomainDeviceDiskDefPostParse(virDomainDiskDef *disk,
|
||||||
|
unsigned int parseFlags);
|
||||||
|
|
||||||
int qemuDomainPrepareChannel(virDomainChrDef *chr,
|
int qemuDomainPrepareChannel(virDomainChrDef *chr,
|
||||||
const char *domainChannelTargetDir)
|
const char *domainChannelTargetDir)
|
||||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||||
|
|
|
@ -276,6 +276,9 @@ testQemuDiskXMLToProps(const void *opaque)
|
||||||
VIR_DOMAIN_DEF_PARSE_STATUS)))
|
VIR_DOMAIN_DEF_PARSE_STATUS)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if (qemuDomainDeviceDiskDefPostParse(disk, 0) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (!(vmdef = virDomainDefNew(data->driver->xmlopt)))
|
if (!(vmdef = virDomainDefNew(data->driver->xmlopt)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -470,32 +473,24 @@ testQemuImageCreateLoadDiskXML(const char *name,
|
||||||
virDomainXMLOption *xmlopt)
|
virDomainXMLOption *xmlopt)
|
||||||
|
|
||||||
{
|
{
|
||||||
virDomainSnapshotDiskDef *diskdef = NULL;
|
virDomainDiskDef *disk = NULL;
|
||||||
g_autoptr(xmlDoc) doc = NULL;
|
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
|
||||||
xmlNodePtr node;
|
|
||||||
g_autofree char *xmlpath = NULL;
|
g_autofree char *xmlpath = NULL;
|
||||||
virStorageSource *ret = NULL;
|
g_autofree char *xmlstr = NULL;
|
||||||
|
|
||||||
xmlpath = g_strdup_printf("%s%s.xml", testQemuImageCreatePath, name);
|
xmlpath = g_strdup_printf("%s%s.xml", testQemuImageCreatePath, name);
|
||||||
|
|
||||||
if (!(doc = virXMLParseFileCtxt(xmlpath, &ctxt)))
|
if (virTestLoadFile(xmlpath, &xmlstr) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(node = virXPathNode("//disk", ctxt))) {
|
/* qemu stores node names in the status XML portion */
|
||||||
VIR_TEST_VERBOSE("failed to find <source> element\n");
|
if (!(disk = virDomainDiskDefParse(xmlstr, xmlopt,
|
||||||
|
VIR_DOMAIN_DEF_PARSE_STATUS)))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
diskdef = g_new0(virDomainSnapshotDiskDef, 1);
|
if (qemuDomainDeviceDiskDefPostParse(disk, 0) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (virDomainSnapshotDiskDefParseXML(node, ctxt, diskdef,
|
return disk->src;
|
||||||
VIR_DOMAIN_DEF_PARSE_STATUS,
|
|
||||||
xmlopt) == 0)
|
|
||||||
ret = g_steal_pointer(&diskdef->src);
|
|
||||||
|
|
||||||
virDomainSnapshotDiskDefFree(diskdef);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue