Bug 1086121

Summary: Improve the error message when failed to restore a guest with a not availabe disk with startupPolicy='optional'
Product: Red Hat Enterprise Linux 7 Reporter: chhu
Component: libvirtAssignee: Pavel Hrdina <phrdina>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: ajia, dyuan, mzhan, pzhang, rbalakri, shyu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.7-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:31:58 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 chhu 2014-04-10 07:22:06 UTC
Description:
The error message should be improved when failed to restore a guest with a not availabe disk with startupPolicy='optional'

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7.x86_64
qemu-kvm-rhev-1.5.3-55.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1. define and start a guest with disk with startupPolicy='optional'
# virsh define r7.xml
Domain r7 defined from r7.xml
# virsh start r7
Domain r7 started
# virsh dumpxml r7| grep disk -A 7
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/r7.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/test.img' startupPolicy='optional'/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>

2. move the disk which is with startupPolicy='optional'
# mv test.img /tmp/

3. save the guest successfully
# virsh save r7 r7.save
Domain r7 saved to r7.save

4. try to restore the guest failed
# virsh restore r7.save
error: Failed to restore domain from r7.save
error: internal error: early end of file from monitor: possible problem:
red_dispatcher_loadvm_commands:
Unknown savevm section or instance '0000:00:08.0/virtio-blk' 0
load of migration failed

Actual results:
In step4: restore the guest failed.

Expected results:
In step4: the guest is restored successfully without the not existed disk or the error message should be improved.

Comment 2 Pavel Hrdina 2014-07-02 14:37:14 UTC
commit 5098f671f0dfaddb8788a959906c47b0cb4c87cc
Author: Pavel Hrdina <phrdina>
Date:   Fri Jun 27 16:34:07 2014 +0200

    qemu_domain: fix startup policy for disks
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1086121
    
    We now support startupPolicy='optional' for disks, but this
    should work only for cold boot, not for restore or migrate.
    
    Signed-off-by: Pavel Hrdina <phrdina>

Comment 4 Pei Zhang 2014-10-31 10:11:59 UTC
verify vision:
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-4.el7.x86_64
kernel-3.10.0-191.el7.x86_64

steps:

1.
define and start a guest with one disk with startupPolicy='optional'

# virsh destroy r7new ; virsh start r7new
Domain r7new destroyed

Domain r7new started

# virsh dumpxml r7new | grep disk -A8
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/r7new.img'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/qcow2-1.img' startupPolicy='optional'/>  ------>optional
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

2. move the disk which is with startupPolicy='optional'
# mv qcow2-1.img qcow2-1.img.bak

3. save the guest

# virsh save r7new r7new.save

Domain r7new saved to r7new.save

4.try to restore the guest

# virsh restore r7new.save
error: Failed to restore domain from r7new.save
error: Cannot access storage file '/var/lib/libvirt/images/qcow2-1.img' (as uid:107, gid:107): No such file or directory

it has a clear error message.
verified.

Comment 5 Pei Zhang 2014-11-04 05:42:21 UTC
add verify scenario:
version:
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-5.el7.x86_64
kernel-3.10.0-196.el7.x86_64

steps:

1> test disk with startupPolicy='optional' for cold boot
1.1>
start a healthy guest with one disk with startupPolicy='optional':

# virsh dumpxml r7new | grep disk -A 8
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/r7new.img'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/qcow2-2.img' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

1.2> move the disk which is with startupPolicy='optional'
# mv qcow2-2.img qcow2-2.img.bak
# ll /var/lib/libvirt/images/qcow2-2.img
ls: cannot access /var/lib/libvirt/images/qcow2-2.img: No such file or directory

1.3>try to cold boot ,disk device with startupPolicy='optional' will be removed. and boot up successfully.
# virsh destroy r7new ; virsh start r7new
Domain r7new destroyed

Domain r7new started

# virsh dumpxml r7new | grep disk -A 8
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/var/lib/libvirt/images/r7new.img'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

2> test cdrom device for save / restore
2.1> start a healthy guest with cdrom device with startupPolicy='optional':
# virsh dumpxml r7new | grep cdrom -A 8

    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/cdrom.iso' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
2.2> move the cdrom  file away 
# mv cdrom.iso cdrom.iso.bak
# ll /var/lib/libvirt/images/cdrom.iso
ls: cannot access /var/lib/libvirt/images/cdrom.iso: No such file or directory

2.3>save the guest successfully 
# virsh save r7new r7new.save

Domain r7new saved to r7new.save

2.4> restore the guest successfully
# virsh restore r7new.save
Domain restored from r7new.save

# virsh dumpxml r7new | grep cdrom -A 8
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

3> test cdrom device for code boot
3.1> start a healthy guest with cdrom device with startupPolicy='optional':
# virsh dumpxml r7new | grep cdrom -A 8
   
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/cdrom.iso' startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
3.2>move the cdrom file away 
# mv cdrom.iso cdrom.iso.bak
# ll /var/lib/libvirt/images/cdrom.iso
ls: cannot access /var/lib/libvirt/images/cdrom.iso: No such file or directory

3.3> try to cold boot , boot up successfully
# virsh destroy r7new ; virsh start r7new
Domain r7new destroyed

Domain r7new started

# virsh dumpxml r7new | grep cdrom -A 8
  
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>


4> test  floppy device for save / restore
4.1> start a healthy guest with floppy device with startupPolicy='optional':
# virsh dumpxml r7new | grep floppy -A 8

    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/floppy.img' startupPolicy='optional'/>
      <backingStore/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
   
4.2>move the floppy file away 
# mv floppy.img floppy.img.bak
# ll /var/lib/libvirt/images/floppy.img
ls: cannot access /var/lib/libvirt/images/floppy.img: No such file or directory

4.3>save the guest successfully 
# virsh save r7new r7new.save

Domain r7new saved to r7new.save

4.4>restore the guest successfully 
# virsh restore r7new.save
Domain restored from r7new.save

# virsh dumpxml r7new | grep floppy -A 8
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

5> test floppy device for cold boot
5.1> start a healthy guest with floppy device with startupPolicy='optional':
# virsh dumpxml r7new | grep floppy -A 8

    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/floppy.img' startupPolicy='optional'/>
      <backingStore/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
   
5.2>move the floppy file away 
# mv floppy.img floppy.img.bak
# ll /var/lib/libvirt/images/floppy.img
ls: cannot access /var/lib/libvirt/images/floppy.img: No such file or directory

5.3> try to cold boot , boot up successfully.
# virsh destroy r7new ; virsh start r7new
Domain r7new destroyed

Domain r7new started

# virsh dumpxml r7new | grep floppy -A 8
  
    <disk type='file' device='floppy'>
      <driver name='qemu' type='raw'/>
      <source startupPolicy='optional'/>
      <backingStore/>
      <target dev='fda' bus='fdc'/>
      <alias name='fdc0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

Comment 7 errata-xmlrpc 2015-03-05 07:31:58 UTC
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://rhn.redhat.com/errata/RHSA-2015-0323.html