Bug 1188463

Summary: When define/create two iscsi pools (one with IPv4 and the other with IPv6) libvirt doesn't check if their ipv4 and ipv6 addresses pointing to the same target.
Product: Red Hat Enterprise Linux 7 Reporter: yisun
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, jferlan, mzhan, rbalakri, xuzhang, yanyang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-12 20:25:22 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 yisun 2015-02-03 00:40:31 UTC
Description:
When define/create two iscsi pools (one with IPv4 and the other with IPv6) libvirt doesn't check if their ipv4 and ipv6 addresses pointing to the same target. 


Version-Release number of selected component (if applicable):
kernel-3.10.0-227.el7.x86_64
libvirt-1.2.8-16.el7.x86_64
qemu-kvm-rhev-2.1.2-23.el7.x86_64



How reproducible:
100%
steps:1
1. Prepare two hosts
    host A is iscsi target with IPv4 = 10.66.4.203
    host B is iscsi client with IPv4 = 10.66.4.206
 
2. On host A:
    2.1. Setup ipv6
#ifconfig eth0 inet6 add 3ffe::103/64        <== change eth0 to your working nic
     
    2.2 create image
#qemu-img create /home/disk1.img 10G
     
    2.3 modify iscsi target config file
#cat /etc/tgt/targets.conf
....
      <target lento.work.com:iscsi_enc>
           backing-store /home/disk1.img
      </target>
....
    
    2.4 restart tgt service
#service tgtd restart

3. On host B:
    3.1 setup ipv6
#ifconfig eth0 inet6 add 3ffe::104/64        <== change eth0 to your working nic
     
    3.2 Discover iscsi targets on host A
 # iscsiadm -t sendtargets -m discovery -p 10.66.4.203
         10.66.4.203:3260,1 lento.work.com:iscsi_enc
    
    3.3 prepare two pool xml files, one with host A's ipv4, the other with ipv6
#cat iscsi_pool_ipv4.xml
        <pool type='iscsi'>
          <name>iscsipool_ipv4</name>
          <uuid>b0eaf2c1-c239-1234-ba98-8ddf19f81234</uuid>
          <capacity unit='bytes'>4294967296</capacity>
          <allocation unit='bytes'>4294967296</allocation>
          <available unit='bytes'>0</available>
          <source>
            <host name='10.66.4.203' port='3260'/>
            <device path='lento.work.com:iscsi_enc'/>
          </source>
          <target>
            <path>/dev/disk/by-path</path>
            <permissions>
              <mode>0755</mode>
              <owner>0</owner>
              <group>0</group>
            </permissions>
          </target>
        </pool>
#cat iscsi_pool_ipv6.xml
        <pool type='iscsi'>
          <name>iscsipool_ipv6</name>
          <uuid>b0edf2c1-c239-4294-ba98-855f19f8bdd1</uuid>
          <capacity unit='bytes'>4294967296</capacity>
          <allocation unit='bytes'>4294967296</allocation>
          <available unit='bytes'>0</available>
          <source>
            <host name='3ffe::103' port='3260'/>
            <device path='lento.work.com:iscsi_enc'/>
          </source>
          <target>
            <path>/dev/disk/by-path</path>
            <permissions>
              <mode>0755</mode>
              <owner>0</owner>
              <group>0</group>
            </permissions>
          </target>
        </pool>

    3.4 Create pools from these xml files. 
# virsh pool-create iscsi_pool_ipv4.xml
Pool iscsipool_ipv4 created from iscsi_pool_ipv4.xml
# virsh pool-create iscsi_pool_ipv6.xml
Pool iscsdipool_ipv6 created from iscsi_pool_ipv6.xml
  
    3.5 Pools created successfully
# virsh pool-list
 Name                 State      Autostart
-------------------------------------------
 iscsipool_ipv6      active     no        
 iscsipool_ipv4       active     no 
 
    3.6 Check the pools vol-list info, they all have the same volume.
# virsh vol-list iscsipool_ipv6
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:0:1           /dev/disk/by-path/ip-10.66.4.203:3260-iscsi-lento.work.com:iscsi_enc-lun-1

# virsh vol-list iscsipool_ipv4
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:0:1           /dev/disk/by-path/ip-10.66.4.203:3260-iscsi-lento.work.com:iscsi_enc-lun-1

    3.7 Destroy these two pools
# virsh pool-destroy iscsipool_ipv4
Pool iscsipool_ipv4 destroyed

# virsh pool-destroy iscsipool_ipv6
error: Failed to destroy pool iscsdipool_ipv6
error: internal error: Child process (iscsiadm --mode node --portal '[3ffe::103]:3260,1' --targetname lento.work.com:iscsi_enc --logout) unexpected exit status 21: 2015-02-02 09:55:51.497+0000: 7101: debug : virFileClose:99 : Closed fd 26
2015-02-02 09:55:51.497+0000: 7101: debug : virFileClose:99 : Closed fd 28
2015-02-02 09:55:51.497+0000: 7101: debug : virFileClose:99 : Closed fd 23
iscsiadm: No matching sessions found


Expected Result:
The second pool creation/definition should be forbidden. 


Actually Result:
Both pools could be created/defined. This causes only one pool could be destroyed, to destroy the second pool will be failed. Workaround  is manually  "#iscsiadm --mode node --portal '[3ffe::103]:3260,1' --targetname lento.work.com:iscsi_enc --login", then the pool-destroy will take effect.


Additional Info:
According to bug https://bugzilla.redhat.com/show_bug.cgi?id=817219 It's not allowed to define two pools with one iscsi target. So we may need to check if the IPv4 and IPv6 pointing to the same host and forbid the second binding.

Comment 1 John Ferlan 2015-05-12 20:25:22 UTC

*** This bug has been marked as a duplicate of bug 1171984 ***