Skip to content

Commit

Permalink
Fix wwwn cases failure due to qemu output format change for json
Browse files Browse the repository at this point in the history
After libvirt 7.9.0 version and afterwards, qemu wwn output is changed to decimal
instead of hex

Signed-off-by: chunfuwen <[email protected]>
  • Loading branch information
chunfuwen committed Dec 13, 2021
1 parent 02f5708 commit 50f7064
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libvirt/tests/src/virtual_disks/virtual_disks_multidisks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,10 +1755,18 @@ def test_device_update_boot_order(disk_type, disk_path, error_msg):
if len(serial) != 0 and serial[0] != "":
cmd += " | grep serial=%s" % serial[0]
if len(wwn) != 0 and wwn[0] != "":
wwn0_value = wwn[0]
# After libvirt 7.9.0, qemu output becomes json format,
# therefore wwn in hex is changed to decimal
if libvirt_version.version_compare(7, 9, 0):
wwn0_value = str(int(wwn[0], 16))
if len(wwn) > 1:
cmd += " | grep -E \"wwn=(0x)?%s.*wwn=(0x)?%s\"" % (wwn[0], wwn[1])
wwn1_value = wwn[1]
if libvirt_version.version_compare(7, 9, 0):
wwn1_value = str(int(wwn[1], 16))
cmd += " | grep -E \"wwn=(0x)?%s.*wwn=(0x)?%s\"" % (wwn0_value, wwn1_value)
else:
cmd += " | grep -E \"wwn=(0x)?%s\"" % wwn[0]
cmd += " | grep -E \"wwn=(0x)?%s\"" % wwn0_value
if vendor != "":
cmd += " | grep vendor=%s" % vendor
if product != "":
Expand Down

0 comments on commit 50f7064

Please sign in to comment.