Skip to content
Snippets Groups Projects
Commit d01baf53 authored by Balazs Lecz's avatar Balazs Lecz
Browse files

LXC: Use lxc-info to get instance info


Signed-off-by: default avatarBalazs Lecz <leczb@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 637c8ab8
No related branches found
No related tags found
No related merge requests found
...@@ -142,7 +142,17 @@ class LXCHypervisor(hv_base.BaseHypervisor): ...@@ -142,7 +142,17 @@ class LXCHypervisor(hv_base.BaseHypervisor):
""" """
# TODO: read container info from the cgroup mountpoint # TODO: read container info from the cgroup mountpoint
return (instance_name, 0, 0, 0, 0, 0)
result = utils.RunCmd(["lxc-info", "-n", instance_name])
if result.failed:
raise errors.HypervisorError("Can't run lxc-info: %s" % result.output)
# lxc-info output examples:
# 'ganeti-lxc-test1' is STOPPED
# 'ganeti-lxc-test1' is RUNNING
_, state = result.stdout.rsplit(None, 1)
if state == "RUNNING":
return (instance_name, 0, 0, 0, 0, 0)
return None
def GetAllInstancesInfo(self): def GetAllInstancesInfo(self):
"""Get properties of all instances. """Get properties of all instances.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment