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 1251461 - libvirt produced ambiguous error message when create disk pool with a block device which has no disk label
Summary: libvirt produced ambiguous error message when create disk pool with a block d...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-07 11:31 UTC by yisun
Modified: 2016-11-03 18:22 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.3.1-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:22:31 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description yisun 2015-08-07 11:31:51 UTC
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 11:41:51 UTC
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 10:24:06 UTC
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 18:22: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/RHSA-2016-2577.html


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