mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: capabilities: Tolerate missing @qemuCaps in virQEMUCapsGetCanonicalMachine
If qemuCaps are not present, just return the original machine type name. This will help in situations when qemuCaps is not available in the post parse callback.
This commit is contained in:
parent
7c5cf4983c
commit
9088d42da1
@ -2739,15 +2739,21 @@ int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* virQEMUCapsGetCanonicalMachine:
|
||||
* @qemuCaps: qemu capabilities object
|
||||
* @name: machine name
|
||||
*
|
||||
* Resolves aliased machine names to the actual machine name. If qemuCaps isn't
|
||||
* present @name is returned.
|
||||
*/
|
||||
const char *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
|
||||
const char *name)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!name)
|
||||
return NULL;
|
||||
if (!name || !qemuCaps)
|
||||
return name;
|
||||
|
||||
for (i = 0; i < qemuCaps->nmachineTypes; i++) {
|
||||
if (!qemuCaps->machineTypes[i].alias)
|
||||
|
Loading…
x
Reference in New Issue
Block a user