Bug 1232606 - Libvirt should forbid to create duplicate mpath pool
Summary: Libvirt should forbid to create duplicate mpath pool
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:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-17 07:10 UTC by Pei Zhang
Modified: 2015-11-19 06:41 UTC (History)
6 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:41:25 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-17 07:10:43 UTC
Description of problem:
For mpath pool , libvirt ignore the target.path value and provides it's own based on what's shown in the output when the pool is running.
But I think it's better to change the target.path to where the pool is running and add target.path check if user want to create another mpath pool.

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

How reproducible:
100%

Steps to Reproduce:

1.define and start a mpath pool

# virsh pool-dumpxml  mpath1
<pool type='mpath'>
  <name>mpath1</name>
  <uuid>46920cb4-98e5-484f-a4e8-62582ed376da</uuid>
  <capacity unit='bytes'>32218696704</capacity>
  <allocation unit='bytes'>32218696704</allocation>
  <available unit='bytes'>0</available>
  <source>
  </source>
  <target>
    <path>/dev/by-path</path>
  </target>
</pool>

2.Check volume in mpath pool , it is always created in /dev/mapper
# virsh vol-list  mpath1
 Name                 Path                                    
------------------------------------------------------------------------------
 dm-3                 /dev/mapper/3600a0b80005adb0b0000ab2d4cae9254
 dm-9                 /dev/mapper/3600a0b80005ad1d700002ddc4fa32c87

3.create another mpath pool
# virsh pool-dumpxml mpath2
<pool type='mpath'>
  <name>mpath2</name>
  <uuid>e405f824-d057-4b38-aa95-16d8d22d7176</uuid>
  <capacity unit='bytes'>32218696704</capacity>
  <allocation unit='bytes'>32218696704</allocation>
  <available unit='bytes'>0</available>
  <source>
  </source>
  <target>
    <path>/dev/mpath</path>
  </target>
</pool>

# virsh vol-list mpath2
 Name                 Path                                    
------------------------------------------------------------------------------
 dm-3                 /dev/mapper/3600a0b80005adb0b0000ab2d4cae9254
 dm-9                 /dev/mapper/3600a0b80005ad1d700002ddc4fa32c87

4.using vol-pool to find pool
# virsh pool-list
 Name                 State      Autostart
-------------------------------------------
 mpath1               active     no        
 mpath2               active     no  

# virsh vol-pool /dev/mapper/3600a0b80005adb0b0000ab2d4cae9254
mpath1


Actual results:
As step 2 , the vol-path is where the pool is running not what I defined .
As step 3 , I can create another mpath pool .

Expected results:
Give the correct path where the pool is running and libvirt should forbid uesr to create another mpath pool .

Additional info:
If I want to define another dir pool using the same target as default pool , it will give error :
# cat dir-pool.xml
<pool type='dir'>
  <name>dir-pool</name>
  <source>
  </source>
  <target>
    <path>/var/lib/libvirt/images</path>
  </target>
</pool>
# virsh pool-define dir-pool.xml
error: Failed to define pool from dir-pool.xml
error: operation failed: Storage source conflict with pool: 'default'

That because for dir pool libvirt will check if there is a pool already using the target.path .
So I think that for mpath pool , libvirt should also check target.path and using the target path to judge that if the new pool user want to create is duplicate .

Comment 1 John Ferlan 2015-06-24 13:09:35 UTC
According to http://libvirt.org/storage.html#StorageBackendMultipath the target element is ignored, something addressable in http://libvirt.org/formatstorage.html when describing valid target path values.

Beyond that I also see no reason to support more than one mpath pool on a host.

So I've sent patches upstream in order address this:

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

The first just clarifies that target path is not used by the mpath storage
driver.  The second disallows two pools being defined on the same host. They may be combined into one if both are accepted.

Comment 2 John Ferlan 2015-06-30 15:30:15 UTC
Patches pushed upstream:

commit a77056bdb5d6d3942daf3f472d2dc3faa10bbe06
Author: John Ferlan <jferlan@redhat.com>
Date:   Wed Jun 24 08:45:24 2015 -0400

    mpath: Don't allow more than one mpath pool at a time
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1232606
    
    Since an mpath pool contains all the Multipath devices on a host, allowing
    more than one defined on a host at a time should be disallowed under the
    policy of disallowing duplicate source pools for the host.
    
    Adjust to docs to clarify the Multipath target path value usage for both
    the storage driver (only 1 pool per host) and formatstorage references
    (ignore the target element in favor of the default target mapping of
    /dev/mapper).

$ git describe a77056bdb5d6d3942daf3f472d2dc3faa10bbe06
v1.2.17-rc1-13-ga77056b
$

Comment 4 Yang Yang 2015-07-15 08:19:19 UTC
Verified with libvirt-1.2.17-2.el7.x86_64

Steps
1. define/start a mpath pool with following xml
# virsh pool-dumpxml mpathp
<pool type='mpath'>
  <name>mpathp</name>
  <uuid>e405f824-d057-4b38-aa95-16d8d22d7176</uuid>
  <capacity unit='bytes'>21481278464</capacity>
  <allocation unit='bytes'>21481278464</allocation>
  <available unit='bytes'>0</available>
  <source>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>

#virsh pool-define mpath.xml
#virsh pool-start mpathp

# virsh vol-list mpathp
 Name                 Path                                    
------------------------------------------------------------------------------
 dm-3                 /dev/mapper/mpathb

Note:
a Multipath pool ignores the target element in favor of the default target mapping of /dev/mapper

2. define another mpath pool
# virsh pool-define yy-mpath.xml 
error: Failed to define pool from yy-mpath.xml
error: operation failed: Storage source conflict with pool: 'mpathp'

Comment 6 errata-xmlrpc 2015-11-19 06:41:25 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.