Bug 1042780

Summary: Support the virt-sysprep --delete option
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.0CC: leiwang, mbooth, ptoscano, rdoty, sct, sgallagh
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libguestfs-1.27.56-1.1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1041552 Environment:
Last Closed: 2015-03-05 13:43:17 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:

Description Richard W.M. Jones 2013-12-13 10:53:39 UTC
Upstream virt-sysprep has a --delete option which lets you delete
arbitrary paths, files and globs, so giving you pretty much ultimate
flexibility.

This would avoid requests for specific files (see eg. RHBZ#1041552).

Comment 2 jiyu 2014-10-13 05:43:48 UTC
Verified with libguestfs-1.27.62-1.1.el7.x86_64

Steps to verify:
1. Start the guest image and create file .
  [host] #qemu-kvm -m 1024M -smp 4 -drive file=$PWD/RHEL-Server-6.6-64-20140926.0-hvm.raw -vnc :0&
  [guest] #touch /root/test
  [guest] #shutdown -h now

2. Use virt-sysprep with option --delete
  [host] #virt-sysprep  --delete /root/test -a  RHEL-Server-6.6-64-20140926.0-hvm.raw

3. Start the guest image again and check the /root/test file.
  [host] #qemu-kvm -m 1024M -smp 4 -drive file=$PWD/RHEL-Server-6.6-64-20140926.0-hvm.raw -vnc :0&
  [guest] #ll /root/
  total 0

The file /root/test was deleted successfully, so the new feature works well.

Comment 4 errata-xmlrpc 2015-03-05 13:43:17 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-0303.html