Bug 1181062 - Default disk pool format should not be 'unknown'
Summary: Default disk pool format should not be 'unknown'
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: 2015-01-12 10:12 UTC by Yang Yang
Modified: 2015-11-19 06:07 UTC (History)
9 users (show)

Fixed In Version: libvirt-1.2.14-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:07:31 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 Yang Yang 2015-01-12 10:12:07 UTC
Description of problem:
Defined a disk pool using the xml not specifying format type.
The format type defaults by 'unknown' by checking the pool dumpxml.
However, pool builds failed as the 'unknown' is not an valid disk label.
Dump disk pool xml to a local file, validates failed too.

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

How reproducible:
100%

Steps to Reproduce:
1. define a disk pool with the following xml
# cat disk-pool.xml
<pool type="disk">
        <name>disk</name>
        <source>
          <device path='/dev/sdc'/>
        </source>
        <target>
          <path>/tmp</path>
        </target>
      </pool>

#virsh pool-define disk-pool.xml

2. dump the pool xml
# virsh pool-dumpxml disk
<pool type='disk'>
  <name>disk</name>
  <uuid>25548d2f-7cd7-4604-8968-7965fcd1b429</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdc'/>
    <format type='unknown'/>
  </source>
  <target>
    <path>/tmp</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

3. build the pool
# virsh pool-build disk --overwrite
error: Failed to build pool disk
error: internal error: Child process (/usr/sbin/parted /dev/sdc mklabel --script unknown) unexpected exit status 1: /usr/sbin/parted: invalid token: unknown
Error: Expecting a disk label type.

4. dump the pool xml to a file
# virsh pool-dumpxml disk > disk-tmp.xml

5. validate the file
# virt-xml-validate disk-tmp.xml
Relax-NG validity error : Extra element format in interleave
disk-tmp.xml:9: element format: Relax-NG validity error : Element source failed to validate content
disk-tmp.xml:1: element pool: Relax-NG validity error : Invalid sequence in interleave
disk-tmp.xml:1: element pool: Relax-NG validity error : Element pool failed to validate content
disk-tmp.xml fails to validate

Actual results:
Disk pool format type defaults by 'unknwon'


Expected results:
As 'unknown' is not a valid format, it should not be the default format 

Additional info:

Comment 1 John Ferlan 2015-02-27 00:47:16 UTC
Patch posted upstream:

http://www.redhat.com/archives/libvir-list/2015-February/msg01196.html

Comment 2 John Ferlan 2015-03-03 03:52:00 UTC
Patch pushed upstream:

commit id:
832a9256b25504ec79cebe9db2784d7f05342f03

git describe 832a9256b25504ec79cebe9db2784d7f05342f03
v1.2.13-28-g832a925
$

Comment 4 Pei Zhang 2015-06-08 07:34:21 UTC
I can reproduce it on libvirt-1.2.8-12.el7.x86_64 .

Verify version :
libvirt-1.2.16-1.el7.x86_64
qemu-kvm-rhev-2.3.0-2.el7.x86_64

steps :
1.check libvirt.org , it gives useful info :
http://libvirt.org/storage.html#StorageBackendDisk
Disk volume pools 
......It will default to using msdos as the pool source format. 

2.check pool operations 

2.1 define a disk pool like following :
<pool type='disk'>
  <name>disk-pool</name>
  <source>
    <device path='/dev/sdd'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>
# virsh pool-define disk-pool.xml 
Pool disk-pool defined from disk-pool.xml
# virsh pool-dumpxml disk-pool
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>e8af7d41-61fe-42dd-b9ff-e9816681839d</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdd'/>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>
2.2 build the pool 
# virsh pool-build disk-pool --overwrite
Pool disk-pool built
# virsh pool-dumpxml disk-pool
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>e8af7d41-61fe-42dd-b9ff-e9816681839d</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdd'/>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>

2.3 start the pool and create volume in the pool 
# virsh pool-start disk-pool
Pool disk-pool started

# virsh pool-dumpxml disk-pool 
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>e8af7d41-61fe-42dd-b9ff-e9816681839d</uuid>
  <capacity unit='bytes'>64420392960</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>64420360704</available>
  <source>
    <device path='/dev/sdd'>
      <freeExtent start='32256' end='64420392960'/>
    </device>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>
