Bug 1463168 - can't update the cdrom after ejecting cdrom in the guest and then doing save/restore operation
can't update the cdrom after ejecting cdrom in the guest and then doing save/...
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
medium Severity medium
: rc
: ---
Assigned To: Peter Krempa
lijuan men
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-20 05:52 EDT by lijuan men
Modified: 2017-10-10 04:08 EDT (History)
4 users (show)

See Also:
Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description lijuan men 2017-06-20 05:52:27 EDT
Description of problem:
can't update the cdrom after ejecting cdrom in the guest and then doing save/restore operation

Version-Release number of selected component (if applicable):
libvirt-3.2.0-10.el7.x86_64
qemu-kvm-rhev-2.9.0-12.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1.start a guest with cdrom:
 <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/rhel7.3.iso'/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
[root@lmen1 ~]# virsh start test
Domain test started


2.eject the iso file in the guest
in the guest,run the command:
#eject /dev/sr0

3.save and restore the guest

[root@lmen1 ~]# virsh save test /tmp/save
Domain test saved to /tmp/save

[root@lmen1 ~]# virsh restore /tmp/save
Domain restored from /tmp/save

[root@lmen1 ~]# virsh dumpxml test
...
 <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <backingStore/>
      <target dev='sda' bus='scsi'/>
      <readonly/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...

4.use change-media to update iso file
[root@lmen1 ~]# virsh domblklist test
Target     Source
------------------------------------------------
vda        /var/lib/libvirt/images/uefi.qcow2
sda        -

[root@lmen1 ~]# virsh change-media test sda /var/lib/libvirt/images/rhel7.3.iso --update
error: Failed to complete action update on media
error: internal error: timed out waiting for disk tray status update


Actual results:
failed to update

Expected results:
update successfully

Additional info:
If I migrate the guest after  ejecting cdrom in the guest,the cdrom can not be updated too.
Comment 2 Peter Krempa 2017-09-27 05:40:31 EDT
Fixed upstream:

commit 4b480d10768c7a288c10e2e39f6a2bf275a0eb69 
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Sep 25 16:16:08 2017 +0200

    qemu: process: Refresh data from qemu monitor after migration
    
    Some values we read from the qemu monitor may be changed with the actual
    state by the incoming migration. This means that we should refresh
    certain things only after the migration has finished.
    
    This is mostly visible in the cdrom tray state, which is by default
    closed but may be opened by the guest OS. This would be refreshed before
    qemu transferred the actual state and thus libvirt would think that the
    tray is closed.
    
    Note that this patch moves only a few obvious query commands. Others may
    be moved later after individual assessment.

Note You need to log in before you can comment on or make changes to this bug.