qemuxml2argvtest: use driver.config and priv for qemuDomainSetPrivatePaths

Update testutilsqemu to overwrite libDir and channelTargetDir and set
private paths using domain's privateData.  This changes is required for
following patch.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-03-15 13:54:24 +01:00
parent 12de369aa6
commit 9dca74ee6f
3 changed files with 15 additions and 12 deletions

View File

@ -33,7 +33,7 @@
<target type='virtio' name='ble'/> <target type='virtio' name='ble'/>
</channel> </channel>
<channel type='unix'> <channel type='unix'>
<source path='/tmp/domain-oldname/fdsa'/> <source path='/tmp/channel/domain-oldname/fdsa'/>
<target type='virtio' name='fdsa'/> <target type='virtio' name='fdsa'/>
</channel> </channel>
<memballoon model='none'/> <memballoon model='none'/>

View File

@ -265,8 +265,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
virCommandPtr cmd = NULL; virCommandPtr cmd = NULL;
size_t i; size_t i;
virBitmapPtr nodeset = NULL; virBitmapPtr nodeset = NULL;
char *domainLibDir = NULL; qemuDomainObjPrivatePtr priv = NULL;
char *domainChannelTargetDir = NULL;
if (!(conn = virGetConnect())) if (!(conn = virGetConnect()))
goto out; goto out;
@ -286,6 +285,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
goto ok; goto ok;
goto out; goto out;
} }
priv = vm->privateData;
if (!virDomainDefCheckABIStability(vm->def, vm->def)) { if (!virDomainDefCheckABIStability(vm->def, vm->def)) {
VIR_TEST_DEBUG("ABI stability check failed on %s", xml); VIR_TEST_DEBUG("ABI stability check failed on %s", xml);
@ -294,13 +294,14 @@ static int testCompareXMLToArgvFiles(const char *xml,
vm->def->id = -1; vm->def->id = -1;
if (qemuDomainSetPrivatePaths(&domainLibDir, &domainChannelTargetDir, if (qemuDomainSetPrivatePaths(&priv->libDir, &priv->channelTargetDir,
"/tmp/lib", "/tmp/channel", driver.config->libDir,
driver.config->channelTargetDir,
vm->def->name, vm->def->id) < 0) vm->def->name, vm->def->id) < 0)
goto out; goto out;
memset(&monitor_chr, 0, sizeof(monitor_chr)); memset(&monitor_chr, 0, sizeof(monitor_chr));
if (qemuProcessPrepareMonitorChr(&monitor_chr, domainLibDir) < 0) if (qemuProcessPrepareMonitorChr(&monitor_chr, priv->libDir) < 0)
goto out; goto out;
virQEMUCapsSetList(extraFlags, virQEMUCapsSetList(extraFlags,
@ -366,7 +367,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
&testCallbacks, false, &testCallbacks, false,
(flags & FLAG_FIPS), (flags & FLAG_FIPS),
nodeset, NULL, NULL, nodeset, NULL, NULL,
domainLibDir, domainChannelTargetDir))) { priv->libDir, priv->channelTargetDir))) {
if (flags & FLAG_EXPECT_FAILURE) if (flags & FLAG_EXPECT_FAILURE)
goto ok; goto ok;
goto out; goto out;
@ -407,8 +408,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
virObjectUnref(vm); virObjectUnref(vm);
virObjectUnref(conn); virObjectUnref(conn);
virBitmapFree(nodeset); virBitmapFree(nodeset);
VIR_FREE(domainLibDir);
VIR_FREE(domainChannelTargetDir);
return ret; return ret;
} }
@ -545,9 +544,6 @@ mymain(void)
driver.config->spiceTLS = 1; driver.config->spiceTLS = 1;
if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0) if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
VIR_FREE(driver.config->channelTargetDir);
if (VIR_STRDUP_QUIET(driver.config->channelTargetDir, "/tmp") < 0)
return EXIT_FAILURE;
# define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \ # define DO_TEST_FULL(name, migrateFrom, migrateFd, flags, \
parseFlags, ...) \ parseFlags, ...) \

View File

@ -564,6 +564,13 @@ int qemuTestDriverInit(virQEMUDriver *driver)
if (!driver->config) if (!driver->config)
goto error; goto error;
/* Overwrite some default paths so it's consistent for tests. */
VIR_FREE(driver->config->libDir);
VIR_FREE(driver->config->channelTargetDir);
if (VIR_STRDUP(driver->config->libDir, "/tmp/lib") < 0 ||
VIR_STRDUP(driver->config->channelTargetDir, "/tmp/channel") < 0)
goto error;
driver->caps = testQemuCapsInit(); driver->caps = testQemuCapsInit();
if (!driver->caps) if (!driver->caps)
goto error; goto error;