Fix AttributeError: 'virDomain' object has no attribute 'id'

When checking 'libvirt' instance and inspecting disk info,
monasca_agent collector complains errors "AttributeError: 'virDomain'
object has no attribute 'id'". Because 'instance' has no attribute 'id',
so 'instance.id' will lead to errors. We can use 'instance.ID()' to
get an instance uuid.

Change-Id: Ife95c2a976a99bb73e71a3764fa1c4f5d26cc36e
Story: 2000987
Task: 4164
Closes-Bug:#1682354
This commit is contained in:
wanghuagong 2017-04-13 15:50:23 +08:00
parent 1aeddf955b
commit 1e21de689a
1 changed files with 1 additions and 1 deletions

View File

@ -206,7 +206,7 @@ class LibvirtInspector(virt_inspector.Inspector):
if disk_type == 'network':
log.debug('Inspection disk usage of network disk '
'%(instance_uuid)s unsupported by libvirt' % {
'instance_uuid': instance.id})
'instance_uuid': instance.ID()})
continue
target = disk.find('target')
device = target.get('dev')