Note on nitpicks wrt grammar: if there are other changes within a patch, please apply the nitpick changes yourself, otherwise I can do that for you. As I have to push the patches anyway, it is no big deal. All changes will be documented here though.
On Thu, Jul 24, 2014 at 2:31 AM, Yuto KAWAMURA(kawamuray) < [email protected]> wrote: > Current implementation is trying to query all entries in lxc root > The current implementation tries to query all entries in the lxc root > directory, so there's several useless query such as 'instance1.conf' as > s/there's/there are/ s/query/queries/ > a instance name. > Filter only .conf files for each instance to list actually available > instances. > > Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]> > --- > lib/hypervisor/hv_lxc.py | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py > index 4971649..1442372 100644 > --- a/lib/hypervisor/hv_lxc.py > +++ b/lib/hypervisor/hv_lxc.py > @@ -199,10 +199,16 @@ class LXCHypervisor(hv_base.BaseHypervisor): > @return: [(name, id, memory, vcpus, stat, times),...] > > """ > + UNIQ_SUFFIX = ".conf" > Not a nitpick: To follow the previously established convention of constant use in this file, can you make this one the property of the class, and rename it to _UNIQUE_SUFFIX? > data = [] > - for name in os.listdir(self._ROOT_DIR): > + for filename in os.listdir(self._ROOT_DIR): > + if not filename.endswith(UNIQ_SUFFIX): > + # listing all files in root directory will include instance root + # directory, console file, and etc, so use .conf as a > representation > s/directory/directories/ s/file/files/ s/and etc/etc./ -> etc == et cetera, et == and in Latin, so the and is superfluous s/representation/filter/ > + # of instance listings. > + continue > try: > - info = self.GetInstanceInfo(name) > + info = self.GetInstanceInfo(filename[0:-len(UNIQ_SUFFIX)]) > except errors.HypervisorError: > continue > if info: > -- > 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
