mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-25 13:50:09 +03:00
qemu: Use short domain name in qemuDomainGetPreservedMountPath
Otherwise longer domain names might generate paths that are too long to be created. This follows what other parts of the code do as well. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1453194 Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
@ -7827,14 +7827,18 @@ qemuDomainGetPreservedMountPath(virQEMUDriverConfigPtr cfg,
|
||||
char *path = NULL;
|
||||
char *tmp;
|
||||
const char *suffix = mountpoint + strlen(DEVPREFIX);
|
||||
char *domname = virDomainObjGetShortName(vm->def);
|
||||
size_t off;
|
||||
|
||||
if (!domname)
|
||||
return NULL;
|
||||
|
||||
if (STREQ(mountpoint, "/dev"))
|
||||
suffix = "dev";
|
||||
|
||||
if (virAsprintf(&path, "%s/%s.%s",
|
||||
cfg->stateDir, vm->def->name, suffix) < 0)
|
||||
return NULL;
|
||||
cfg->stateDir, domname, suffix) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* Now consider that @mountpoint is "/dev/blah/blah2".
|
||||
* @suffix then points to "blah/blah2". However, caller
|
||||
@ -7850,6 +7854,8 @@ qemuDomainGetPreservedMountPath(virQEMUDriverConfigPtr cfg,
|
||||
tmp++;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(domname);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user