Bug 1477880 - can't use default LUN of iscsi protocol used in network type virtual disk when don't specify the LUN
can't use default LUN of iscsi protocol used in network type virtual disk whe...
Status: ON_QA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.4
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: John Ferlan
Meina Li
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-03 02:53 EDT by Meina Li
Modified: 2017-10-10 04:09 EDT (History)
5 users (show)

See Also:
Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: No Doc Update
Doc Text:
undefined
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 Meina Li 2017-08-03 02:53:34 EDT
Description of problem:
can't use default LUN of iscsi protocol used in network type virtual disk when don't specify the LUN, which don't match our documentation that indicate "The above page indicate some points:For "iscsi" (since 1.0.4), the name attribute may include a logical unit number, separated from the target's name by a slash (e.g.,iqn.2013-07.com.example:iscsi-pool/1). If not specified, the default LUN is zero" in http://libvirt.org/formatdomain.html#elementsDisks.

Version-Release number of selected component (if applicable):
libvirt-3.2.0-14.virtcov.el7_4.2.x86_64
kernel-3.10.0-693.el7.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.3.x86_64

How reproducible:
100%

Steps to Reproduce:
1. On the iscsi-initiator machine, define and start a guest.

2.Attach a iscsi network disk with xml below:
#more iscsi.xml
<disk type='network' device='disk'>
<driver name="qemu" type="raw"/>
<source protocol="iscsi" name="iqn.2013-10.com.example:iscsi/0">
<host name="10.66.4.164" port="3260"/>
</source>
<target dev="vdb" bus="virtio"/>
</disk>
# virsh attach-device r7-qcow2 iscsi.xml
Device attached successfully
# virsh detach-device r7-qcow2 iscsi.xml
Device detached successfull

3.Modify iscsi.xml and ttach a iscsi network disk with xml below:
#more iscsi.xml
<disk type='network' device='disk'>
<driver name="qemu" type="raw"/>
<source protocol="iscsi" name="iqn.2013-10.com.example:iscsi">
<host name="10.66.4.164" port="3260"/>
</source>
<target dev="vdb" bus="virtio"/>
</disk>
# virsh attach-device r7-qcow2 iscsi.xml
error: Failed to attach device from iscsi.xml
error: internal error: unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk1' could not be initialized

Actual results:
step3:
# virsh attach-device r7-qcow2 iscsi.xml
error: Failed to attach device from iscsi.xml
error: internal error: unable to execute QEMU command '__com.redhat_drive_add': Device 'drive-virtio-disk1' could not be initialized

Expected results:
step3:
# virsh attach-device r7-qcow2 iscsi.xml
Device attached successfully

Additional info:
http://libvirt.org/formatdomain.html#elementsDisks: For "iscsi" (since 1.0.4), the name attribute may include a logical unit number, separated from the target's name by a slash (e.g.,iqn.2013-07.com.example:iscsi-pool/1). If not specified, the default LUN is zero
Comment 2 yisun 2017-08-03 23:25:38 EDT
not related to npiv, remove it from white board key word
Comment 3 John Ferlan 2017-09-06 12:09:39 EDT
Strange this was never checked before - sometimes the power of the documentation does make believers.  In any case, posted the following patch upstream to resolve:

https://www.redhat.com/archives/libvir-list/2017-September/msg00122.html
Comment 4 John Ferlan 2017-09-11 19:28:05 EDT
First patch had negative review, so v2 was generated:

https://www.redhat.com/archives/libvir-list/2017-September/msg00248.html

Primary difference is the XML is adjusted during post parse processing rather than during command creation. This results in a change to the output XML as well.

Since QEMU didn't really support a non-supplied value, this should be fine.
Comment 5 John Ferlan 2017-09-12 10:50:36 EDT
Patch has been pushed:

commit f64f03b5b1e6f3ecd6c6d79316c3efedc00c2167
Author: John Ferlan <jferlan@redhat.com>
Date:   Mon Sep 11 19:18:21 2017 -0400

    qemu: Provide default LUN=0 for iSCSI if not provided
    
...
    
    If the "/#" is missing from the provided iSCSI path, then we need
    to provide the default LUN of /0; otherwise, QEMU will fail to parse
    the URL causing a failure to either create the guest or hotplug
    attach the storage.
    
    During post parse, for any iSCSI disk or hostdev, scan the source
    path looking for the presence of '/', if found, then we can assume
    the LUN is provided.  If not found, alter the input XML to add the
    "/0".  This will cause the generated XML to have the generated
    value when the domain config is saved after post parse.

$ git describe f64f03b5b1e6f3ecd6c6d79316c3efedc00c2167
v3.7.0-52-gf64f03b5b
$

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