canonical / cloudstats

GNU General Public License v3.0
1 stars 2 forks source link

Fails to collect statics if all cpus are in the pin-set #13

Open agileshaw opened 1 year ago

agileshaw commented 1 year ago

If all cpus are in the pinned set, hypervisor.vcpus is 0 (b/c it takes into account only shared vcpus) and cloudstats fails with:

Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: Traceback (most recent call last): Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/bin/cloudstats", line 11, in Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: load_entry_point('cloudstats==0.1', 'console_scripts', 'cloudstats')() Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/lib/python3.6/site-packages/cloudstats/daemon.py", line 92, in main Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: daemon.run() Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/lib/python3.6/site-packages/cloudstats/daemon.py", line 82, in run Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: data.update(self.collect_openstack_data()) Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/lib/python3.6/site-packages/cloudstats/daemon.py", line 67, in collect_openstack_data Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: stats = self.openstack.get_all_stats() Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/lib/python3.6/site-packages/cloudstats/opensdk.py", line 202, in get_all_stats Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: stats.update(self._get_hypervisor_stats()) Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: File "/snap/cloudstats/x1/lib/python3.6/site-packages/cloudstats/opensdk.py", line 483, in _get_hypervisor_stats Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: cpu_overcommit.append(hypervisor.vcpus_used / hypervisor.vcpus) Jun 22 16:34:15 juju-c06bf7-6-lxd-21 cloudstats.cloudstats[37010]: ZeroDivisionError: division by zero


Imported from Launchpad using lp2gh.