Bug 1820040
| Summary: | 'device_add': cannot get SG_IO version number error when attach a scsi lun disk with encryption | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux Advanced Virtualization | Reporter: | Han Han <hhan> |
| Component: | libvirt | Assignee: | Peter Krempa <pkrempa> |
| Status: | CLOSED ERRATA | QA Contact: | gaojianan <jgao> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 8.4 | CC: | jdenemar, lmen, pkrempa, virt-maint, xuzhang |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.3 | Flags: | pm-rhel:
mirror+
|
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-6.4.0-1.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-11-17 17:47:42 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
Han Han
2020-04-02 06:46:16 UTC
The combination as mentioned above doesn't make sense. I agree that a better error should be reported. raw+slices and raw+copy_on_read also failed. Does scsi-block device only support to refer to a raw format blockdev node? For SG_IO to work you basically can't use any feature of the block layer since it's actually passthrough. In fact a better option would be to represent this as <hostdev> rather than disk. Fixed upstream: 5d72c3ce28 qemu: domain: Forbid slice/encryption/copy_on_read with disk type='lun' b40ec75296 qemu: Forbid non-raw images for disk type='lun' with vitio-blk frontend Verified on libvirt version:
libvirt-6.4.0-1.module+el8.3.0+6881+88468c00.x86_64
Scenario1: lun + luks
1.Prepare secret and luks format device
# qemu-img create -f luks --object secret,data=redhat,id=sec0 -o key-secret=sec0 /dev/sdd 5M
# virsh secret-define block-secret.xml
Secret f981dd17-143f-45bc-88e6-ed1fe20ce9da created
# MYSECRET=`printf %s "redhat" | base64`
# virsh secret-set-value f981dd17-143f-45bc-88e6-ed1fe20ce9da $MYSECRET
error: Passing secret value as command-line argument is insecure!
Secret value set
# virsh secret-list
UUID Usage
----------------------------------------------------------
f981dd17-143f-45bc-88e6-ed1fe20ce9da volume /dev/sdd
2.Start a guest and attach the device in lun type with luks
# virsh create avocado-vt-vm1.xml
Domain avocado-vt-vm1 created from avocado-vt-vm1.xml
# cat attach.xml
<disk type="block" device="lun">
<driver name="qemu" type="raw"/>
<source dev="/dev/sdd">
<encryption format="luks">
<secret type="passphrase" uuid="f981dd17-143f-45bc-88e6-ed1fe20ce9da"/>
</encryption>
</source>
<target dev="sdc" bus="scsi"/>
</disk>
# virsh attach-device avocado-vt-vm1 attach.xml
error: Failed to attach device from attach.xml
error: unsupported configuration: disk device 'lun' doesn't support encryption
Sc2:lun + slice
1.prepare attach device:
# cat attach.xml
<disk type="block" device="lun">
<driver name="qemu" type="raw"/>
<source dev="/dev/sdc">
<slices>
<slice type="storage" offset="0" size="104857600"/>
</slices>
</source>
<target dev="sdc" bus="scsi"/>
</disk>
2.Attach the device to guest
# virsh attach-device avocado-vt-vm1 attach.xml
error: Failed to attach device from attach.xml
error: unsupported configuration: disk device 'lun' doesn't support storage slice
Sc3:lun + copy_on_read
1.Prepare attach device xml:
# cat attach.xml
<disk type="block" device="lun">
<driver name="qemu" type="raw" copy_on_read="on"/>
<source dev="/dev/sdc">
</source>
<target dev="sdc" bus="scsi"/>
</disk>
2.Attach device to the guest
# virsh attach-device avocado-vt-vm1 attach.xml
error: Failed to attach device from attach.xml
error: unsupported configuration: copy_on_read is not compatible with 'lun' disk 'sdc'
Sc4:non-raw images for disk type='lun' with vitio-blk
# cat attach.xml
<disk type="block" device="lun">
<driver name="qemu" type="qcow2"/>
<source dev="/dev/sdc">
</source>
<target dev="vdc" bus="virtio"/>
</disk>
# virsh attach-device avocado-vt-vm1 attach.xml
error: Failed to attach device from attach.xml
error: unsupported configuration: disk device 'lun' must use 'raw' format
All works as expected,so verified
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 (virt:8.3 bug fix and enhancement update), 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://access.redhat.com/errata/RHBA-2020:5137 |