Bug 1540290
Summary: | libvirt needs to tolerate JSON backing store strings containing fields described as 'int' being a string in various cases | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Peter Krempa <pkrempa> |
Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
Status: | CLOSED ERRATA | QA Contact: | Meina Li <meili> |
Severity: | high | Docs Contact: | |
Priority: | high | ||
Version: | 7.5 | CC: | chayang, coli, dyuan, famz, hhan, hreitz, jcody, jiyan, juzhang, knoel, lmen, lmiksik, lolyu, meili, michen, mtessun, ngu, pkrempa, rbalakri, stefanha, virt-maint, xuzhang, yisun |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | x86_64 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | libvirt-3.9.0-10.el7 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | 1534396 | Environment: | |
Last Closed: | 2018-04-10 11:04:21 UTC | Type: | Bug |
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: | 1534396 | ||
Bug Blocks: |
Description
Peter Krempa
2018-01-30 17:28:27 UTC
Fixed upstream: commit f46d6e22f2dc352cd43480c1d148222f4e62b8e6 Author: Peter Krempa <pkrempa> Date: Wed Jan 31 12:00:42 2018 +0100 util: storage: Parse 'lun' for iSCSI protocol from JSON as string or number While the QEMU QAPI schema describes 'lun' as a number, the code dealing with JSON strings does not strictly adhere to this schema and thus formats the number back as a string. Use the new helper to retrieve both possibilities. Note that the formatting code is okay and qemu will accept it as an int. Tweak also one of the test strings to verify that both formats work with libvirt. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1540290 commit d3da8013cc11d6a10d4a4146bcbb0a7e34523fa5 Author: Peter Krempa <pkrempa> Date: Wed Jan 31 11:54:31 2018 +0100 util: json: Add helper to return string or number properties as string The helper is useful in cases when the JSON we have to parse may contain one of the two due to historical reasons and the number value itself would be stored as a string. Verified on libvirt-3.9.0-10.el7.x86_64. The result is expected and move it to verified. Scenario 1: restart guest 1. Prepare a guest with iscsi network disk. # virsh dumpxml rhel7 | grep “<disk” -a8 <disk type='network' device='disk'> <driver name='qemu' type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> 2. Create external disk, check xml and qemu-img info. # for i in 1 2 3 4;do virsh snapshot-create-as rhel7 s$i --disk-only --diskspec vda,file=/tmp/rhel7.s$i;done # virsh dumpxml rhel7 | grep “<disk” -a20 <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/tmp/rhel7.s4'/> <backingStore type='file' index='1'> <format type='qcow2'/> <source file='/tmp/rhel7.s3'/> <backingStore type='file' index='2'> <format type='qcow2'/> <source file='/tmp/rhel7.s2'/> <backingStore type='file' index='3'> <format type='qcow2'/> <source file='/tmp/rhel7.s1'/> <backingStore type='network' index='4'> <format type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> </backingStore> </backingStore> </backingStore> </backingStore> # qemu-img info /tmp/rhel7.s4 -U --backing-chain | grep "backing file:" backing file: /tmp/rhel7.s3 backing file: /tmp/rhel7.s2 backing file: /tmp/rhel7.s1 backing file: json:{"driver": "qcow2", "file": {"lun": "2", "portal": "**IP**", "driver": "iscsi", "transport": "tcp", "target": "iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2"}} 3. Restart guest and check guest xml. # virsh destroy rhel7 # virsh start rhel7 # virsh dumpxml rhel7 | grep “<disk” -a20 # qemu-img info /tmp/rhel7.s4 -U --backing-chain | grep "backing file:" --------the actual result is same with step 2, as expected result------------- 4. Restart libvirtd, check guest xml and qemu-img info. # systemctl restart libvirtd # virsh dumpxml rhel7 | grep “<disk” -a20 # qemu-img info /tmp/rhel7.s4 -U --backing-chain | grep "backing file:" --------the actual result is same with step 2, as expected result------------- Scenario 2: Do blockcommit. 1. Repeat step 1~step 2 in Scenario 1. 2. Do blockcommit from top to middle. # virsh blockcommit rhel7 vda --base vda[2] --active --verbose --wait --pivot Block commit: [100 %] Successfully pivoted # virsh dumpxml rhel7 | grep "iscsi" -a2 <backingStore type='network' index='2'> <format type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> 3. Do blockcommit from top to base. # virsh blockcommit rhel7 vda --active --verbose --wait --pivot Block commit: [100 %] Successfully pivoted # virsh dumpxml rhel7 | grep "iscsi" -a2 <disk type='network' device='disk'> <driver name='qemu' type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> Scenario 3: Do blockpull and blockcopy with --shallow. 1. Repeat step 1~step 2 in Scenario 1. 2. Do blockpull from middle to top. # virsh blockpull rhel7 vda --base vda[2] --wait --verbose Block Pull: [100 %] Pull complete # virsh dumpxml rhel7 | grep "iscsi" -a2 <backingStore type='network' index='3'> <format type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> 3. Do blockcopy with --shallow. # virsh blockcopy rhel7 vda /tmp/rhel7.copy --wait --verbose --transient-job --shallow Block Copy: [100 %] Now in mirroring phase # virsh dumpxml rhel7 | grep "iscsi" -a2 <backingStore type='network' index='3'> <format type='qcow2'/> <source protocol='iscsi' name='iqn.2003-01.org.linux-iscsi.intel-e5530-8-1.x8664:sn.135b6ed5e6b2/2'> <host name='**IP**' port='3260'/> </source> 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. https://access.redhat.com/errata/RHEA-2018:0704 |