RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1160926 - Destroying 'fc_host' pool the HBA is NOT destroyed when not using 'parent' attribute
Summary: Destroying 'fc_host' pool the HBA is NOT destroyed when not using 'parent' at...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-06 02:13 UTC by Yang Yang
Modified: 2015-03-05 07:47 UTC (History)
7 users (show)

Fixed In Version: libvirt-1.2.8-7.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 07:47:00 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0323 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2015-03-05 12:10:54 UTC

Description Yang Yang 2014-11-06 02:13:25 UTC
Description of problem:
I created a vHBA using 'fc_host' pool NOT using 'parent' attribute.
However, when destroying pool the vHBA is NOT destroyed. 


Version-Release number of selected component (if applicable):
libvirt-1.2.8-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. create a vHBA by defining/starting a fc pool not using 'parent' attribute.

#cat fc-pool-1.xml
    <pool type='scsi'>
    <name>fc-pool-1</name>
    <source>
    <adapter type='fc_host' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
    </source>
    <target>
    <path>/dev/disk/by-path</path>
    <permissions>
    <mode>0700</mode>
    <owner>0</owner>
    <group>0</group>
    </permissions>
    </target>
    </pool>

    virsh pool-define fc-pool-1.xml
    Pool fc-pool-1 defined from fc-pool-1.xml

[root@dell-pet105-04 yy]# virsh pool-start fc-pool-1
Pool fc-pool-1 started

# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     no        
 fc-pool-1            active   yes

[root@dell-pet105-04 yy]# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5
scsi_host9 ---> vHBA created by the creation of 'fc_host' pool

#virsh nodedev-dumpxml scsi_host9
    <device>
    <name>scsi_host9</name>
    <path>/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.0/host4/vport-4:0-0/host9</path>
    <parent>scsi_host4</parent>
    <capability type='scsi_host'>
    <host>9</host>
    <unique_id>9</unique_id>
    <capability type='fc_host'>
    <wwnn>2101001b32a90002</wwnn>
    <wwpn>2101001b32a90003</wwpn>
    <fabric_wwn>ffffffffffffffff</fabric_wwn>
    </capability>
    </capability>
    </device>

2. destroy fc pool
virsh pool-destroy fc-pool-1
    Pool fc-pool-1 destroyed

[root@dell-pet105-04 yy]# virsh pool-undefine fc-pool-1
Pool fc-pool-1 has been undefined

[root@dell-pet105-04 yy]# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5
scsi_host9 ----> vHBA is not destroyed

Actual results:


Expected results:
The vHBA should be destroyed when destroying 'fc_host' pool

Additional info:
As described in comment #2 in bug 1160565, John found that the parent is NULL in the deleteVport, thus returning right away and not making the virManagePort() call to delete the vHBA.

Comment 2 John Ferlan 2014-11-06 15:49:29 UTC
So question for you for the corollary - if you provide a parent scsi_host to be the vHBA (eg, you've done the nodedev-create), then would you expect on pool destroy for that vHBA to also be destroyed?

I believe right now it is (my limited testing); however, I can be easily convinced that the only time we should destroy the vHBA is if we created it. The way I'm thinking about it is - why should we destroy something we didn't create?  The user created it and would they be "surprised" if it went away?

Comment 3 Yang Yang 2014-11-07 04:06:23 UTC
(In reply to John Ferlan from comment #2)
> So question for you for the corollary - if you provide a parent scsi_host to
> be the vHBA (eg, you've done the nodedev-create), then would you expect on
> pool destroy for that vHBA to also be destroyed?

No. I think it's unreasonable to destroy that vHBA ever created by nodedev-create when destroying pool.

> 
> I believe right now it is (my limited testing); however, I can be easily
> convinced that the only time we should destroy the vHBA is if we created it.
> The way I'm thinking about it is - why should we destroy something we didn't
> create?  The user created it and would they be "surprised" if it went away?

The answer is Yes, I do agree with you. We should only destroy the vHBA created via the creation of 'fc_host' pool. We should hold back the vHBA created via nodedev-create when destroying pool.

So IMO It may be translated into the following issues.

1. Check how the vHBA was created, via nodedev-create or creation of storage pool

2. If the vHBA was created via creation of storage pool not using 'parent' attribut in xml, should destroy the vHBA when destroying pool

3. If the vHBA was created via nodedev-create and a pool was created based on the vHBA using 'parent' attribut in xml, do NOT destroy the vHBA when destroying the pool.

Thanks
Yang

Comment 4 Yang Yang 2014-11-11 07:14:43 UTC
Hi John,
I found that the error message was not accurate when destroying pool. Will it be fixed in this one?

Steps to reproduce as following:
Defined/started a 'fc_host' adapter pool. Then destroyed the
corresponding vHBA by nodedev-destroy. It leads error out when
destroying the 'fc_host' pool. However, the error message is not
clear enough.

1. Discover fc host
# virsh nodedev-list fc_host
scsi_host4
scsi_host5


2.define/start 'fc_host' pool
# cat fc-pool.xml
<pool type='scsi'>
<name>fc-pool</name>
<source>
<adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
</source>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

# virsh pool-define fc-pool.xml
Pool fc-pool defined from fc-pool.xml

[root@dell-pet105-04 yy]# virsh pool-start fc-pool
Pool fc-pool started

[root@dell-pet105-04 yy]# virsh pool-refresh fc-pool
Pool fc-pool refreshed

[root@dell-pet105-04 yy]# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     no        
 fc-pool              active     no        
 mpath                active     no        

[root@dell-pet105-04 yy]# virsh vol-list fc-pool
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:2:0           /dev/disk/by-path/pci-0000:04:00.1-fc-0x203600a0b85b5dd4-lun-0


3. discover fc_host
# virsh nodedev-list fc_host
scsi_host4
scsi_host5
scsi_host7  ----> vHBA created by the creation of 'fc_host' pool


4. destroy the vHBA 'scsi_host7'
# virsh nodedev-destroy scsi_host7
Destroyed node device 'scsi_host7'

[root@dell-pet105-04 yy]# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

[root@dell-pet105-04 yy]# virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     no        
 fc-pool              active     no        
 mpath                active     no        

5. destroy the 'fc_host' pool
[root@dell-pet105-04 yy]# virsh pool-destroy fc-pool
error: Failed to destroy pool fc-pool
error: An error occurred, but the cause is unknown

Actual Results:
In step 5, error out

Expected Results:
In step 5, provide more accurate error message

Comment 5 John Ferlan 2014-11-11 12:10:59 UTC
Not a path you should be taking and perhaps only because you know what's happening behind the scenes were you able to attempt it...  The question becomes though should 'nodedev-destroy' allow the deletion - is there a way for it to stop it if it determines there's a scsi_host pool that's using the node device.

Beyond that - I've done something similar; however, it caused much worse effects on the host I was using (eg it crashed). There were probably "extenuating circumstances" to that though as something else was using the same scsi_host# that I was using to assign LUN's (which I didn't know at the time).

In any case, to answer your question - the patches I've posted upstream don't have that error, but it could easily be added.

The "assumption" in the code at deleteVport is that the called function virGetFCHostNameByWWN() would find the vHBA via wwnn/wwpn since nothing is supposed to delete it. The only failure expected is that the /sys/class/fc_host
didn't exist or there was a memory allocation failure.  Not finding a wwnn/wwpn is an 'expected return' and used by the createVport code to determine that libvirt has to create the vHBA.

Unfortunately at this point you won't be able to destroy the pool without a bit more hackery.

Comment 6 John Ferlan 2014-11-12 17:41:09 UTC
This was pushed upstream today - commit id's :


5b226fcdc6ea3b9be73e31b6cff88f65d754cb0d
523c6908f8c21cede0121a8fdac9ad76c01d4d1c
5530f248db4974379f584eab5ad73dd20cf05de7

Comment 9 Yang Yang 2014-12-15 10:17:09 UTC
Verify it with libvirt-1.2.8-10.el7.x86_64

Test matrix
|vHBA created by ?| parent specified? | managed           | vHAB is deleted ?|
-------------------------------------------------------------------------------
|storage pool     | Y                |Not specified/yes/no| Y                |
-------------------------------------------------------------------------------
|storage pool     | N                |Not specified/yes/no| Y                |
-------------------------------------------------------------------------------
|node device      | Y                |Not specified/no    | N                |
------------------------------------------------------------------------------
|node device      | Y                | Y                  | Y                |
------------------------------------------------------------------------------
|node device      | N                |Not specified/no    | N                |
------------------------------------------------------------------------------
|node device      | N                | Y                  | Y                |
------------------------------------------------------------------------------

Steps:
1. start/destroy a 'fc_host' pool by not specifying 'parent', generating vHBA while pool creation
# cat fc-pool-1.xml 
<pool type='scsi'>
<name>fc-pool-1</name>
<source>
<adapter type='fc_host' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
</source>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

#virsh pool-define fc-pool-1.xml 
Pool fc-pool-1 defined

# virsh pool-start fc-pool-1
Pool fc-pool-1 started

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>4c3bd50a-7f59-481f-be55-137e43248604</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host10      ---> generated by pool creation
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool-1
Pool fc-pool-1 refreshed

[root@dell-pet105-04 yy]# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no        
 mpath                inactive   no  

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no        
 mpath                inactive   no

# virsh pool-destroy fc-pool-1
Pool fc-pool-1 destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            inactive   no

# virsh nodedev-list scsi_host  ---> scsi_host10 is gone
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-edit fc-pool-1
Pool fc-pool-1 XML configuration edited.
updated 'managed=yes' to 'managed=no'

# virsh pool-start fc-pool-1
Pool fc-pool-1 started

[root@dell-pet105-04 yy]# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>4c3bd50a-7f59-481f-be55-137e43248604</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>   ---> managed is set to yes automatically
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host12    ---> created while pool creation
scsi_host2
scsi_host3
scsi_host4
scsi_host5


# virsh pool-destroy fc-pool-1
Pool fc-pool-1 destroyed

# virsh nodedev-list scsi_host  ---> scsi_host12 is gone
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5


2. start/destroy a 'fc_host' pool by specifying 'parent', generating vHBA while pool creation

# cat fc-pool.xml 
<pool type='scsi'>
<name>fc-pool</name>
<source>
<adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
</source>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

# virsh pool-define fc-pool.xml 
Pool fc-pool defined from fc-pool.xml

# virsh pool-start fc-pool
Pool fc-pool started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no   

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>a95b4405-03f6-41bc-a31e-5a12c0d291fb</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>  ---> managed=yes
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>


# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host13    --> created while pool creation
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool
Pool fc-pool refreshed

[root@dell-pet105-04 yy]# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no  

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no     

# virsh pool-destroy fc-pool
Pool fc-pool destroyed


# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              inactive   no   

# virsh nodedev-list scsi_host   ---> scsi_host13 is gone
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-edit fc-pool
Pool fc-pool XML configuration edited.
updated 'managed=yes' to 'managed=no'

# virsh pool-start fc-pool
Pool fc-pool started

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>a95b4405-03f6-41bc-a31e-5a12c0d291fb</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>  --> managed is set to yes automatically
  </source>  
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>


# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no 


# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host14
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-destroy fc-pool
Pool fc-pool destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              inactive   no    

# virsh nodedev-list scsi_host   ---> scsi_host14 is gone
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

3. start/destroy fc_host pool using the vHBA ever created by nodedev and specifying parent
> managed is not specified
# cat vHBA.xml 
<device>
    <parent>scsi_host5</parent>
    <capability type='scsi_host'>
    <capability type='fc_host'>
    <wwnn>2101001b32a90002</wwnn>
    <wwpn>2101001b32a90003</wwpn>
    <capability type='vport_ops'/>
    </capability>
    </capability>
    </device>

# virsh nodedev-create vHBA.xml 
Node device scsi_host15 created from vHBA.xml

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15    ---> new
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# cat fc-pool.xml 
<pool type='scsi'>
<name>fc-pool</name>
<source>
<adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
</source>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

# virsh pool-define fc-pool.xml 
Pool fc-pool defined from fc-pool.xml

# virsh pool-start fc-pool
Pool fc-pool started

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool
Pool fc-pool refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no  

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool
Pool fc-pool destroyed
	
# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              inactive   no

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15     ---> still exists
scsi_host2
scsi_host3
scsi_host4
scsi_host5

> managed='no'
# virsh pool-edit fc-pool
Pool fc-pool XML configuration edited.
add 'managed=no'

# virsh pool-start fc-pool
Pool fc-pool started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no 

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='no' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-refresh fc-pool
Pool fc-pool refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no  

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='no' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no  

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='no' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool
Pool fc-pool destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              inactive   no

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15         ---> still exists
scsi_host2
scsi_host3
scsi_host4
scsi_host5

> managed='yes'
# virsh pool-edit fc-pool
Pool fc-pool XML configuration edited.
updated 'managed=no' to 'managed=yes'

# virsh pool-start fc-pool
Pool fc-pool started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no   

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-refresh fc-pool
Pool fc-pool refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no 

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              active     no 

# virsh pool-dumpxml fc-pool
<pool type='scsi'>
  <name>fc-pool</name>
  <uuid>9fbfb5b6-1536-4865-9f9b-a5c994c7aa36</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' parent='scsi_host5' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool
Pool fc-pool destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool              inactive   no   

# virsh nodedev-list scsi_host   ---> scsi_host15 is gone
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

4. start/destroy fc_host pool using the vHBA ever created by nodedev and not specifying parent
> not specifying managed

# virsh nodedev-create vHBA.xml 
Node device scsi_host16 created from vHBA.xml

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# cat fc-pool-1.xml 
<pool type='scsi'>
<name>fc-pool-1</name>
<source>
<adapter type='fc_host' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
</source>
<target>
<path>/dev/disk/by-path</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>

# virsh pool-define fc-pool-1.xml 
Pool fc-pool-1 defined from fc-pool-1.xml

# virsh pool-start fc-pool-1
Pool fc-pool-1 started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no  

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool-1
Pool fc-pool-1 refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no  

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no  

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool-1
Pool fc-pool-1 destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            inactive   no  

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16     ---> still exists
scsi_host2
scsi_host3
scsi_host4
scsi_host5

> managed='no'
# virsh pool-edit fc-pool-1
Pool fc-pool-1 XML configuration edited.
add managed='no'

# virsh pool-start fc-pool-1
Pool fc-pool-1 started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no   

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool-1
Pool fc-pool-1 refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='no' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no 

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='no' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool-1
Pool fc-pool-1 destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            inactive   no

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16      ---> still exists
scsi_host2
scsi_host3
scsi_host4
scsi_host5

> managed='yes'
# virsh pool-edit fc-pool-1
Pool fc-pool-1 XML configuration edited.
updated 'managed=no' to managed=yes

# virsh pool-start fc-pool-1
Pool fc-pool-1 started

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no  

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host16
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh pool-refresh fc-pool-1
Pool fc-pool-1 refreshed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no  

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# service libvirtd restart
Redirecting to /bin/systemctl restart  libvirtd.service

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            active     no   

# virsh pool-dumpxml fc-pool-1
<pool type='scsi'>
  <name>fc-pool-1</name>
  <uuid>f816cebd-de1d-43c2-adb5-1ec2afadb1d3</uuid>
  <capacity unit='bytes'>10737418240</capacity>
  <allocation unit='bytes'>10737418240</allocation>
  <available unit='bytes'>0</available>
  <source>
    <adapter type='fc_host' managed='yes' wwnn='2101001b32a90002' wwpn='2101001b32a90003'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>

# virsh pool-destroy fc-pool-1
Pool fc-pool-1 destroyed

# virsh pool-list --all
 Name                 State      Autostart 
-------------------------------------------
 default              active     no        
 fc-pool-1            inactive   no

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

5. set managed to invalid value
# virsh pool-create fc-pool.xml 
error: Failed to create pool from fc-pool.xml
error: unsupported configuration: unknown fc_host managed setting 'un'

# virsh pool-edit fc-pool
error: unsupported configuration: unknown fc_host managed setting '123'
Failed. Try again? [y,n,f,?]:
error: unsupported configuration: unknown fc_host managed setting 'unknown'
Failed. Try again? [y,n,f,?]:

As all the steps got the expected results. set it to verified.

Comment 11 errata-xmlrpc 2015-03-05 07:47:00 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/RHSA-2015-0323.html


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