mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
virt-clone: add --skip-copy option
This is the flip side to the --force-copy option. We already have the plumbing internally https://bugzilla.redhat.com/show_bug.cgi?id=1564865
This commit is contained in:
parent
44cf01cee1
commit
4973564e65
@ -100,6 +100,13 @@ Force cloning the passed disk target ('hdc', 'sda', etc.). By default,
|
||||
C<virt-clone> will skip certain disks, such as those marked 'readonly' or
|
||||
'shareable'.
|
||||
|
||||
=item B<--skip-copy> TARGET
|
||||
|
||||
Skip cloning the passed disk target ('hdc', 'sda', etc.). By default,
|
||||
C<virt-clone> will clone certain disk images, typically read/write
|
||||
devices. Use this to skip copying of a specific device, so the new
|
||||
VM uses the same storage path as the original VM.
|
||||
|
||||
=item B<--nonsparse>
|
||||
|
||||
Fully allocate the new storage if the path being cloned is a sparse file.
|
||||
|
@ -1273,6 +1273,7 @@ c.add_valid("-o test --auto-clone") # Auto flag, no storage
|
||||
c.add_valid("-o test --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s") # Nodisk, but with spurious files passed
|
||||
c.add_valid("-o test --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --prompt") # Working scenario w/ prompt shouldn't ask anything
|
||||
c.add_valid("--original-xml " + _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s") # XML File with 2 disks
|
||||
c.add_valid("--original-xml " + _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --skip-copy=hda") # XML w/ disks, skipping one disk target
|
||||
c.add_valid("--original-xml " + _CLONE_UNMANAGED + " --file virt-install --file %(EXISTIMG1)s --preserve") # XML w/ disks, overwriting existing files with --preserve
|
||||
c.add_valid("--original-xml " + _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --file %(NEWCLONEIMG3)s --force-copy=hdc") # XML w/ disks, force copy a readonly target
|
||||
c.add_valid("--original-xml " + _CLONE_UNMANAGED + " --file %(NEWCLONEIMG1)s --file %(NEWCLONEIMG2)s --force-copy=fda") # XML w/ disks, force copy a target with no media
|
||||
|
@ -113,6 +113,10 @@ def parse_args():
|
||||
stog.add_argument("--force-copy", dest="target", action="append",
|
||||
help=_("Force to copy devices (eg, if 'hdc' is a "
|
||||
"readonly cdrom device, --force-copy=hdc)"))
|
||||
stog.add_argument("--skip-copy", action="append",
|
||||
help=_("Skip copy of the device target. (eg, if 'vda' is a "
|
||||
"disk you don't want to copy and use the same path "
|
||||
"in the new VM, use --skip-copy=vda)"))
|
||||
stog.add_argument("--nonsparse", action="store_false", dest="sparse",
|
||||
default=True,
|
||||
help=_("Do not use a sparse file for the clone's "
|
||||
@ -176,6 +180,8 @@ def main(conn=None):
|
||||
design.reflink = True
|
||||
for i in options.target or []:
|
||||
design.force_target = i
|
||||
for i in options.skip_copy or []:
|
||||
design.skip_target = i
|
||||
design.clone_sparse = options.sparse
|
||||
design.preserve = options.preserve
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user