Latest Libvirt version changed, and does not add anymore automatically
address/slots for memory devices hotplugged. Kimchi tries to remove
memory devices by theirs slot number, when virtual machine is offline,
and if it has memory devices configured.
This behavior will raise an error, so this patch fix this problem.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
model/vms.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/model/vms.py b/model/vms.py
index b617b1d..7bf4c77 100644
--- a/model/vms.py
+++ b/model/vms.py
@@ -846,9 +846,9 @@ class VMModel(object):
newMem = newMem - (len(memDevs) * (1024 << 10))
elif newMem < (oldMem << 10):
devsRemove = len(memDevs) - (oldMem - (newMem >> 10))/1024 - 1
- for dev in memDevs:
- if int(dev.xpath('./address/@slot')[0]) > devsRemove:
- root.find('./devices').remove(dev)
+ for dev in enumerate(memDevs):
+ if dev[0] > devsRemove:
+ root.find('./devices').remove(dev[1])
newMem = \
newMem - (
len(root.findall('./devices/memory')) * 1024 << 10
--
2.1.0