# virsh vol-create-as --pool disk-pool sdd1 1G --format none
Vol sdd1 created
# virsh vol-create-as --pool disk-pool sdd2 1G 
Vol sdd2 created
# virsh vol-list disk-pool --details
 Name  Path       Type   Capacity  Allocation
----------------------------------------------
 sdd1  /dev/sdd1  block  1.00 GiB    1.00 GiB
 sdd2  /dev/sdd2  block  1.00 GiB    1.00 GiB

3.validate pool-dumpxml 
#virsh pool-dumpxml disk-pool > pool.xml
# virt-xml-validate pool.xml 
Relax-NG validity error : Extra element format in interleave
pool.xml:9: element format: Relax-NG validity error : Element source failed to validate content
pool.xml:1: element pool: Relax-NG validity error : Invalid sequence in interleave
pool.xml:1: element pool: Relax-NG validity error : Element pool failed to validate content
pool.xml fails to validate


Note :
According to the verify steps , in step 2 , pool can be build with --overwrite , start and create volume ; but check with pool-dumpxml , the source format is still 'unknown' .
In step 3 , it is invalid if pool source format is 'unknown' through virt-xml-validate to check .
So Is it necessary that we should change the result of dumpxml since we changed the pool source format , and drop the 'unknown' source format because it is invalid . or it is a acceptable result since it has no impact for us to use it
Thanks !

Comment 5 John Ferlan 2015-06-08 12:13:32 UTC
The meaning of the docs is that when source format is unknown, then it will default to using msdos.  Having unknown in the output isn't technically wrong. The failure to virt-xml-validate that is because the .rng has "none" instead of "unknown" (something that can be easily fixed - I'll send a patch upstream today).

Not changing the type from unknown to dos is not technically a bug/issue, but it is something that can also be rectified.  I'll send a patch for that too, but it could be rejected since we do indicate by providing unknown, we will default to dos

Comment 6 Yang Yang 2015-07-21 10:11:05 UTC
See also https://bugzilla.redhat.com/show_bug.cgi?id=1245144
Primary partitions created by parted are ejected by kernel. It perhaps blocks our disk pool related testing.

Comment 7 John Ferlan 2015-08-13 11:01:49 UTC
With respect to c5 - the following patch series was been pushed upstream:

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

They were added to libvirt 1.2.17

Comment 8 Pei Zhang 2015-08-17 02:12:47 UTC
Verify version :
libvirt-1.2.17-5.el7.x86_64

steps :
1. define a pool like following with format is unknown

# virsh pool-dumpxml disk-pool
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>80d28c91-4a38-4b75-b9d0-3f2ca9b1be46</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdb'/>
    <format type='unknown'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>

2.Using virt-xml-validate to check , it is vaild.
# virt-xml-validate disk-pool1.xml 
disk-pool1.xml validates

3.build and start pool. 

# virsh pool-build disk-pool --overwrite
Pool disk-pool built


3.1 check source format again.
As said in doc if the source format type is "unknown",it will default to use "msdos", and out put as "dos"

# virsh pool-dumpxml disk-pool
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>80d28c91-4a38-4b75-b9d0-3f2ca9b1be46</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdb'/>
    <format type='dos'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>

3.2 start disk-pool, check source format again.

# virsh pool-start disk-pool
Pool disk-pool started

# virsh pool-dumpxml disk-pool
<pool type='disk'>
  <name>disk-pool</name>
  <uuid>80d28c91-4a38-4b75-b9d0-3f2ca9b1be46</uuid>
  <capacity unit='bytes'>16006394880</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>16006362624</available>
  <source>
    <device path='/dev/sdb'>
      <freeExtent start='32256' end='16006394880'/>
    </device>
    <format type='dos'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>

# virsh vol-create-as --pool disk-pool sdc1 1G
Vol sdc1 created

# virsh vol-list disk-pool
 Name                 Path                                    
------------------------------------------------------------------------------
 sdc1                 /dev/sdc1                                


As comment 2 and this , move this bug to verified.

Comment 10 errata-xmlrpc 2015-11-19 06:07:31 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.