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 1430679 - Increase the wipe of bytes when build a logical pool which already has a label on target volume device
Summary: Increase the wipe of bytes when build a logical pool which already has a labe...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-03-09 09:50 UTC by Pei Zhang
Modified: 2017-08-02 00:03 UTC (History)
6 users (show)

Fixed In Version: libvirt-3.2.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:24:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Description Pei Zhang 2017-03-09 09:50:28 UTC
Description of problem:
Refer to https://bugzilla.redhat.com/show_bug.cgi?id=1373711#c7

Version-Release number of selected component (if applicable):
libvirt-3.1.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

1.check device label (ext2/ext3/ext4)
# blkid /dev/sdb 
/dev/sdb: UUID="393a7576-1b80-4f81-92e7-67871fd58e10" TYPE="ext4" 

2. define a logical pool as following:
# virsh pool-dumpxml logical
<pool type='logical'>
  <name>logical</name>
  <uuid>04e3685b-137b-4f13-8eec-31949a9ee9f5</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdb'/>
    <name>logical</name>
    <format type='lvm2'/>
  </source>
  <target>
    <path>/dev/logical</path>
    <permissions>
      <mode>0755</mode>
    </permissions>
  </target>
</pool>

3.build pool with nothing.
# virsh pool-build logical
error: Failed to build pool logical
error: Storage pool already built: Format of device '/dev/sdb' does not match the expected format 'LVM2_member', forced overwrite is necessary

4. as above, build pool with --overwrite, it also fails to build.
# virsh pool-build logical --overwrite
error: Failed to build pool logical
error: internal error: Child process (/usr/sbin/pvcreate /dev/sdb) unexpected exit status 5: WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: [n]
  Aborted wiping of ext4.
  1 existing signature left on the device.

5. test with other file systems such as xfs and vfat, repeat steps 1-3
then build pool with --overwrite, it can build successfully.

Actual results:
As step4, it fails to build pool with --overwrite.

Expected results:
Build pool successfullly with --overwrite.

Additional info:

As following, perhaps for existing file system ext2/3/4, it should wipe 1080+512 bytes.
1.pvcreate when target volume device has xfs label.

# parted /dev/sdb p
...
Number  Start  End     Size    File system  Flags
 1      0.00B  4008MB  4008MB  xfs

# pvcreate /dev/sdb 
WARNING: xfs signature detected on /dev/sdb at offset 0. Wipe it? [y/n]: n

2.pvcreate when target volume device has ext4 label.
# parted /dev/sdb p
...
Number  Start  End     Size    File system  Flags
 1      0.00B  4008MB  4008MB  ext4
# pvcreate /dev/sdb 
WARNING: ext4 signature detected on /dev/sdb at offset 1080. Wipe it? [y/n]: n

Comment 2 John Ferlan 2017-03-24 17:48:33 UTC
Posted a patch upstream:

http://www.redhat.com/archives/libvir-list/2017-March/msg01192.html

Comment 3 John Ferlan 2017-03-27 16:58:08 UTC
Pushed patch upstream:

commit 6760cc4bfddb84a8ab33e8b008c0440013c17499
Author: John Ferlan <jferlan>
Date:   Fri Mar 24 12:25:27 2017 -0400

    logical: Need to overwrite/clear more than just first 512 bytes

...

$ git describe 6760cc4bfddb84a8ab33e8b008c0440013c17499
v3.1.0-382-g6760cc4
$

Comment 5 yisun 2017-04-06 08:21:25 UTC
Verified with libvirt-3.2.0-1.el7.x86_64

Steps:
1. prepare a ext4 block device
## blkid /dev/sdf
/dev/sdf: UUID="62e6c23c-3ace-4029-b5ff-f62e1d4c2496" TYPE="ext4" 

2. prepare a logical pool xml
## cat pool.logical 
<pool type='logical'>
  <name>lpool</name>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <device path='/dev/sdf'/>
    <name>logical</name>
    <format type='lvm2'/>
  </source>
  <target>
    <path>/dev/ltest</path>
    <permissions>
      <mode>0755</mode>
    </permissions>
  </target>
</pool>

3. define the pool
## virsh pool-define pool.logical 
Pool lpool defined from pool.logical

4. build the pool without --overwrite
## virsh pool-build lpool
error: Failed to build pool lpool
error: Storage pool already built: Format of device '/dev/sdf' does not match the expected format 'LVM2_member', forced overwrite is necessary

5. build the pool with --overwrite
## virsh pool-build lpool --overwrite
Pool lpool built

6. start the pool
## virsh pool-start lpool
Pool lpool started

7. check the pool existing in pool list
## virsh pool-list | grep lpool
 lpool                active     no        

8. check the block device has correct type
## blkid /dev/sdf
/dev/sdf: UUID="9vfnr6-iLfl-WVLL-BBL8-9AIu-ewDA-ulQCbw" TYPE="LVM2_member"

Comment 6 errata-xmlrpc 2017-08-01 17:24:15 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://access.redhat.com/errata/RHEA-2017:1846

Comment 7 errata-xmlrpc 2017-08-02 00:03:43 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://access.redhat.com/errata/RHEA-2017:1846


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