Bug 1232606 - Libvirt should forbid to create duplicate mpath pool
Summary: Libvirt should forbid to create duplicate mpath pool
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Unspecified
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
Depends On:
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:
Last Closed: 2015-11-19 06:41:25 UTC
Target Upstream Version:

Attachments (Terms of Use)

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):

How reproducible:

Steps to Reproduce:

1.define and start a mpath pool

# virsh pool-dumpxml  mpath1
<pool type='mpath'>
  <capacity unit='bytes'>32218696704</capacity>
  <allocation unit='bytes'>32218696704</allocation>
  <available unit='bytes'>0</available>

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'>
  <capacity unit='bytes'>32218696704</capacity>
  <allocation unit='bytes'>32218696704</allocation>
  <available unit='bytes'>0</available>

# 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

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'>
# 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:


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
    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

$ git describe a77056bdb5d6d3942daf3f472d2dc3faa10bbe06

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

1. define/start a mpath pool with following xml
# virsh pool-dumpxml mpathp
<pool type='mpath'>
  <capacity unit='bytes'>21481278464</capacity>
  <allocation unit='bytes'>21481278464</allocation>
  <available unit='bytes'>0</available>

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

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

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.


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