提交 9088d42d 编写于 作者: P Peter Krempa

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.
上级 7c5cf498
...@@ -2739,15 +2739,21 @@ int virQEMUCapsGetMachineTypesCaps(virQEMUCapsPtr qemuCaps, ...@@ -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 *virQEMUCapsGetCanonicalMachine(virQEMUCapsPtr qemuCaps,
const char *name) const char *name)
{ {
size_t i; size_t i;
if (!name) if (!name || !qemuCaps)
return NULL; return name;
for (i = 0; i < qemuCaps->nmachineTypes; i++) { for (i = 0; i < qemuCaps->nmachineTypes; i++) {
if (!qemuCaps->machineTypes[i].alias) if (!qemuCaps->machineTypes[i].alias)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册