Bug 1228007 - Using virsh attach-device fail to hotplug iscsi or fc lun volume with --config/--persistent option
Summary: Using virsh attach-device fail to hotplug iscsi or fc lun volume with --confi...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1230179 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-04 04:45 UTC by Pei Zhang
Modified: 2020-03-13 20:57 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.17-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:40:06 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Pei Zhang 2015-06-04 04:45:05 UTC
Description of problem:

Although info in libvirt.org said that Using "lun" (since 0.9.10) is only valid when type is "block" or "network" using the iSCSI protocol . But the volume in iscsi pool is also a lun device , so it should support .Now domain will start successfully with iscsi volume + lun + host mode  and for running guest can hotplug successfully with --live but fail with --config/--persistent

Version-Release number of selected component (if applicable):
libvirt-1.2.15-2.el7.x86_64
qemu-kvm-rhev-2.3.0-1.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
Please ignore virt-xml-validate because bug 1210669

Prepare a active iscsi pool with volume in it .
# virsh vol-list iscsi-pool --details
 Name        Path                                                           Type    Capacity  Allocation
-----------------------------------------------------------------------------------------------------------------------------
 unit:0:0:1  /dev/disk/by-path/$ip:3260-iscsi-iqn.5.165:server.target1-lun-1  block  60.00 GiB   60.00 GiB

1.start guest with iscsi volume + lun + host mode
 <disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sdf' bus='scsi'/>
      <alias name='scsi0-0-0-5'/>
      <address type='drive' controller='0' bus='0' target='0' unit='5'/>
    </disk>

# virsh start r72
Domain r72 started

and device can be checked in guest .

2.start a healthy guest hot plug a disk with iscsi volume + lun + host mode .disk attached successfully and can be checked in guest .
# cat iscsi-vol.xml
<disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
    </disk>
# virsh attach-device r72 iscsi-vol.xml
Device attached successfully

# virsh dumpxml r72 | grep disk -A 9
  
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/r7.2.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
      <alias name='scsi0-0-0-4'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>

3.start a healthy guest hot plug a disk using iscsi volume + lun + host mode with --config/--persistent
# cat iscsi-vol.xml
<disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
    </disk>

# virsh attach-device r72 iscsi-vol.xml --persistent
error: Failed to attach device from iscsi-vol.xml
error: unsupported configuration: disk device='lun' is only valid for block type disk source

# virsh attach-device r72 iscsi-vol.xml --config
error: Failed to attach device from iscsi-vol.xml
error: unsupported configuration: disk device='lun' is only valid for block type disk source

# virsh attach-device r72 iscsi-vol.xml --live
Device attached successfully


Actual results:
As step3 , hotplug successfully with --live , fail with --persistent / --config

Expected results:
It's kind of confusing for lun device. If volume+lun is not supported, it
should provide an error when attempting to start that guest. If it is
supported, hotpulg should work fine and doc should be improved. 

Additional info:

Comment 1 John Ferlan 2015-06-11 21:16:20 UTC
Ahh... this is because the config/persistent path didn't translate the source pool for the config/persistent path...

Sent patch upstream:

http://www.redhat.com/archives/libvir-list/2015-June/msg00555.html

Comment 2 John Ferlan 2015-06-12 16:29:51 UTC
Patch has been pushed upstream:

$ commit 785a8940eff01223fc813abaaf331c8a8225ec0c
Author: John Ferlan <jferlan@redhat.com>
Date:   Thu Jun 11 17:07:38 2015 -0400

    scsi: Need to translate disk source pool in config attach path

    When attaching a scsi volume lun via the attach-device --config or
    --persistent options, there was no translation of the source pool
    like there was for the live path, thus the attempt to modify the config
    would fail since not enough was known about the disk.

$ git describe 785a8940eff01223fc813abaaf331c8a8225ec0c
v1.2.16-144-g785a894
$

Comment 4 Pei Zhang 2015-08-19 07:12:24 UTC
Verify version:
libvirt-1.2.17-5.el7.x86_64
qemu-kvm-rhev-2.3.0-18.el7.x86_64

verify steps:

1.check document.
# firefox /usr/share/doc/libvirt-docs-1.2.17/html/formatdomain.html
check 
source --> volume :
Using a LUN from an iSCSI source pool provides the same features as a disk configured using type 'block' or 'network and device of 'lun' with respect to how the LUN is presented to and may used by the guest. 


For iscsi pool :
2. Using virsh attach-device to hotplug iscsi or fc lun volume with --config/--persistent option

prepare a iscsi pool and a healthy domain.

# virsh vol-list   iscsi-pool
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:0:1           /dev/disk/by-path/ip-&IP:3260-iscsi-iqn.2008-09.5.165.3ffe.104:server.target3-lun-1

# cat vol-lun-scsi-host.xml 
<disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
    </disk>

2.1 attach volume lun disk with --persistent option.

# virsh attach-device r720 vol-lun-scsi-host.xml --persistent
Device attached successfully

# virsh dumpxml r720| grep disk -A 9
   ......
    <disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
      <alias name='scsi0-0-0-4'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>
......

login guest to check , the disk can be found in guest.

detach-device to hotunplug it.

# virsh detach-device r720 vol-lun-scsi-host.xml --persistent
Device detached successfully

2.2 attach volume lun disk with --config option.

# virsh attach-device r720 vol-lun-scsi-host.xml --config
Device attached successfully

# virsh destroy r720;virsh start r720
Domain r720 destroyed

Domain r720 started

# virsh dumpxml r720| grep disk -A 9
   
    <disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
      <alias name='scsi0-0-0-4'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>

login guest to check , the disk can be found in guest.


3.domain xml validate
# virsh dumpxml r720 --inactive > r7new.xml
# cat r7new.xml |grep disk -A 9
    <disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='iscsi-pool' volume='unit:0:0:1' mode='host'/>
      <target dev='sde' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='4'/>
    </disk>

# virt-xml-validate r7new.xml 
r7new.xml validates

4.For FC pool 
prepare a FC pool
# virsh vol-list scsi5_pool 
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:3:0           /dev/disk/by-id/wwn-0x600a0b80005adb0b0000ab2d4cae9254


# cat vol-lun-scsi.xml 
<disk type='volume' device='lun'>
      <driver name='qemu' type='raw'/>
      <source pool='scsi5_pool' volume='unit:0:3:0'/>
      <backingStore/>
      <target dev='sde' bus='scsi'/>
    </disk>

# virsh attach-device r7-zp vol-lun-scsi.xml --persistent
Device attached successfully

login guest to check

# virsh attach-device r7-zp vol-lun-scsi.xml --config
Device attached successfully

# virsh destroy r7-zp;virsh start r7-zp
Domain r7-zp destroyed

Domain r7-zp started

login guest to check

As above, move to verified.

Comment 5 John Ferlan 2015-09-18 17:12:22 UTC
*** Bug 1230179 has been marked as a duplicate of this bug. ***

Comment 6 John Ferlan 2015-11-11 17:08:45 UTC
*** Bug 1230179 has been marked as a duplicate of this bug. ***

Comment 8 errata-xmlrpc 2015-11-19 06:40:06 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/RHBA-2015-2202.html


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