The address sets (pci, ccw, virtio serial) are currently cached
in qemu private data, but all the information required to recreate
these sets is in the domain definition. Therefore I am removing
the redundant data and adding a way to recalculate these sets.
Add a function that calculates the ccw address set
from the domain definition.
---
src/qemu/qemu_domain_address.c | 31 +++++++++++++++++++++++--------
src/qemu/qemu_domain_address.h | 4 ++++
2 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index ec8ce40..5cc6d29 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -320,6 +320,28 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
}
}
+virDomainCCWAddressSetPtr
+qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def)
+{
+ virDomainCCWAddressSetPtr addrs = NULL;
+
+ if (!(addrs = virDomainCCWAddressSetCreate()))
+ goto error;
+
+ if (virDomainDeviceInfoIterate(def, virDomainCCWAddressValidate,
+ addrs) < 0)
+ goto error;
+
+ if (virDomainDeviceInfoIterate(def, virDomainCCWAddressAllocate,
+ addrs) < 0)
+ goto error;
+
+ return addrs;
+
+ error:
+ virDomainCCWAddressSetFree(addrs);
+ return NULL;
+}
/*
* Three steps populating CCW devnos
@@ -341,16 +363,9 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
qemuDomainPrimeVirtioDeviceAddresses(
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
- if (!(addrs = virDomainCCWAddressSetCreate()))
- goto cleanup;
-
- if (virDomainDeviceInfoIterate(def, virDomainCCWAddressValidate,
- addrs) < 0)
+ if (!(addrs = qemuDomainCCWAddrSetCreateFromDomain(def)))
goto cleanup;
- if (virDomainDeviceInfoIterate(def, virDomainCCWAddressAllocate,
- addrs) < 0)
- goto cleanup;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
/* deal with legacy virtio-s390 */
qemuDomainPrimeVirtioDeviceAddresses(
diff --git a/src/qemu/qemu_domain_address.h b/src/qemu/qemu_domain_address.h
index ee326d7..11d6e92 100644
--- a/src/qemu/qemu_domain_address.h
+++ b/src/qemu/qemu_domain_address.h
@@ -41,6 +41,10 @@ void qemuDomainReleaseDeviceAddress(virDomainObjPtr vm,
virDomainDeviceInfoPtr info,
const char *devstr);
+virDomainCCWAddressSetPtr
+qemuDomainCCWAddrSetCreateFromDomain(virDomainDefPtr def)
+ ATTRIBUTE_NONNULL(1);
+
# define __QEMU_DOMAIN_ADDRESS_H__
#endif /* __QEMU_DOMAIN_ADDRESS_H__ */
--
2.7.4 (Apple Git-66)