[Kimchi-devel] [PATCH 1/3] Optimize VM update function
Royce Lv
lvroyce at linux.vnet.ibm.com
Tue Jan 27 07:27:58 UTC 2015
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 01/22/2015 09:52 AM, Crístian Viana wrote:
> When updating a VM, Kimchi always fetches the current VM state
> regardless of whether it will be needed.
>
> Move the VM state fetching to block where it's needed. That way, Kimchi
> will save a libvirt call when that result isn't important for the
> operation.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
> src/kimchi/model/vms.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
> index bae27c1..42cf3e9 100644
> --- a/src/kimchi/model/vms.py
> +++ b/src/kimchi/model/vms.py
> @@ -663,7 +663,6 @@ class VMModel(object):
> return xml
>
> def _static_vm_update(self, dom, params):
> - state = DOM_STATE_MAP[dom.info()[0]]
> old_xml = new_xml = dom.XMLDesc(0)
>
> for key, val in params.items():
> @@ -683,6 +682,7 @@ class VMModel(object):
> conn = self.conn.get()
> try:
> if 'name' in params:
> + state = DOM_STATE_MAP[dom.info()[0]]
> if state == 'running':
> msg_args = {'name': dom.name(), 'new_name': params['name']}
> raise InvalidParameter("KCHVM0003E", msg_args)
More information about the Kimchi-devel
mailing list