mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +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.
|
* can change it later on whenever we feel like so.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuDomainSetPrivatePaths(char **domainLibDir, char **domainChannelTargetDir,
|
qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
|
||||||
const char *confLibDir, const char *confChannelDir,
|
virDomainObjPtr vm)
|
||||||
const char *domainName, int domainId)
|
|
||||||
{
|
{
|
||||||
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
const int dommaxlen = 20;
|
const int dommaxlen = 20;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
if (!*domainLibDir &&
|
if (!priv->libDir &&
|
||||||
virAsprintf(domainLibDir, "%s/domain-%d-%.*s",
|
virAsprintf(&priv->libDir, "%s/domain-%d-%.*s",
|
||||||
confLibDir, domainId, dommaxlen, domainName) < 0)
|
cfg->libDir, vm->def->id, dommaxlen, vm->def->name) < 0)
|
||||||
return -1;
|
goto cleanup;
|
||||||
|
|
||||||
if (!*domainChannelTargetDir &&
|
if (!priv->channelTargetDir &&
|
||||||
virAsprintf(domainChannelTargetDir, "%s/domain-%d-%.*s",
|
virAsprintf(&priv->channelTargetDir, "%s/domain-%d-%.*s",
|
||||||
confChannelDir, domainId, dommaxlen, domainName) < 0)
|
cfg->channelTargetDir, vm->def->id,
|
||||||
return -1;
|
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 qemuDomainNetVLAN(virDomainNetDefPtr def);
|
||||||
|
|
||||||
int qemuDomainSetPrivatePaths(char **domainLibDir,
|
int qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
|
||||||
char **domainChannelTargetDir,
|
virDomainObjPtr vm);
|
||||||
const char *confLibDir,
|
|
||||||
const char *confChannelDir,
|
|
||||||
const char *domainName,
|
|
||||||
int domainId);
|
|
||||||
|
|
||||||
virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);
|
virDomainDiskDefPtr qemuDomainDiskByName(virDomainDefPtr def, const char *name);
|
||||||
|
|
||||||
|
@ -4610,12 +4610,7 @@ qemuProcessInit(virQEMUDriverPtr driver,
|
|||||||
goto stop;
|
goto stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainSetPrivatePaths(&priv->libDir,
|
if (qemuDomainSetPrivatePaths(driver, vm) < 0)
|
||||||
&priv->channelTargetDir,
|
|
||||||
cfg->libDir,
|
|
||||||
cfg->channelTargetDir,
|
|
||||||
vm->def->name,
|
|
||||||
vm->def->id) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user