On 10/21/2016 09:58 AM, Ján Tomko wrote:
Return 0 instead of 1, so that qemuDomainAttachChrDevice does not
assume the address neeeds to be released on error.
No functional change, since qemuDomainReleaseDeviceAddress has been a noop
for virtio serial addresses since the address cache was removed.
s/./ in commit id '19a148b7'.
ACK,
John
---
src/qemu/qemu_hotplug.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 9e9073d..d432616 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1635,6 +1635,10 @@ qemuDomainChrRemove(virDomainDefPtr vmdef,
return ret;
}
+/* Returns 1 if the address will need to be released later,
+ * -1 on error
+ * 0 otherwise
+ */
Something that should have been there from the start!
static int
qemuDomainAttachChrDeviceAssignAddr(virDomainDefPtr def,
qemuDomainObjPrivatePtr priv,
@@ -1644,7 +1648,7 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainDefPtr def,
chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO) {
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, true) < 0)
return -1;
- return 1;
+ return 0;
} else if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
chr->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI) {
@@ -1663,7 +1667,7 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainDefPtr def,
chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
if (virDomainVirtioSerialAddrAutoAssign(def, &chr->info, false) < 0)
return -1;
- return 1;
+ return 0;
}
if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL ||