Bug 1123767

Summary: [Storage] validate 'unknown' type logical volume pool xml failed, however, pool can be created successfully
Product: Red Hat Enterprise Linux 7 Reporter: Yang Yang <yanyang>
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, eskultet, rbalakri, shyu, tzheng, xuzhang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.13-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:46:18 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 Yang Yang 2014-07-28 08:29:51 UTC
Description of problem:
1. virt-xml-validate the "unknown" type logical volume pool xml, will meet error, but the pool can be created successfully, whether via pool-create or pool-create-as command.

2. virt-xml-validate the "auto" type logical volume pool xml, the xml is validated, but the pool can NOT be created successfully, whether via pool-create or pool-create-as command.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-29.el7_0.1.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Validate the 'unknown' type logical volume pool xml
# cat pool-logical.xml 
 <pool type='logical'>
       <name>HostVG</name>
       <source>
         <name>HostVG</name>
         <format type='unknown'/>
         <device path='/dev/sda6'/>
       </source>
       <target>
         <path>/dev/HostVG</path>
       </target>
     </pool>

# virt-xml-validate pool-logical.xml 
pool-logical.xml:4: element name: Relax-NG validity error : Element source has extra content: name
pool-logical.xml:1: element pool: Relax-NG validity error : Element pool failed to validate content
pool-logical.xml fails to validate

2. Create pool with above xml

# virsh pool-create pool-logical.xml 
Pool HostVG created from pool-logical.xml

[root@yangyangtest yy]# virsh pool-list --all
Name                 State      Autostart 
-----------------------------------------
default              active     yes       
HostVG               active     no      
  
[root@yangyangtest yy]# virsh pool-destroy HostVG
Pool HostVG destroyed

[root@yangyangtest yy]# virsh pool-create-as HostVG logical --target /dev/HostVG --source-format unknown
Pool HostVG created

[root@yangyangtest yy]# virsh pool-list --all
Name                 State      Autostart 
-----------------------------------------
default              active     yes       
HostVG               active     no 

3. Validate the 'auto' type logical volume pool xml
# cat pool-logical.xml 
 <pool type='logical'>
       <name>HostVG</name>
       <source>
         <name>HostVG</name>
         <format type='auto'/>
         <device path='/dev/sda6'/>
       </source>
       <target>
         <path>/dev/HostVG</path>
       </target>
     </pool>
# virt-xml-validate pool-logical.xml 
pool-logical.xml validates

4. Create pool with above xml
# virsh pool-create pool-logical.xml 
error: Failed to create pool from pool-logical.xml
error: XML error: unknown pool format type auto

# virsh pool-create-as HostVG logical --target /dev/HostVG --source-format auto
error: Failed to create pool HostVG
error: XML error: unknown pool format type auto

Actual results:
While the source format of pool is "unknown", virt-xml-validate failed, but the pool can be created succussfully.
While the source format of pool is "auto", virt-xml-validate pass, but the pool failed to be created.


Expected results:
1.The result of virt-xml-validate should be keeping consistent with the creating result.
It means, if the virt-xml-validate command pass, then creating pool successfully;
if virt-xml-validate command fail, then creating pool fail.

2.In the following doc link, 
http://www.libvirt.org/storage.html#StorageBackendLogical
we can find that 
 The logical volume pool supports the following formats:

    auto - automatically determine format
    lvm2 

If pool type "unknown" is supported instead of "auto", the doc should be updated. If not, libvirt should support to create a logical pool with auto type instead of "unknown".

Additional info:

I also hit the issue in RHEL6. Will it be fixed in RHEL6, OR is it necessary to clone it in RHEL6?

Comment 4 Erik Skultety 2014-09-25 12:42:17 UTC
already existing NACK https://www.redhat.com/archives/libvir-list/2014-June/msg00838.html

Comment 5 Erik Skultety 2014-10-01 13:18:01 UTC
Now fixed upstream:

commit 1be67cd31b14172caee9bcc2daec64a908d71e94
Author: Erik Skultety <eskultet>
Date:   Thu Sep 25 16:26:18 2014 +0200

    storage: Fix logical pool fmt type
    
    According to our documentation logical pool supports formats 'auto' and
    'lvm2'. However, in storage_conf.c we previously defined storage pool
    formats: unknown, lvm2. Due to backward compatibility reasons
    we must continue refer to pool format type 'unknown' instead of 'auto'.

v1.2.9-rc1-20-g1be67cd

Comment 8 Yang Yang 2015-05-14 05:18:19 UTC
Verified on libvirt-1.2.15-1.el7.x86_64

Steps
1. define/build/start a logical pool with 'unknown' format
# cat testpool.xml 
<pool type='logical'>
       <name>MyVG</name>
       <source>
         <name>MyVG</name>
         <format type='unknown'/>
         <device path='/dev/sdc'/>
       </source>
       <target>
         <path>/dev/MyVG</path>
       </target>
     </pool>
# virsh pool-define testpool.xml 
Pool MyVG defined from testpool.xml
# virsh pool-build MyVG
Pool MyVG built
# virsh pool-start MyVG
Pool MyVG started

2. define/build/start a logical pool with 'auto' format
# cat testpool.xml 
<pool type='logical'>
       <name>MyVG</name>
       <source>
         <name>MyVG</name>
         <format type='auto'/>
         <device path='/dev/sdc'/>
       </source>
       <target>
         <path>/dev/MyVG</path>
       </target>
     </pool>

# virsh pool-define testpool.xml 
error: Failed to define pool from testpool.xml
error: unsupported configuration: unknown pool format type auto

3.define/build/start a logical pool without format
# cat testpool.xml 
<pool type='logical'>
       <name>MyVG</name>
       <source>
         <name>MyVG</name>
         <device path='/dev/sdc'/>
       </source>
       <target>
         <path>/dev/MyVG</path>
       </target>
     </pool>
# virsh pool-define testpool.xml 
Pool MyVG defined from testpool.xml
# virsh pool-build MyVG
Pool MyVG built
# virsh pool-start MyVG
Pool MyVG started

# virsh pool-dumpxml MyVG
<pool type='logical'>
  <name>MyVG</name>
  <uuid>1297bd2c-c6aa-445e-9c41-0a009ed865d2</uuid>
  <capacity unit='bytes'>1044381696</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>1044381696</available>
  <source>
    <device path='/dev/sdc'/>
    <name>MyVG</name>
    <format type='lvm2'/>
  </source>
  <target>
    <path>/dev/MyVG</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

Comment 10 errata-xmlrpc 2015-11-19 05:46:18 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