Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 892271

Summary: virt-format fail to format the same disk more than twice with lvm enable
Product: Red Hat Enterprise Linux 7 Reporter: Mohua Li <moli>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: bfan, leiwang, wshi
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 895897 (view as bug list) Environment:
Last Closed: 2014-06-13 12:42:50 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:
Bug Depends On: 895897    
Bug Blocks:    

Description Mohua Li 2013-01-06 08:58:51 UTC
Description of problem:

guestfs_wipefs fail if try to wipe the device more than 2 times with lvm enable, wipefs could be succeed of only have 1 try, also won't fail wipe the device more than 2 times without lvm

1st time won't fail anyway,
#virt-format -a virt_format.raw --filesystem=ext3 --lvm
try with the same device 2nd time, it will fail anyway,
#virt-format -a virt_format.raw --filesystem=ext3 --lvm

exit with 
/*format.c*/

336       if (have_wipefs && guestfs_wipefs (g, devices[i]) == -1)
337         exit (EXIT_FAILURE);  



below is the detail log, 
libguestfs: trace: available "wipefs"
libguestfs: send_to_daemon: 60 bytes: 00 00 00 38 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 d8 | 00 00 00 0
0 | ...
guestfsd: main_loop: new request, len 0x38
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 d8 | 00 00 00 01 | 00 12 34
 00 | ...
libguestfs: trace: available = 0
libguestfs: trace: list_devices
libguestfs: send_to_daemon: 44 bytes: 00 00 00 28 | 20 00 f5 f5 | 00 00 00 04 | 00 00 00 07 | 00 00 00 0
0 | ...
guestfsd: main_loop: proc 216 (available) took 0.00 seconds
guestfsd: main_loop: new request, len 0x28
guestfsd: main_loop: proc 7 (list_devices) took 0.00 seconds
libguestfs: recv_from_daemon: 56 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 00 07 | 00 00 00 01 | 00 12 34
 01 | ...
libguestfs: trace: list_devices = ["/dev/sda"]
libguestfs: trace: wipefs "/dev/sda"
libguestfs: send_to_daemon: 56 bytes: 00 00 00 34 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 32 | 00 00 00 0
0 | ...
guestfsd: main_loop: new request, len 0x34
wipefs --help
wipefs -a /dev/sda
wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
guestfsd: error: wipefs: error: /dev/sda: probing initialization failed: Device or resource busy
guestfsd: main_loop: proc 306 (wipefs) took 0.00 seconds
libguestfs: recv_from_daemon: 128 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 32 | 00 00 00 01 | 00 12 3
4 02 | ...
libguestfs: trace: wipefs = -1 (error)
libguestfs: error: wipefs: wipefs: error: /dev/sda: probing initialization failed: Device or resource bu
sy
libguestfs: trace: close
libguestfs: closing guestfs handle 0x15ba820 (state 2)
libguestfs: trace: internal_autosync
libguestfs: send_to_daemon: 44 bytes: 00 00 00 28 | 20 00 f5 f5 | 00 00 00 04 | 00 00 01 1a | 00 00 00 0
0 | ...
guestfsd: main_loop: new request, len 0x28
fsync /dev/sda
guestfsd: main_loop: proc 282 (internal_autosync) took 0.00 seconds
libguestfs: recv_from_daemon: 40 bytes: 20 00 f5 f5 | 00 00 00 04 | 00 00 01 1a | 00 00 00 01 | 00 12 34
 03 | ...
libguestfs: trace: internal_autosync = 0
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsS9zRa8





Version-Release number of selected component (if applicable):
libguestfs-1.20.1-4.el7.x86_64

How reproducible:
always with lvm enable

Steps to Reproduce:
1. #virt-format -a virt_format.raw --filesystem=ext3 --lvm
2. #virt-format -a virt_format.raw --filesystem=ext3 --lvm
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Richard W.M. Jones 2013-01-21 08:53:45 UTC
moli, I think this is a duplicate of bug 872831.

Furthermore, this works for me in RHEL 7 with:

libguestfs-1.20.1-6.el7.x86_64
util-linux-2.22.1-2.4.el7.x86_64

What version of util-linux do you have?  Can you try the
latest in RHEL 7 and see if that fixes the problem?

Comment 2 Mohua Li 2013-03-26 07:20:32 UTC
(In reply to comment #1)
> moli, I think this is a duplicate of bug 872831.
> 
> Furthermore, this works for me in RHEL 7 with:
> 
> libguestfs-1.20.1-6.el7.x86_64
> util-linux-2.22.1-2.4.el7.x86_64
> 
> What version of util-linux do you have?  Can you try the
> latest in RHEL 7 and see if that fixes the problem?

sorry, i have missed this thread, i will take a further look at this, thanks,

Comment 5 Richard W.M. Jones 2013-07-18 17:13:22 UTC
WFM using:

libguestfs-1.22.2-1.el7.x86_64
util-linux-2.23.1-3.el7.x86_64

so it looks likely that whatever problem happened
with libguestfs/wipefs/util-linux has fixed itself.

Comment 7 bfan 2014-01-09 03:09:08 UTC
Verified with libguestfs-tools-c-1.22.6-17.el7.x86_64

# virt-format -a virt_format.raw --filesystem=ext3 --lvm
# virt-format -a virt_format.raw --filesystem=ext3 --lvm
# 

Works well for trying twice

Comment 8 Ludek Smid 2014-06-13 12:42:50 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.