On 4/5/19 1:37 AM, Cole Robinson wrote:
For now it's just a helper for building a qemu virDomainCapsPtr.
It will be used in upcoming patches
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu/qemu_conf.c | 39 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_conf.h | 7 +++++++
src/qemu/qemu_driver.c | 18 +++---------------
3 files changed, 49 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 41ce0a978d..635fdcc5a4 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1357,6 +1357,45 @@ virCapsPtr virQEMUDriverGetCapabilities(virQEMUDriverPtr driver,
return ret;
}
+
+/**
+ * virQEMUDriverGetDomainCapabilities:
+ *
+ * Build a virDomainCapsPtr instance for the passed data.
+ *
+ * Returns: a reference to a virDomainCapsPtr instance or NULL
+ */
+virDomainCapsPtr
+virQEMUDriverGetDomainCapabilities(virQEMUDriverPtr driver,
+ virQEMUCapsPtr qemuCaps,
+ const char *machine,
+ virArch arch,
+ virDomainVirtType virttype)
+{
+ virDomainCapsPtr ret = NULL, domCaps = NULL;
+ virCapsPtr caps = NULL;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+
+ if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
+ goto cleanup;
+
+ if (!(domCaps = virDomainCapsNew(virQEMUCapsGetBinary(qemuCaps), machine,
+ arch, virttype)))
+ goto cleanup;
+
+ if (virQEMUCapsFillDomainCaps(caps, domCaps, qemuCaps,
+ cfg->firmwares, cfg->nfirmwares) < 0)
You'll need to rebase this because after 5b9819eedc7 there's @privileged
argument.
+ goto cleanup;
+
+ VIR_STEAL_PTR(ret, domCaps);
+ cleanup:
+ virObjectUnref(domCaps);
+ virObjectUnref(cfg);
+ virObjectUnref(caps);
+ return ret;
+}
+
+
Michal