[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 2/3] qemu: Remove unused persistentAddrs



Based on some digital archaeology performed by jtomko, it's been determined
that the persistentAddrs variable is no longer necessary...

The variable was added by:
commit 141dea6bc7222107c2357acb68066baea5b26df3
CommitDate: 2010-02-12 17:25:52 +0000
    Add persistence of PCI addresses to QEMU

Where it was set to 0 on domain startup if qemu did not support the
QEMUD_CMD_FLAG_DEVICE capability, to clear the addresses at shutdown,
because QEMU might make up different ones next time.

As of commit f5dd58a6088cfc6e8bd354b693d399807a8ec395
CommitDate: 2012-07-11 11:19:05 +0200
    qemu: Extended qemuDomainAssignAddresses to be callable from
    everywhere.

this was broken, when the persistentAddrs = 0 assignment was moved
inside qemuDomainAssignPCIAddresses and while it pretends to check
for !QEMU_CAPS_DEVICE, its parent qemuDomainAssignAddresses is only
called if QEMU_CAPS_DEVICE is present.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/qemu/qemu_domain.h         |  1 -
 src/qemu/qemu_domain_address.c |  5 -----
 src/qemu/qemu_process.c        | 18 ++++++++----------
 3 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index f99f0bb..8176bf5 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -190,7 +190,6 @@ struct _qemuDomainObjPrivate {
     virDomainPCIAddressSetPtr pciaddrs;
     virDomainCCWAddressSetPtr ccwaddrs;
     virDomainVirtioSerialAddrSetPtr vioserialaddrs;
-    int persistentAddrs;
 
     virQEMUCapsPtr qemuCaps;
     char *lockState;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 95c11fa..6e166b9 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -149,7 +149,6 @@ qemuDomainAssignVirtioSerialAddresses(virDomainDefPtr def,
         priv = obj->privateData;
         /* if this is the live domain object, we persist the addresses */
         virDomainVirtioSerialAddrSetFree(priv->vioserialaddrs);
-        priv->persistentAddrs = 1;
         priv->vioserialaddrs = addrs;
         addrs = NULL;
     }
@@ -382,11 +381,8 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
         if (addrs) {
             /* if this is the live domain object, we persist the CCW addresses*/
             virDomainCCWAddressSetFree(priv->ccwaddrs);
-            priv->persistentAddrs = 1;
             priv->ccwaddrs = addrs;
             addrs = NULL;
-        } else {
-            priv->persistentAddrs = 0;
         }
     }
     ret = 0;
@@ -1616,7 +1612,6 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
         priv = obj->privateData;
         /* if this is the live domain object, we persist the PCI addresses*/
         virDomainPCIAddressSetFree(priv->pciaddrs);
-        priv->persistentAddrs = 1;
         priv->pciaddrs = addrs;
         addrs = NULL;
     }
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index b2669c0..0baa34a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5754,16 +5754,14 @@ void qemuProcessStop(virQEMUDriverPtr driver,
     priv->qemuDevices = NULL;
 
     virDomainDefClearDeviceAliases(vm->def);
-    if (!priv->persistentAddrs) {
-        virDomainDefClearPCIAddresses(vm->def);
-        virDomainPCIAddressSetFree(priv->pciaddrs);
-        priv->pciaddrs = NULL;
-        virDomainDefClearCCWAddresses(vm->def);
-        virDomainCCWAddressSetFree(priv->ccwaddrs);
-        priv->ccwaddrs = NULL;
-        virDomainVirtioSerialAddrSetFree(priv->vioserialaddrs);
-        priv->vioserialaddrs = NULL;
-    }
+    virDomainDefClearPCIAddresses(vm->def);
+    virDomainPCIAddressSetFree(priv->pciaddrs);
+    priv->pciaddrs = NULL;
+    virDomainDefClearCCWAddresses(vm->def);
+    virDomainCCWAddressSetFree(priv->ccwaddrs);
+    priv->ccwaddrs = NULL;
+    virDomainVirtioSerialAddrSetFree(priv->vioserialaddrs);
+    priv->vioserialaddrs = NULL;
 
     qemuHostdevReAttachDomainDevices(driver, vm->def);
 
-- 
2.5.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]