1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-14 23:24:23 +03:00

Add qemuDomainCCWAddrSetCreateFromDomain

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.
This commit is contained in:
Tomasz Flendrich 2016-07-23 03:47:09 +02:00 committed by Martin Kletzander
parent 19a148b7c8
commit af174f6e20
2 changed files with 27 additions and 8 deletions

View File

@ -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()))
if (!(addrs = qemuDomainCCWAddrSetCreateFromDomain(def)))
goto cleanup;
if (virDomainDeviceInfoIterate(def, virDomainCCWAddressValidate,
addrs) < 0)
goto cleanup;
if (virDomainDeviceInfoIterate(def, virDomainCCWAddressAllocate,
addrs) < 0)
goto cleanup;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
/* deal with legacy virtio-s390 */
qemuDomainPrimeVirtioDeviceAddresses(

View File

@ -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__ */