Bug 1152482

Summary: HMP and QMP prints wrong after live merge to the relative path of the backing file
Product: Red Hat Enterprise Linux 7 Reporter: Qian Guo <qiguo>
Component: qemu-kvm-rhevAssignee: Jeff Cody <jcody>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: chayang, dyuan, hhuang, juzhang, michen, qizhu, shu, shyu, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-27 20:00:33 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:

Description Qian Guo 2014-10-14 09:07:57 UTC
Description of problem:
During verifying bug 1061827, after live merging via qmp with option "backing-file", found hmp and qmp does not print right, it still prints the absolute path instead of relative

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.1.2-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create snapshots with Base->sn1->sn2->sn3:
qemu-img create -f qcow2 -b /home/nfs/rhel7u1cp1.qcow2 /home/sn1
qemu-img create -f qcow2 -b /home/sn1 /home/sn2
qemu-img create -f qcow2 -b /home/sn2 /home/sn3

2.Boot guest with /home/sn3:
/usr/libexec/qemu-kvm -device virtio-scsi-pci,bus=pci.0,addr=0x4,id=scsi0 -drive file=/home/sn3,if=none,id=drive-scsi0-0-0,media=disk,cache=none,format=qcow2,werror=stop,rerror=stop,aio=native -device scsi-hd,drive=drive-scsi0-0-0,bus=scsi0.0,scsi-id=0,lun=0,id=t -qmp unix:/tmp/q1,server,nowait -monitor stdio -nodefaults -nodefconfig

3.Check path before do live merge:
# qemu-img info sn3
image: sn3
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 196K
cluster_size: 65536
backing file: /home/sn2
Format specific information:
    compat: 1.1
    lazy refcounts: false

{ "execute": "query-block" }
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"backing-image": {"backing-image": {"backing-image": {"virtual-size": 53687091200, "filename": "/home/nfs/rhel7u1cp1.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 7207256064, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn1", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/nfs/rhel7u1cp1.qcow2", "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn2", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/sn1", "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn3", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/sn2", "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 3, "drv": "qcow2", "iops": 0, "bps_wr": 0, "backing_file": "/home/sn2", "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/home/sn3", "encryption_key_missing": false}, "type": "unknown"}]}

(qemu) info block
drive-scsi0-0-0: /home/sn3 (qcow2)
    Backing file:     /home/sn2 (chain depth: 3)
 
4.Do block-stream with absolute path of backing file:
{ "execute": "block-stream", "arguments": { "device": "drive-scsi0-0-0", "base": "/home/nfs/rhel7u1cp1.qcow2", "speed": 1000000000,  "backing-file": "/home/nfs/rhel7u1cp1.qcow2"} }

5.Then check as step3:
# qemu-img info sn3
image: sn3
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 196K
cluster_size: 65536
backing file: /home/nfs/rhel7u1cp1.qcow2   ------ absolute path
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false

(qemu) info block
drive-scsi0-0-0: /home/sn3 (qcow2)
    Backing file:     /home/nfs/rhel7u1cp1.qcow2 (chain depth: 1)  --- absolute 

{ "execute": "query-block" }
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"backing-image": {"virtual-size": 53687091200, "filename": "/home/nfs/rhel7u1cp1.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 7207256064, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn3", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/nfs/rhel7u1cp1.qcow2", "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "backing_file": "/home/nfs/rhel7u1cp1.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/home/sn3", "encryption_key_missing": false}, "type": "unknown"}]}



6. Do block-stream with relative path of backing file
{ "execute": "block-stream", "arguments": { "device": "drive-scsi0-0-0", "base": "/home/nfs/rhel7u1cp1.qcow2", "speed": 1000000000,  "backing-file": "./nfs/rhel7u1cp1.qcow2"} }

7.Then check as step3:
# qemu-img info sn3
image: sn3
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 196K
cluster_size: 65536
backing file: ./nfs/rhel7u1cp1.qcow2     -- relative 
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false


(qemu) info block
drive-scsi0-0-0: /home/sn3 (qcow2)
    Backing file:     /home/nfs/rhel7u1cp1.qcow2 (chain depth: 1)  -- absolute

{ "execute": "query-block" }
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"backing-image": {"virtual-size": 53687091200, "filename": "/home/nfs/rhel7u1cp1.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 7207256064, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn3", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/nfs/rhel7u1cp1.qcow2", "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "backing_file": "/home/nfs/rhel7u1cp1.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/home/sn3", "encryption_key_missing": false}, "type": "unknown"}]}


8.Do block-commit with absolute path of backing file
{ "execute": "block-commit", "arguments": { "device": "drive-scsi0-0-0", "base": "/home/nfs/rhel7u1cp1.qcow2", "top": "/home/sn2", "speed": 1000000000, "backing-file": "/home/nfs/rhel7u1cp1.qcow2"} }

9.Then check as step3:

# qemu-img info sn3
image: sn3
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 196K
cluster_size: 65536
backing file: /home/nfs/rhel7u1cp1.qcow2  -- absolute
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false

(qemu) info block
drive-scsi0-0-0: /home/sn3 (qcow2)
    Backing file:     /home/nfs/rhel7u1cp1.qcow2 (chain depth: 1) -- absolute

{ "execute": "query-block" }
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"backing-image": {"virtual-size": 53687091200, "filename": "/home/nfs/rhel7u1cp1.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 7207256064, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn3", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/nfs/rhel7u1cp1.qcow2", "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "backing_file": "/home/nfs/rhel7u1cp1.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/home/sn3", "encryption_key_missing": false}, "type": "unknown"}]}


10.Do block-commit with relative path of backing file

{ "execute": "block-commit", "arguments": { "device": "drive-scsi0-0-0", "base": "/home/nfs/rhel7u1cp1.qcow2", "top": "/home/sn2", "speed": 1000000000, "backing-file": "./nfs/rhel7u1cp1.qcow2"} }

11.Then check as step3:

# qemu-img info sn3
image: sn3
file format: qcow2
virtual size: 50G (53687091200 bytes)
disk size: 196K
cluster_size: 65536
backing file: ./nfs/rhel7u1cp1.qcow2     --- relative 
backing file format: qcow2
Format specific information:
    compat: 1.1
    lazy refcounts: false

(qemu) info block
drive-scsi0-0-0: /home/sn3 (qcow2)
    Backing file:     /home/nfs/rhel7u1cp1.qcow2 (chain depth: 1)   -- absolute 

{ "execute": "query-block" }
{"return": [{"io-status": "ok", "device": "drive-scsi0-0-0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image": {"backing-image": {"virtual-size": 53687091200, "filename": "/home/nfs/rhel7u1cp1.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": 7207256064, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "backing-filename-format": "qcow2", "virtual-size": 53687091200, "filename": "/home/sn3", "cluster-size": 65536, "format": "qcow2", "actual-size": 200704, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "backing-filename": "/home/nfs/rhel7u1cp1.qcow2", "dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "backing_file": "/home/nfs/rhel7u1cp1.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "file": "/home/sn3", "encryption_key_missing": false}, "type": "unknown"}


Actual results:
HMP and QMP prints absolute path and qemu-img info prints relative path of backing file after do live merge with relative path


Expected results:
HMP and QMP should prints relative path.

Additional info:

Comment 2 Jeff Cody 2014-11-25 19:06:28 UTC
Moving this to 7.2, as libvirt has the means now to specify a custom path for relative filename merges