[Kimchi-devel] [PATCH 3/6] Check currentMemory exists prior to remote its XML node

Daniel Henrique Barboza danielhb at linux.vnet.ibm.com
Thu Nov 13 15:50:52 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at 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 at 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)




More information about the Kimchi-devel mailing list