[elbe-devel] [PATCH 3/4] initvmaction: use listAllDomains() and scan to look for initvm
Manuel Traut
manut at linutronix.de
Wed Nov 7 11:16:03 CET 2018
On Mon, Oct 01, 2018 at 04:37:47PM +0200, Torben Hohn wrote:
> lookupByName() produces an error print, which is not wanted.
>
> Use listAllDomains() and just scan for cfg['initvm_domain']
>
> Fixes: #140
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
and applied to devel/elbe-3.0
Thanks!
> ---
> elbepack/initvmaction.py | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
> index fdcdd571..09278c84 100644
> --- a/elbepack/initvmaction.py
> +++ b/elbepack/initvmaction.py
> @@ -102,12 +102,16 @@ class InitVMAction(object):
> # In case we get here, the exception is unknown, and we want to see it
> raise
>
> - try:
> - self.initvm = self.conn.lookupByName(cfg['initvm_domain'])
> - except libvirt.libvirtError:
> - self.initvm = None
> - if initvmNeeded:
> - sys.exit(20)
> + doms = self.conn.listAllDomains()
> +
> + self.initvm = None
> + for d in doms:
> + if d.name() == cfg['initvm_domain']:
> + self.initvm = d
> +
> + if not self.initvm and initvmNeeded:
> + sys.exit(20)
> +
> self.node = node
>
> def execute(self, _initvmdir, _opt, _args):
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list