[Kimchi-devel] [PATCH] bug fix: Set default flags for virDomain.state() function
Royce Lv
lvroyce at linux.vnet.ibm.com
Fri Mar 7 09:38:16 UTC 2014
Reviewed-by: Royce Lv<lvroyce at linux.vnet.ibm.com>
On 2014年03月07日 10:47, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> Some libvirt versions do not set the default value for flags, so we need to
> explicity set it.
>
> libvirt.virDomain.state = state(self, flags) unbound libvirt.virDomain method
>
> Otherwise, the following error will be raised
>
> [06/Mar/2014:23:40:05] HTTP Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/cherrypy/_cprequest.py", line 656, in respond
> response.body = self.handler()
> File "/usr/lib/python2.7/dist-packages/cherrypy/lib/encoding.py", line 188, in __call__
> self.body = self.oldhandler(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/cherrypy/_cpdispatch.py", line 34, in __call__
> return self.callable(*self.args, **self.kwargs)
> File "/home/alinefm/kimchi/src/kimchi/control/base.py", line 71, in wrapper
> ident = fn(*model_args)
> File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 214, in deactivate
> if self._get_vms_attach_to_a_network(name, "running"):
> File "/home/alinefm/kimchi/src/kimchi/model/networks.py", line 199, in _get_vms_attach_to_a_network
> state == dom.state()[0]):
> File "/home/alinefm/kimchi/src/kimchi/model/libvirtconnection.py", line 62, in wrapper
> ret = f(*args, **kwargs)
> TypeError: state() takes exactly 2 arguments (1 given)
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
> src/kimchi/model/networks.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/networks.py b/src/kimchi/model/networks.py
> index f032875..0d6ccec 100644
> --- a/src/kimchi/model/networks.py
> +++ b/src/kimchi/model/networks.py
> @@ -196,7 +196,7 @@ class NetworkModel(object):
> for dom in conn.listAllDomains(0):
> networks = self._vm_get_networks(dom)
> if network in networks and (state is None or
> - state == dom.state()[0]):
> + state == dom.state(0)[0]):
> vms.append(dom.name())
> return vms
>
More information about the Kimchi-devel
mailing list