mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
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:
parent
dfbc9a8382
commit
1893b6df11
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user