Merge "Use the list when get information from libvirt"
This commit is contained in:
commit
0eb9f5131b
@ -107,12 +107,12 @@ class LibvirtInspector(virt_inspector.Inspector):
|
||||
|
||||
def inspect_cpus(self, instance_name):
|
||||
domain = self._lookup_by_name(instance_name)
|
||||
(__, __, __, num_cpu, cpu_time) = domain.info()
|
||||
return virt_inspector.CPUStats(number=num_cpu, time=cpu_time)
|
||||
dom_info = domain.info()
|
||||
return virt_inspector.CPUStats(number=dom_info[3], time=dom_info[4])
|
||||
|
||||
def inspect_vnics(self, instance_name):
|
||||
domain = self._lookup_by_name(instance_name)
|
||||
(state, __, __, __, __) = domain.info()
|
||||
state = domain.info()[0]
|
||||
if state == libvirt.VIR_DOMAIN_SHUTOFF:
|
||||
LOG.warn(_('Failed to inspect vnics of %(instance_name)s, '
|
||||
'domain is in state of SHUTOFF'),
|
||||
@ -138,17 +138,16 @@ class LibvirtInspector(virt_inspector.Inspector):
|
||||
for p in iface.findall('filterref/parameter'))
|
||||
interface = virt_inspector.Interface(name=name, mac=mac_address,
|
||||
fref=fref, parameters=params)
|
||||
rx_bytes, rx_packets, __, __, \
|
||||
tx_bytes, tx_packets, __, __ = domain.interfaceStats(name)
|
||||
stats = virt_inspector.InterfaceStats(rx_bytes=rx_bytes,
|
||||
rx_packets=rx_packets,
|
||||
tx_bytes=tx_bytes,
|
||||
tx_packets=tx_packets)
|
||||
dom_stats = domain.interfaceStats(name)
|
||||
stats = virt_inspector.InterfaceStats(rx_bytes=dom_stats[0],
|
||||
rx_packets=dom_stats[1],
|
||||
tx_bytes=dom_stats[4],
|
||||
tx_packets=dom_stats[5])
|
||||
yield (interface, stats)
|
||||
|
||||
def inspect_disks(self, instance_name):
|
||||
domain = self._lookup_by_name(instance_name)
|
||||
(state, __, __, __, __) = domain.info()
|
||||
state = domain.info()[0]
|
||||
if state == libvirt.VIR_DOMAIN_SHUTOFF:
|
||||
LOG.warn(_('Failed to inspect disks of %(instance_name)s, '
|
||||
'domain is in state of SHUTOFF'),
|
||||
|
Loading…
Reference in New Issue
Block a user