This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1251461 - libvirt produced ambiguous error message when create disk pool with a block device which has no disk label
libvirt produced ambiguous error message when create disk pool with a block d...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
x86_64 Linux
low Severity low
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-07 07:31 EDT by yisun
Modified: 2016-11-03 14:22 EDT (History)
6 users (show)

See Also:
Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:22:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yisun 2015-08-07 07:31:51 EDT
summary:
libvirt produced ambiguous error message when create disk pool with a block device which has no disk label


versions:
kernel-devel-3.10.0-302.el7.x86_64
libvirt-1.2.17-3.el7.x86_64
qemu-kvm-rhev-2.3.0-14.el7.x86_64

how reproducible:
100%

steps:
1. prepare a block device ( such as a usb disk)
2. mkfs the whole block device
#mkfs.ext3 /dev/sdb
...
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
3. prepare a disk pool xml
#cat disk.pool
<pool type='disk'>
<name>sdb</name>
<source>
<device path='/dev/sdb'>
</device>
<format type='dos'/>
</source>
<target>
<path>/dev</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
4. # virsh pool-create disk.pool 
error: Failed to create pool from disk.pool
error: Storage volume not found: no storage vol with matching path '/dev/sdb1'

Actual result:
in step 4, libvirt reports there is no /dev/sdb1 as an error

Expect result:
The error message doesn't make sense, why a disk pool requires the block device must have a partition sdb1? 

Additional info:
If use parted mklabel to that block device, the pool can be started correctly
# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel                                                          
New disk label type? msdos                                                
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
(parted) quit                                                             
Information: You may need to update /etc/fstab.
# virsh pool-create disk.pool                           
Pool sdb created from disk.pool
Comment 2 John Ferlan 2015-10-06 07:41:51 EDT
Pushed upstream as commit id '657f3bea8ded929c16dd96bb3c02d88af4c71a1b'

git describe 657f3bea8ded929c16dd96bb3c02d88af4c71a1b
v1.2.20-27-g657f3be

May require following commits too:

2f177c5a41de50143453aba333774f3023e946b7
05c46f5c2267a52a2011d5ce0cd4fce1f5334761
fba2076f43032632b1cbd29416c57955f943d828
Comment 4 yisun 2016-02-26 05:24:06 EST
Verified on libvirt-1.3.1-1.el7.x86_64
and PASSED.


Scenarios:
1. check when disk source doesn't exist, proper error message will be produced. 
# cat disk.pool 
<pool type='disk'>
<name>sdz</name>
<source>
<device path='/dev/sdz'>
</device>
<format type='dos'/>
</source>
<target>
<path>/dev</path>
<permissions>
<mode>0700</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>


#virsh pool-create disk.pool 
error: Failed to create pool from disk.pool
error: invalid argument: device path '/dev/sdz' doesn't exist


# virsh pool-define disk.pool
Pool sdz defined from disk.pool


# virsh pool-start sdz
error: Failed to start pool sdz
error: invalid argument: device path '/dev/sdz' doesn't exist



===========================

2. check when a invalid disk label exist, a warning message will be properly produced.
# virsh pool-list --all
-------------------------------------------
...
 sdb                  inactive   no        
...

# virsh pool-dumpxml sdb
<pool type='disk'>
  <name>sdb</name>
  <uuid>2961824b-a3c2-4b4d-a2b5-9f846cb040ad</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>
    <permissions>
      <mode>0700</mode>
      <owner>0</owner>
      <group>0</group>
    </permissions>
  </target>
</pool>
     
# parted /dev/sdb mklabel loop
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
Information: You may need to update /etc/fstab.

# parted /dev/sdb print
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags: 
Number  Start  End  Size  File system  Flags


# virsh pool-build sdb --no-overwrite
error: Failed to build pool sdb
error: operation failed: Unknown Partition Type, requires build --overwrite


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




3. check when a valid disk label exists, a warning message will be properly produced. 
# parted /dev/sdb mklabel gpt
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
Information: You may need to update /etc/fstab.

# virsh pool-build sdb --no-overwrite              
error: Failed to build pool sdb
error: Requested operation is not valid: Valid disk label already present, requires --overwrite


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

# parted /dev/sdb print
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sdb: 1074MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 
Number  Start  End  Size  Type  File system  Flags


4. check comment 0's scenario
# parted /dev/sdb mklabel loop
Warning: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes                                                               
Information: You may need to update /etc/fstab.

# virsh pool-create disk.pool                      
error: Failed to create pool from disk.pool
error: operation failed: Unknown Partition Type, requires build --overwrite
Comment 6 errata-xmlrpc 2016-11-03 14:22:31 EDT
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-2016-2577.html

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