Bug 1110185

Summary: virDomainGetCPUStats returns binary data in error message when domain doesn't exist
Product: Red Hat Enterprise Linux 6 Reporter: Libor Miksik <lmiksik>
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, bazulay, cwei, dyuan, ederevea, honzhang, iheim, jferlan, jiahu, jkt, jsvarova, lpeer, michal.skrivanek, mzhan, pm-eus, tdosek, vvyazmin, yeylon, zhwang
Target Milestone: rcKeywords: Upstream, ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-29.el6_5.10 Doc Type: Bug Fix
Doc Text:
The UUID (Universally Unique Identifier) is a string of characters which represents the virtual guest. Displaying the UUID on a screen requires correct APIs to present the strings in a user-readable format. Previously, printing unformatted UUID data caused exceptions or incorrectly formatted output. For Python scripts, exceptions that were not handled could cause unexpected failures. For other loggings or visual displays, the characters in the output were jumbled. With this update, the UUID strings are properly formatted and printing them no longer causes unexpected exceptions or jumbled characters on output.
Story Points: ---
Clone Of: 947974 Environment:
Last Closed: 2014-08-04 08:13:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 947974    
Bug Blocks:    

Description Libor Miksik 2014-06-17 08:00:20 UTC
This bug has been copied from bug #947974 and has been proposed
to be backported to 6.5 z-stream (EUS).

Comment 6 hongming 2014-07-04 07:53:42 UTC
Verify it as follows. The result is expected. Move its status to VERIFIED.


# rpm -q libvirt libvirt-python
libvirt-0.10.2-29.el6_5.10.x86_64
libvirt-python-0.10.2-29.el6_5.10.x86_64

# virsh create r6.4.xml
Domain r6.4 created from r6.4.xml

# python
Python 2.6.6 (r266:84292, Nov 21 2013, 10:50:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open("")
>>> dom = conn.lookupByName("r6.4")
>>> dom.getCPUStats(0, 0)
[{'vcpu_time': 48019017686L, 'cpu_time': 87363244786L}, {'vcpu_time': 16978007952L, 'cpu_time': 34795454164L}, {'vcpu_time': 17747128599L, 'cpu_time': 27273854705L}, {'vcpu_time': 14829782612L, 'cpu_time': 22151642963L}]
>>> dom.memoryParameters(0)
{'swap_hard_limit': 5007199254740992L, 'hard_limit': 5007199254740992L, 'soft_limit': 5007199254740992L}
>>> params  = {'hard_limit': 5007199254740991L, 'soft_limit': 5007199254740991L, 'swap_hard_limit': 5007199254740991L}
>>> dom.setMemoryParameters(params,0)
0
>>> dom.memoryParameters(0)
{'swap_hard_limit': 5007199254740992L, 'hard_limit': 5007199254740992L, 'soft_limit': 5007199254740992L}
>>> dom.blkioParameters(0)
{'device_weight': '', 'weight': 500}
>>> params = {'device_weight': '', 'weight': 200}
>>> dom.setBlkioParameters(params,0)
0
>>> dom.blkioParameters(0)
{'device_weight': '', 'weight': 200}
>>> dom.numaParameters(0)
{'numa_nodeset': '0', 'numa_mode': 0}
>>> params  = {'numa_nodeset': '0', 'numa_mode': 0}
>>> dom.setNumaParameters(params,0)
0
>>> dom.numaParameters(0)
{'numa_nodeset': '0', 'numa_mode': 0}
>>> dom.schedulerParametersFlags(0)
{'vcpu_quota': -1L, 'vcpu_period': 100000L, 'emulator_period': 100000L, 'emulator_quota': -1L, 'cpu_shares': 2048L}
>>> params  ={'vcpu_quota': -1L, 'vcpu_period': 100000L, 'emulator_period': 100000L, 'emulator_quota': -1L, 'cpu_shares': 2048L}
>>> dom.setSchedulerParametersFlags(params,0)
0
>>> dom.schedulerParametersFlags(0)
{'vcpu_quota': -1L, 'vcpu_period': 100000L, 'emulator_period': 100000L, 'emulator_quota': -1L, 'cpu_shares': 2048L}
>>> dom.interfaceParameters("vnet2",0)
{'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 0, 'outbound.burst': 0}
>>> params  = {'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 128, 'outbound.burst': 0}
>>> dom.setInterfaceParameters("vnet2",params,0)
0
>>> dom.interfaceParameters("vnet2",0)
{'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 128, 'outbound.burst': 0}
>>> dom.destroy()
0


>>> dom.getCPUStats(0, 0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1868, in getCPUStats
    if ret is None: raise libvirtError ('virDomainGetCPUStats() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'


>>> dom.interfaceParameters("vnet2",0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1880, in interfaceParameters
    if ret is None: raise libvirtError ('virDomainGetInterfaceParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'


>>> params  = {'outbound.peak': 0, 'inbound.peak': 0, 'inbound.burst': 0, 'inbound.average': 0, 'outbound.average': 128, 'outbound.burst': 0}
>>> dom.setInterfaceParameters("vnet2",params,0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1978, in setInterfaceParameters
    if ret == -1: raise libvirtError ('virDomainSetInterfaceParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'


>>> dom.schedulerParametersFlags(0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1954, in schedulerParametersFlags
    if ret is None: raise libvirtError ('virDomainGetSchedulerParametersFlags() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

>>> params  ={'vcpu_quota': -1L, 'vcpu_period': 100000L, 'emulator_period': 100000L, 'emulator_quota': -1L, 'cpu_shares': 2048L}
>>> dom.setSchedulerParametersFlags(params,0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 2002, in setSchedulerParametersFlags
    if ret == -1: raise libvirtError ('virDomainSetSchedulerParametersFlags() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

>>> dom.numaParameters(0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1922, in numaParameters
    if ret is None: raise libvirtError ('virDomainGetNumaParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

>>> params  = {'numa_nodeset': '0', 'numa_mode': 0}
>>> dom.setNumaParameters(params,0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1990, in setNumaParameters
    if ret == -1: raise libvirtError ('virDomainSetNumaParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

>>> dom.memoryParameters(0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1898, in memoryParameters
    if ret is None: raise libvirtError ('virDomainGetMemoryParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

>>> params  = {'hard_limit': 5007199254740991L, 'soft_limit': 5007199254740991L, 'swap_hard_limit': 5007199254740991L}
>>> dom.setMemoryParameters(params,0)
libvir: QEMU Driver error : Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/site-packages/libvirt.py", line 1984, in setMemoryParameters
    if ret == -1: raise libvirtError ('virDomainSetMemoryParameters() failed', dom=self)
libvirt.libvirtError: Domain not found: no domain with matching uuid 'd920458d-a80c-2796-8c60-f471f3e35a1b'

Comment 8 errata-xmlrpc 2014-08-04 08:13:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0911.html