Bug 760547 - [RFE] specifying the entire image chain as a qemu drive (blockdev-add) (libvirt)
Summary: [RFE] specifying the entire image chain as a qemu drive (blockdev-add) (libvirt)
Keywords:
Status: ON_QA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: pre-dev-freeze
: 8.1
Assignee: Peter Krempa
QA Contact: Han Han
URL:
Whiteboard:
: 1534490 (view as bug list)
Depends On: 750801 1505701 1513543 1518738 1545155 1557995 1561960 1596511 1623986 1626061 1658981
Blocks: 1035038 1171569 1207659 1301026 1375855 1436245 1465810 1518998 1518999 1582202 1582249 1623877 1688814 1731522 1734975 1734976 773650 773651 773665 773677 773696 1306562 1406796 1406805 1445598 1541702 1631239 1636224
TreeView+ depends on / blocked
 
Reported: 2011-12-06 13:37 UTC by Dave Allan
Modified: 2020-02-21 08:05 UTC (History)
37 users (show)

Fixed In Version: libvirt-5.10.0-1.el8
Doc Type: Enhancement
Doc Text:
Clone Of: 750801
Environment:
Last Closed:
Type: Feature Request
Target Upstream Version:


Attachments (Terms of Use)
The libvirtd log of comment 30 (261.50 KB, text/plain)
2018-08-10 06:14 UTC, Han Han
no flags Details
The xml and script in comment41 (1.49 KB, application/x-gzip)
2018-08-31 06:55 UTC, Han Han
no flags Details

Comment 5 Eric Blake 2012-02-18 17:55:48 UTC
Live snapshot and block pull also need to interact with an explicit backing file chain notation in the domain XML.  My current solution for block pull (see bug 638506) is currently quite weak, relying on the user to pass in a correct name; but if libvirt were properly tracking the backing chain, then libvirt could validate that the user is actually passing in a valid name.

Comment 21 Peter Krempa 2018-01-22 08:46:10 UTC
*** Bug 1534490 has been marked as a duplicate of this bug. ***

Comment 31 Han Han 2018-08-10 06:14:01 UTC
Created attachment 1474884 [details]
The libvirtd log of comment 30

After the eject failure, the media is still in the xml:
# virsh dumpxml A|awk '/<disk/,/<\/disk/'          
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/Fedora.iso' index='1'/>
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <readonly/>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

And the cdrom media could be found in VM.

Comment 40 Han Han 2018-08-31 02:04:12 UTC
> But the domblkinfo Physical value is equal to the virtual size of qcow2.

Sorry in comment38 and comment39. It should be 'NOT equal to' there. Because the physical size from domblkinfo is 10737418240 while the virtual size from qcow2 file is 9663676416.

Comment 41 Han Han 2018-08-31 06:50:20 UTC
Update the testing of various backends of cdrom update:
Version: libvirt-4.5.0-7.el7_rc.0518ef33a7.x86_64 qemu-kvm-rhev-2.12.0-11.el7.x86_64
I. Test cdrom live insert 
1. Start a VM with empty cdrom:
...
    <disk type='file' device='cdrom'>                                                                                                                              
      <driver name='qemu' type='raw'/>
      <source index='1'/>
      <target dev='sdb' bus='scsi'/>
      <readonly/>
      <alias name='ua-cdrom'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
...

2. Try to update instert iso from various backends: file,luks,block,gluster,iscsi,rbd,https,nbd

for i in file-file.xml file-luks.xml network-gluster.xml network-iscsi.xml network-rbd.xml network-https.xml network-nbd.xml;do
    virsh update-device $VM $i
    virsh dumpxml $VM|awk '/<disk/,/<\/disk/'
done

But get error from all the backends:
error: Failed to update device from file-file.xml
error: internal error: argument key 'id' must not have null value


II. Try to update media:
1. Start a VM with file backend cdrom media:
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/boot.iso'/>
      <target dev='sdb' bus='scsi'/>
      <readonly/>
      <alias name='ua-cdrom'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

2. Update the media to different backends:
for i in file-luks.xml block-block.xml network-gluster.xml network-iscsi.xml network-rbd.xml network-https.xml network-nbd.xml;do
    virsh update-device $VM $i
    virsh dumpxml $VM|awk '/<disk/,/<\/disk/'
done

Get error from all backends:
error: Failed to complete action eject on media
error: internal error: argument key 'id' must not have null value

III. Eject the media from different backends:
1. Prepare the empty cdrom xml
# cat file-empty.xml 
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='sdb' bus='scsi'/>
      <readonly/>
      <alias name='ua-cdrom'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

2. Run following script:
for i in file-file.xml file-luks.xml block-block.xml network-gluster.xml network-iscsi.xml network-rbd.xml network-https.xml network-nbd.xml;do
    virsh update-device $VM $i --config
    virsh start $VM && sleep 50
    virsh update-device $VM $EMPTY
    virsh destroy $VM
done

Get the error above, too.
error: Failed to update device from file-empty.xml
error: internal error: argument key 'id' must not have null value

Comment 42 Han Han 2018-08-31 06:55:27 UTC
Created attachment 1479976 [details]
The xml and script in comment41

Here are the XMLs and scripts of updating cdrom. You can run ./run.sh to reproduce the issues in comment41.

Comment 46 Jaroslav Suchanek 2018-09-25 08:02:47 UTC
From usptream perspective following missing pieces needs to done
* handling of block jobs events
* execute modification of backing chain when event is populated
* create snapshots, blockdev-create is already done
* ...
* and finally switch on the blockdev-add

Comment 47 Jaroslav Suchanek 2018-12-14 21:55:35 UTC
Blockjob data storing and handling of blockjob events refactoring is done in this upstream patches:
https://www.redhat.com/archives/libvir-list/2018-December/msg00319.html

This is one of the major prerequisite for enabling blockdev-add support in libvirt.

Comment 53 Peter Krempa 2019-11-27 09:25:47 UTC
commit c6a9e54ce3252196f1fc6aa9e57537a659646d18
Author: Peter Krempa <pkrempa@redhat.com>
Date:   Mon Jan 7 11:45:19 2019 +0100

    qemu: enable blockdev support

    Now that all pieces are in place (hopefully) let's enable -blockdev.

    We base the capability on presence of the fix for 'auto-read-only' on
    files so that blockdev works properly, mandate that qemu supports
    explicit SCSI id strings to avoid ABI regression and that the fix for
    'savevm' is present so that internal snapshots work.

v5.9.0-390-gc6a9e54ce3

This requires upstream qemu-4.2 or appropriate downstream.

Note that there are hundreds commits which implement various bits needed for this feature which are not isted here.


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