Reviewed-by: Daniel Barboza <danielhb(a)linux.vnet.ibm.com>
Just fix a small typo in the commit msg before pushing:
"But **if** the guest was never started it does not have a currentMemory "
On 11/11/2014 06:46 PM, Aline Manera wrote:
When updating the guest memory, the currentMemory node must be
removed
to reflect the new value.
But it the guest was never started it does not have a currentMemory
node. So check it is exists first prior to remove it.
Signed-off-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index d194049..d13732b 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -650,7 +650,9 @@ class VMModel(object):
dom.undefine()
root = ET.fromstring(new_xml)
- root.remove(root.find('.currentMemory'))
+ currentMem = root.find('.currentMemory')
+ if currentMem is not None:
+ root.remove(currentMem)
dom = conn.defineXML(ET.tostring(root, encoding="utf-8"))
except libvirt.libvirtError as e:
dom = conn.defineXML(old_xml)