BUGFIX: PCI-3781 nova-compute service is running vgs multiple times

- refactoring part of code to get all needed values in one call instead of
  consequenti multiple call of the same expensive external command
- optimalizing calls of new methods and functions little bit
It came to my mind that x * 1024 ** 3 (the power of 3) used to be slower
than x * 1024 * 1024 * 1024 in time of my youth ;-)

On Wed, Sep 10, 2014 at 2:22 PM, Yury Tsarev <notifications@github.com>
wrote:

> In nova/virt/libvirt/driver.py:
>
> > @@ -2345,17 +2374,20 @@ def get_available_resource(self):
> >
> >          :returns: dictionary containing resource info
> >          """
> > +        disk_total, disk_used, disk_avail = self.get_local_gb_all_info()
> > +        instances_sz_bytes = self.get_disk_instances_sz()
> > +        instances_sz = ((disk_avail * 1024 *1024 * 1024) - instances_sz_bytes) / 1024 / 1024 / 1024
>
> Why repeating 1024 so many times? can't it be just
>
> instances_sz = ((disk_avail * 1024 ** 3) - instances_sz_bytes) / 1024 ** 3
> ?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/gooddata/openstack-nova/pull/39/files#r17357289>.
>



-- 
*Zdeněk Pižl* | Platform team
zdenek.pizl@gooddata.com

GoodData | gooddata.com
Karolinská 650/1
186 00 Prague 8