mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 14:15:28 +00:00
virDomainObjGetShortName: take virDomainDef
So far this function takes virDomainObjPtr which: 1) is an overkill, 2) might be not available in all the places we will use it. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
dc18766b10
commit
7ed6934f3b
@ -25701,13 +25701,13 @@ virDomainDefHasMemballoon(const virDomainDef *def)
|
||||
* Shorten domain name to avoid possible path length limitations.
|
||||
*/
|
||||
char *
|
||||
virDomainObjGetShortName(virDomainObjPtr vm)
|
||||
virDomainObjGetShortName(const virDomainDef *def)
|
||||
{
|
||||
const int dommaxlen = 20;
|
||||
char *ret = NULL;
|
||||
|
||||
ignore_value(virAsprintf(&ret, "%d-%.*s",
|
||||
vm->def->id, dommaxlen, vm->def->name));
|
||||
def->id, dommaxlen, def->name));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -3205,7 +3205,7 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
|
||||
|
||||
bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
char *virDomainObjGetShortName(virDomainObjPtr vm);
|
||||
char *virDomainObjGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int
|
||||
virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,
|
||||
|
@ -1475,7 +1475,7 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
|
||||
{
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
char *domname = virDomainObjGetShortName(vm);
|
||||
char *domname = virDomainObjGetShortName(vm->def);
|
||||
int ret = -1;
|
||||
|
||||
if (!domname)
|
||||
|
@ -3885,7 +3885,7 @@ getAutoDumpPath(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
char *dumpfile = NULL;
|
||||
char *domname = virDomainObjGetShortName(vm);
|
||||
char *domname = virDomainObjGetShortName(vm->def);
|
||||
char timestr[100];
|
||||
struct tm time_info;
|
||||
time_t curtime = time(NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user