vm-copy

Usage

avcli vm-copy --source-vm source --name name [--description "description"] [--cpu number] [--memory memory] [--availability level] [--copy-volumes volumes] [--add-volumes volumes] [--keep-volumes volumes] [--interfaces networks] [--storage-group group] [--no-auto-start]

Description

The vm-copy command copies a VM from the specified VM. If any parameter is not specified, the corresponding value from the source VM is used.

Options

--source-vm source The name or ID of the source VM.
--namename

The name of the VM to create.

--description
"
description"
The description for the new VM.
--cpu number The number of virtual CPUs to assign to the VM.
--memory memory The amount of memory, in megabytes, to assign to the VM.
--availability level The availability level, high availability (ha) or fault tolerant (ft).
--copy-volumes volumes

The list of volumes to copy to the new VM. Specify volumes by configuration name or ID, boot volume first. To copy all of the volumes from the source VM to the new VM with the default values, keep this parameter as blank.

A volume is made up of five components, separated by commas:

  • Volume name or ID of the source volume; required.
  • Storage-group name or ID from which to carve storage.
  • Volume name of the new volume.
  • Volume disk image format (raw or qcow2).
  • Sector size of the volume (512 or 4096).
    • The sector size is in bytes (B), 512 B by default.
    • If the sector size of the storage group is 512 B, the sector size of the volume must be 512 B.

    • If the sector size of the storage group is in 4096 B (4 kB), both 512 B and 4096 B are supported as the sector size of the volume.

    • The boot volume must be presented with 512 B as the sector size.

--add-volumes volumes

The list of volumes to attach to this VM. A volume is made up of five components, separated by commas:

  • Size of the volume; required.
    By default, the volume size is specified in megabytes, but you can use standard qualifiers such as KB, MB, GB, and TB.
  • Storage-group name or ID from which to carve storage.
  • Volume name.
  • Volume disk image format (raw or qcow2).
  • Sector size of the volume (512 or 4096).
--keep-volumes volumes The idle volumes to be attached to the new VM. Specify a volume either by name or ID.
--interfaces networks The list of networks to attach to the VM. Specify a network only once. The attached network must not be private.
--storage-group group The storage group from which to carve the VM volumes. If you do not specify this value, the storage group with the most free space is automatically selected. (If the storage group is configured with 4 kB sectors, ensure that the guest OS supports the 4 kB sector size.

--no-auto-start

If set, the VM is not started after the copy has finished.

Examples

Copy a VM named vm:o2046 to a new vm called new_vm_name and retain all of the original settings.
$ avcli vm-copy --source-vm vm:o2046 --name new_vm_name
Copy a VM named vm_source to a new high availability VM named vm_copy with 2 CPUs and 1,024 MB of memory. Copy the boot volume volume:o7652 to the storage group storagegroup:o129 with the new name vm_source_vol0_bootable_copy, image type of qcow2, and sector size of 512 B. Copy the volume volume:o7749 with the default values. Also, create a new volume named vm_copy_add_new1 with size 20GB to storagegroup:o1090 and set the image type to qcow2 and sector size to 4 kB.
$ avcli vm-copy --source-vm vm_source --name vm_copy --cpu 2 --memory 1024 --availability ha --copy-volumes volume:o7652,storagegroup:o129,vm_source_vol0_bootable_copy,qcow2,512 volume:o7749 --add-volumes 20GB,storagegroup:o1090,vm_copy_add_new1,qcow2,4096
Copy a VM named vm_source to a new high availability VM named new_vm_name with 2 CPUs and 1,024 MB of memory. Copy the boot volume boot_volume to the Initial-Storage-Group with the new name boot_volume_copy and the image type of raw. Copy the volume volume:o10158 with the default values. Create a new volume named volume_new1 with size 20GB to storagegroup:o71 and set the image type to qcow2 and sector size to 4 kB. Attach two idle volumes, volume_idle and volume:o19656. In addition, configure network interfaces network0 and sharednetwork:o61, set the default storage group to storagegroup:o71, and prevent the VM from automatically starting upon creation.
$ avcli vm-copy --source-vm vm_source --name new_vm_name --cpu 2 --memory 1024 --availability ha --copy-volumes boot_volume,Initial-Storage-Group,boot_volume_copy,raw volume:o10158 --add-volumes 20GB,storagegroup:o71,volume_new1,qcow2,4096 --keep-volumes volume_idle volume:o19656 --interfaces network0 sharednetwork:o61 --storage-group storagegroup:o71 --no-auto-start