qemu: Simplify calls to qemuDomainSetPrivatePaths

Since commit 9dca74ee6f, the function can take driver and a vm, no
need to overcomplicate.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
Martin Kletzander 2016-04-03 21:59:46 +02:00
parent dfbc9a8382
commit 1893b6df11
3 changed files with 22 additions and 24 deletions

View File

@ -536,23 +536,29 @@ qemuDomainSetPrivatePathsOld(virQEMUDriverPtr driver,
* can change it later on whenever we feel like so.
*/
int
qemuDomainSetPrivatePaths(char **domainLibDir, char **domainChannelTargetDir,
const char *confLibDir, const char *confChannelDir,
const char *domainName, int domainId)
qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
const int dommaxlen = 20;
int ret = -1;
if (!*domainLibDir &&
virAsprintf(domainLibDir, "%s/domain-%d-%.*s",
confLibDir, domainId, dommaxlen, domainName) < 0)
return -1;
if (!priv->libDir &&
virAsprintf(&priv->libDir, "%s/domain-%d-%.*s",
cfg->libDir, vm->def->id, dommaxlen, vm->def->name) < 0)
goto cleanup;
if (!*domainChannelTargetDir &&
virAsprintf(domainChannelTargetDir, "%s/domain-%d-%.*s",
confChannelDir, domainId, dommaxlen, domainName) < 0)
return -1;
if (!priv->channelTargetDir &&
virAsprintf(&priv->channelTargetDir, "%s/domain-%d-%.*s",
cfg->channelTargetDir, vm->def->id,
dommaxlen, vm->def->name) < 0)
goto cleanup;
return 0;
ret = 0;
cleanup:
virObjectUnref(cfg);
return ret;
}

View File

@ -551,12 +551,9 @@ bool qemuDomainSupportsNetdev(virDomainDefPtr def,
int qemuDomainNetVLAN(virDomainNetDefPtr def);
int qemuDomainSetPrivatePaths(char **domainLibDir,
char **domainChannelTargetDir,
const char *confLibDir,
const char *confChannelDir,
const char *domainName,
int domainId);
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
virDomainObjPtr vm);
virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);

View File

@ -4610,12 +4610,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
goto stop;
}
if (qemuDomainSetPrivatePaths(&priv->libDir,
&priv->channelTargetDir,
cfg->libDir,
cfg->channelTargetDir,
vm->def->name,
vm->def->id) < 0)
if (qemuDomainSetPrivatePaths(driver, vm) < 0)
goto cleanup;
ret = 0;