Bug 1224088 - Using "pool-create-as" to create a scsi pool with wwnn&wwpn has redundant xml check.
Summary: Using "pool-create-as" to create a scsi pool with wwnn&wwpn has redundant xml...
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2015-05-22 07:54 UTC by yisun
Modified: 2015-11-19 06:36 UTC (History)
5 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:36:24 UTC
Target Upstream Version:

Attachments (Terms of Use)

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

Description yisun 2015-05-22 07:54:45 UTC
Using "pool-create-as" to create a scsi pool with wwnn&wwpn has redundant xml check.  


repro steps:
1. try to create a fibre channel scsi pool with wwnn&wwpn as follow:
# virsh pool-create-as npiv-pool scsi --adapter-wwnn 2101001b32a90002 --adapter-wwpn 2101001b32a90002   --adapter-parent scsi_host5 --target /dev/disk/by-path/
error: Failed to create pool npiv-pool
error: XML error: missing storage pool source adapter

2. use same cmd line in step 1 and add "--source-host haha" (or "--source-dev haha" / "--source-path haha")
# virsh pool-create-as npiv-pool scsi --adapter-wwnn 2101001b32a90002 --adapter-wwpn 2101001b32a90002   --adapter-parent scsi_host5 --target /dev/disk/by-path/ --source-host haha
Pool npiv-pool created

3. Check the pool's xml file, the "--source-host haha" doesn't effect the final xml file.
# virsh pool-dumpxml npiv-pool
<pool type='scsi'>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90002'/>

actual result:
When ignore the unnecessary source elements, virsh will prevent the creation of a scsi pool from wwnn&wwpn (as step 1).  And if we add the unnecessary element, it will be ignored finally in the xml (as step 3). It's confusing.

expected result:
Step 1 should be a valid command without error.

Additional info:
You can use add "--print-xml" in the command to make a quick reproduction.
standard npiv pool xml as follow:

Comment 2 John Ferlan 2015-05-29 00:53:31 UTC
Seems I forgot to add to the list of "if"'s which cause the code to print the <source...> and source child xml when I added commits '89325806' and 'bd00e00ea'.

As for --source host, --source-dev, --source-path and not appearing after - that's because they are ignored for <pool type='scsi'>

--source-host is valid for "netfs, iscsi, rbd, sheepdog, gluster" pool types
--source-dev is valid for "fs, logical, disk, iscsi, zfs" pool types
--source-path is valid for "dir" pools

Patches post upstream :


Comment 3 John Ferlan 2015-06-01 09:53:58 UTC
Patch pushed upstream:

commit cffc099356f0ce1bb94d9d009aa49a99b9001d3c
Author: John Ferlan <jferlan@redhat.com>
Date:   Thu May 28 14:29:19 2015 -0400

    virsh: Fix printing of XML for pool-create-as
    commit id 'bd00e00e' neglected to add the new adapter source options
    into the if condition that allowed printing the <source> XML fields.
    The <adapter type='fc_host'.../> doesn't require other options in order
    to be complete.

git describe cffc099356f0ce1bb94d9d009aa49a99b9001d3c

Comment 5 Yang Yang 2015-07-16 07:28:05 UTC
Verified with libvirt-1.2.17-2.el7.x86_64
1. create scsi pool with option adapter-wwnn and adapter-wwpn
# virsh pool-create-as npiv-pool scsi --adapter-wwnn 2101001b32a90002 --adapter-wwpn 2101001b32a90002   --adapter-parent scsi_host2 --target /dev/disk/by-path/
Pool npiv-pool created

2. create scsi pool with option adapter-name
# virsh pool-create-as npiv-pool scsi --adapter-name scsi_host7 --target /dev/disk/by-path/ 
Pool npiv-pool created

Comment 7 errata-xmlrpc 2015-11-19 06:36:24 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.