Just like we did two commits ago, don't try to fetch capabilities
for non-existing binary. Re-use the ones we have for running
domain.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/qemu/qemu_domain.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 81cb87a..d3af622 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2779,16 +2779,24 @@ qemuDomainDefAssignAddresses(virDomainDef *def,
virCapsPtr caps ATTRIBUTE_UNUSED,
unsigned int parseFlags ATTRIBUTE_UNUSED,
void *opaque,
- void *parseOpaque ATTRIBUTE_UNUSED)
+ void *parseOpaque)
{
virQEMUDriverPtr driver = opaque;
+ virDomainObjPtr vm = parseOpaque;
+ qemuDomainObjPrivatePtr priv;
virQEMUCapsPtr qemuCaps = NULL;
int ret = -1;
bool newDomain = parseFlags & VIR_DOMAIN_DEF_PARSE_ABI_UPDATE;
- if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
- def->emulator)))
- goto cleanup;
+ if (vm) {
+ priv = vm->privateData;
+ qemuCaps = priv->qemuCaps;
+ virObjectRef(qemuCaps);
+ } else {
+ if (!(qemuCaps = virQEMUCapsCacheLookup(driver->qemuCapsCache,
+ def->emulator)))
+ goto cleanup;
+ }
if (qemuDomainAssignAddresses(def, qemuCaps, NULL, newDomain) < 0)
goto cleanup;
--
2.8.4