[Kimchi-devel] [PATCH 2/3] Update some VM state conditions

Royce Lv lvroyce at linux.vnet.ibm.com
Tue Jan 27 07:28:53 UTC 2015


Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 01/22/2015 09:52 AM, Crístian Viana wrote:
> Some functions assume that a VM can only be in two states: shutoff and
> running. However, that's not always the case (e.g. not being running
> doesn't mean it's shutoff).
>
> Update some functions so the VM state conditions are more accurate.
>
> Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
> ---
>   src/kimchi/model/vms.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
> index 42cf3e9..5128d1e 100644
> --- a/src/kimchi/model/vms.py
> +++ b/src/kimchi/model/vms.py
> @@ -683,7 +683,7 @@ class VMModel(object):
>           try:
>               if 'name' in params:
>                   state = DOM_STATE_MAP[dom.info()[0]]
> -                if state == 'running':
> +                if state != u'shutoff':
>                       msg_args = {'name': dom.name(), 'new_name': params['name']}
>                       raise InvalidParameter("KCHVM0003E", msg_args)
>   
> @@ -788,7 +788,7 @@ class VMModel(object):
>           paths = self._vm_get_disk_paths(dom)
>           info = self.lookup(name)
>   
> -        if info['state'] == 'running':
> +        if info['state'] != u'shutoff':
>               self.poweroff(name)
>   
>           # delete existing snapshots before deleting VM




More information about the Kimchi-devel mailing list