LGTM, thanks! On Thu, Jul 24, 2014 at 2:31 AM, Yuto KAWAMURA(kawamuray) < [email protected]> wrote:
> Add _IsInstanceAlive method which checks whether instance is running or > Although you do need a "the" between the first two words. Will fix that ^^ > 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 dfe094b..9729f3f 100644 > --- a/lib/hypervisor/hv_lxc.py > +++ b/lib/hypervisor/hv_lxc.py > @@ -228,6 +228,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
