Bug 876024

Summary: fail to prompt 'No such file or directory' when create live snapshot to a non-existing block device
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Jeff Cody <jcody>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, areis, bcao, bsarathy, chayang, dyasny, juzhang, kwolf, michen, mkenneth, qzhang, shuang, virt-maint, xfu
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: 2012-11-27 16:13:02 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 Sibiao Luo 2012-11-13 05:13:22 UTC
Description of problem:
boot a guest with a data disk (lv block device), and create live snapshot to a unexisting block device, but fail to prompt 'No such file or directory'.
btw, if specify the local file, it can give the prompt correctly.

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm-rhev
2.6.32-340.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.334.el6.x86_64
guest info:
# uname -r
2.6.32-340.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot a guest with a data disk(lv block device).
# lvscan 
  ACTIVE            '/dev/vg_sluo_live_snapshot/lv-luo-live-snapshot-system' [10.00 GiB] inherit
  ACTIVE            '/dev/vg_sluo_live_snapshot/sluo-base' [2.00 GiB] inherit
eg:...-drive file=/dev/vg_sluo_live_snapshot/sluo-base,if=none,id=data-scsi-disk,format=qcow2,cache=none,werror=stop,rerror=stop -device virtio-scsi-pci,id=scsi1,addr=0x7 -device scsi-hd,scsi-id=0,lun=0,bus=scsi1.0,drive=data-scsi-disk,id=data-disk
2.make live snapshot with the data disk to a unexisting block device.
QMP monitor:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "data-scsi-disk", "snapshot-file": "/dev/vg_sluo_live_snapshot/test", "format": "qcow2" } }
HMP monitor:
(qemu) snapshot_blkdev data-scsi-disk /dev/vg_sluo_live_snapshot/test qcow2

Actual results:
after step 2,
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "data-scsi-disk", "snapshot-file": "/dev/vg_sluo_live_snapshot/test", "format": "qcow2" } }
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/dev/vg_sluo_live_snapshot/test': Invalid argument", "data": {"filename": "/dev/vg_sluo_live_snapshot/test", "__com.redhat_error_message": "Invalid argument"}}}
(qemu) snapshot_blkdev data-scsi-disk /dev/vg_sluo_live_snapshot/test qcow2
Formatting '/dev/vg_sluo_live_snapshot/test', fmt=qcow2 size=2147483648 backing_file='/dev/vg_sluo_live_snapshot/sluo-snap1' backing_fmt='qcow2' encryption=off cluster_size=65536 
Could not open '/dev/vg_sluo_live_snapshot/test': Invalid argument

Expected results:
it should prompt 'No such file or directory', like:
QMP monitor:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "data-scsi-disk", "snapshot-file": "/dev/vg_sluo_live_snapshot/test", "format": "qcow2" } }
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/dev/vg_sluo_live_snapshot/test': No such file or directory", "data": {"filename": "/dev/vg_sluo_live_snapshot/test", "__com.redhat_error_message": "No such file or directory"}}}
HMP monitor:
(qemu) snapshot_blkdev data-scsi-disk /dev/vg_sluo_live_snapshot/test qcow2
Formatting '/dev/vg_sluo_live_snapshot/test', fmt=qcow2 size=2147483648 backing_file='/dev/vg_sluo_live_snapshot/sluo-snap1' backing_fmt='qcow2' encryption=off cluster_size=65536 
/dev/vg_sluo_live_snapshot/test: error while creating qcow2: No such file or directory
Could not open '/dev/vg_sluo_live_snapshot/test': Invalid argument

Additional info:
btw, if specify the local file, it can give the prompt correctly.
QMP monitor:
{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "data-scsi-disk", "snapshot-file": "/test/sluo", "format": "qcow2" } }
{"error": {"class": "OpenFileFailed", "desc": "Could not open '/test/sluo': No such file or directory", "data": {"filename": "/test/sluo", "__com.redhat_error_message": "No such file or directory"}}} 
HMP monitor:
(qemu) snapshot_blkdev data-scsi-disk /test/sluo qcow2
Formatting '/test/sluo', fmt=qcow2 size=2147483648 backing_file='/dev/vg_sluo_live_snapshot/sluo-snap1' backing_fmt='qcow2' encryption=off cluster_size=65536 
/test/sluo: error while creating qcow2: No such file or directory
Could not open '/test/sluo': No such file or directory

Comment 2 Sibiao Luo 2012-11-16 02:36:19 UTC
(In reply to comment #0)
> Description of problem:
> boot a guest with a data disk (lv block device), and create live snapshot to
> a unexisting block device, but fail to prompt 'No such file or directory'.
> btw, if specify the local file, it can give the prompt correctly.
> 
> Expected results:
> it should prompt 'No such file or directory', like:
> QMP monitor:
> { "execute": "blockdev-snapshot-sync", "arguments": { "device":
> "data-scsi-disk", "snapshot-file": "/dev/vg_sluo_live_snapshot/test",
> "format": "qcow2" } }
> {"error": {"class": "OpenFileFailed", "desc": "Could not open
> '/dev/vg_sluo_live_snapshot/test': No such file or directory", "data":
> {"filename": "/dev/vg_sluo_live_snapshot/test",
> "__com.redhat_error_message": "No such file or directory"}}}

The most important thing to check is the more complete 'desc' key. It's very important that add the errno string (as returned by strerror()) and the errno value to OPenFileFailed's error message. please correct me if any error & thx.

Best Regards.
sluo

Comment 3 Jeff Cody 2012-11-27 16:13:02 UTC
I think this is a dupe of bug #877240

*** This bug has been marked as a duplicate of bug 877240 ***