LGTM, thanks
On Wed, Jul 30, 2014 at 6:36 PM, Yuto KAWAMURA(kawamuray) < [email protected]> wrote: > Add the _IsInstanceAlive method which checks whether instance is running > or not. > > Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]> > --- > lib/hypervisor/hv_lxc.py | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py > index 6f883e9..9a339a6 100644 > --- a/lib/hypervisor/hv_lxc.py > +++ b/lib/hypervisor/hv_lxc.py > @@ -226,6 +226,18 @@ class LXCHypervisor(hv_base.BaseHypervisor): > """ > return [iinfo[0] for iinfo in self.GetAllInstancesInfo()] > > + @classmethod > + def _IsInstanceAlive(cls, instance_name): > + """Return True if instance is alive. > + > + """ > + result = utils.RunCmd(["lxc-ls", "--running"]) > + if result.failed: > + raise HypervisorError("Failed to get running LXC containers list: > %s" % > + result.output) > + > + return instance_name in result.stdout.split() > + > def GetInstanceInfo(self, instance_name, hvparams=None): > """Get instance properties. > > -- > 1.8.5.5 > > Hrvoje Ribicic Ganeti Engineering Google Germany GmbH Dienerstr. 12, 80331, München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370
