Bug 1046905

Summary: RFE: add argument to virt-sysprep to disable individual default operations
Product: [Community] Virtualization Tools Reporter: Dominic Cleal <dcleal>
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, mbooth, ptoscano
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-13 14:27:10 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 Dominic Cleal 2013-12-27 10:58:15 UTC
Description of problem:
virt-sysprep either runs with all default operations or a selected list of operations with the --enable argument.  A few times I've found I'd like to use the default list, but minus one or two operations in particular, however there's no easy way to specify this.

A --disable argument that took the default operation list and skipped selected operations would be useful.

Version-Release number of selected component (if applicable):
libguestfs-tools-1.22.7-4.fc19.x86_64

Comment 1 Richard W.M. Jones 2014-01-02 12:58:43 UTC
Note this is possible already by running this non-obvious command:

ops=`virt-sysprep --list-operations | fgrep ' * ' | grep -v tmp-files | awk -vORS=, '{print $1}' | sed 's/,$/\n/'`
virt-sysprep --enable $ops -a disk.img

(runs all default operations except tmp-files)

Pino can have a look at this, as a low priority.

The reason this wasn't implemented initially is that
it's not clear what the semantics are when people start
to use multiple --disable and --enable options, or use
both options together, or they think that order matters.

Likely any attempt to use multiple --enable and/or --disable
options should be rejected.

Comment 2 Dominic Cleal 2014-01-02 14:16:39 UTC
Yes, I've been doing something similar, but it's not terribly elegant.  Having --enable/disable options be exclusive would be perfectly acceptable for me.

Comment 3 Pino Toscano 2014-01-13 14:27:10 UTC
This is fixed with
https://github.com/libguestfs/libguestfs/commit/efb5f1841524ec75d765368b447270b8a3aff8ac
which is in libguestfs >= 1.25.21.

Basically (back to Richard's example in #c2) now you can do:
  virt-sysprep --operations defaults,-tmp-files ...
to execute all the default operations (i.e. those that would be executed specifying no --enable/--operations) minus the tmp-files one.