Bug 1247898

Summary: qmp and qemu have different result when eject and change cdrom under the locked cdrom situation
Product: Red Hat Enterprise Linux 7 Reporter: Shuang Yu <shuyu>
Component: qemu-kvm-rhevAssignee: John Snow <jsnow>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: dgibson, huding, juzhang, knoel, michen, qzhang, shuyu, virt-maint, xfu, xuhan, zhengtli
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-07 16:43:59 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 Shuang Yu 2015-07-29 08:04:25 UTC
Description of problem:
when the cdrom is locked in the guest,the qmp command cannot eject and change the cdrom with the error "Device XX is locked",but the qemu command can eject and change the cdrom successful.

Version-Release number of selected component (if applicable):
ernel-3.10.0-292.el7.ppc64le
qemu-kvm-rhev-2.3.0-12.el7.ppc64le

guest kernel:
kernel-3.10.0-295.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:

1.Boot the guest with the cdrom:

/usr/libexec/qemu-kvm...-device virtio-scsi-pci,id=scsi0,addr=0x6,bus=pci.0 -drive file=test_27.raw,if=none,id=drive-scsi0,format=raw,cache=none -device scsi-hd,bus=scsi0.0,drive=drive-scsi0,bootindex=0,id=scsi0-0 -drive file=RHEL-7.2-20150720.0-Server-ppc64-dvd1.iso,if=none,media=cdrom,id=drive-scsi1,format=raw -device scsi-cd,drive=drive-scsi1,id=scsi0-1,bus=scsi0.0 ...-qmp tcp:0:4666,server,nowait

2.(qemu) info block 

3.(qmp){"execute":"eject","arguments":{"device":"drive-scsi1"}}

4.(qemu) info block 

5.(qemu) eject drive-scsi1

6.(qemu) info block

7.reboot the guest with the cdrom,cmd same as step1

8.(qemu) info block

9.(qmp){"execute":"change","arguments":{"device":"drive-scsi1","target":"RHEL-7.2-20150708.1-Server-ppc64-dvd1.iso"}}

10.(qemu) info block 

11.(qemu) change drive-scsi1 RHEL-7.2-20150708.1-Server-ppc64-dvd1.iso

12.(qemu) info block

Actual results:

After step3:
{"error": {"class": "GenericError", "desc": "Device 'drive-scsi1' is locked"}}

After step4:
the cdrom is not eject successful

After step5:
the cdrom is eject successful

After step9:
{"error": {"class": "GenericError", "desc": "Device 'drive-scsi1' is locked"}}

After step10:
the cdrom is not changed successful

After step11:
the cdrom is changed successful

Expected results:
the qmp command and the qemu command have the same result.

Additional info:

After step 2:
(qemu) info block
drive-scsi0: test_27.raw (raw)
    Cache mode:       writeback, direct

drive-scsi1: RHEL-7.2-20150720.0-Server-ppc64-dvd1.iso (raw, read-only)
    Removable device: locked, tray closed
    Cache mode:       writeback

floppy0: [not inserted]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed



After step4,the result is same as step2



After step6:
(qemu) info block
drive-scsi0: test_27.raw (raw)
    Cache mode:       writeback, direct

drive-scsi1: [not inserted]
    Removable device: locked, tray open

floppy0: [not inserted]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed

After step8 and step10,the result same as step2

After step12:
(qemu) info block
drive-scsi0: test_27.raw (raw)
    Cache mode:       writeback, direct

drive-scsi1: RHEL-7.2-20150708.1-Server-ppc64-dvd1.iso (raw, read-only)
    Removable device: locked, tray closed
    Cache mode:       writethrough

floppy0: [not inserted]
    Removable device: not locked, tray closed

sd0: [not inserted]
    Removable device: not locked, tray closed

Comment 2 Shuang Yu 2015-07-31 06:34:50 UTC
Retest this problem on the x86 platform and hit the same issue.


Version-Release number of selected component (if applicable):
qemu-kvm-rhev-0.12.1.2-2.479.el6.x86_64
kernel-2.6.32-567.el6.x86_64

guest kernel:
kernel-3.10.0-295.el7.x86_64

Comment 3 David Gibson 2015-07-31 07:17:35 UTC
Re-assigning to the general pool - I have enough ppc specific bugs to deal with at the moment.

Comment 4 Ademar Reis 2015-08-07 16:43:59 UTC
Closing as WONTFIX. HMP is not supported and the behavior from QMP looks correct.