Change GetInstanceInfo to use _IsInstanceAlive instead of calling lxc-info with the instance name. The behavior of lxc-info for nonexistent containers has changed in LXC 1.0.0 and it is also not accurate to use lxc-info for checking instance existence.
Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]> --- lib/hypervisor/hv_lxc.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index 9a339a6..57d6cfb 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -251,15 +251,7 @@ class LXCHypervisor(hv_base.BaseHypervisor): """ # TODO: read container info from the cgroup mountpoint - result = utils.RunCmd(["lxc-info", "-s", "-n", instance_name]) - if result.failed: - raise errors.HypervisorError("Running lxc-info failed: %s" % - result.output) - # lxc-info output examples: - # 'state: STOPPED - # 'state: RUNNING - _, state = result.stdout.rsplit(None, 1) - if state != "RUNNING": + if not self._IsInstanceAlive(instance_name): return None cpu_list = self._GetCgroupCpuList(instance_name) -- 1.8.5.5
