Skip to content

Commit

Permalink
Merge pull request #3932 from chunfuwen/fix_wwn_cases_failure
Browse files Browse the repository at this point in the history
Fix wwn cases failure due to qemu output format change for json
  • Loading branch information
chunfuwen authored Jan 4, 2022
2 parents 7fc4da7 + 50f7064 commit cbed38c
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 cbed38c

Please sign in to comment.