mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
conf: Change handling for empty NVRAM path
Right now, this results in loader->nvram being NULL, which is reasonable: loader->nvramTemplate is stored separately, so if the <nvram> element doesn't contain a path there is really no useful information inside it. However, this is about to change, so we will find ourselves needing to hold on to loader->nvram even when no path is present. Change the firmware handling code so that such a scenario is dealt with appropriately. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e057a29b76
commit
b3b81e60e4
src
@ -16775,16 +16775,13 @@ virDomainLoaderDefParseXMLNvram(virDomainLoaderDef *loader,
|
||||
return -1;
|
||||
|
||||
if (!typePresent) {
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
if (!(path = virXMLNodeContentString(nvramNode)))
|
||||
if (!(src->path = virXMLNodeContentString(nvramNode)))
|
||||
return -1;
|
||||
|
||||
if (STREQ(path, ""))
|
||||
return 0;
|
||||
if (STREQ(src->path, ""))
|
||||
VIR_FREE(src->path);
|
||||
|
||||
src->type = VIR_STORAGE_TYPE_FILE;
|
||||
src->path = g_steal_pointer(&path);
|
||||
} else {
|
||||
if (!nvramSourceNode)
|
||||
return -1;
|
||||
|
@ -997,9 +997,14 @@ qemuFirmwareEnsureNVRAM(virDomainDef *def,
|
||||
if (!loader)
|
||||
return;
|
||||
|
||||
if (loader->nvram)
|
||||
/* If the source already exists and is fully specified, including
|
||||
* the path, leave it alone */
|
||||
if (loader->nvram && loader->nvram->path)
|
||||
return;
|
||||
|
||||
if (loader->nvram)
|
||||
virObjectUnref(loader->nvram);
|
||||
|
||||
loader->nvram = virStorageSourceNew();
|
||||
loader->nvram->type = VIR_STORAGE_TYPE_FILE;
|
||||
loader->nvram->format = VIR_STORAGE_FILE_RAW;
|
||||
|
Loading…
x
Reference in New Issue
Block a user