/
Export virtual machines with the vss-cli

Export virtual machines with the vss-cli

The export virtual machine feature automates the Export process generating an Open Virtualization format (OVF) and then transferring the resulting files to your personal account space in VSKEY-STOR.

A virtual machine qualifies to be exported if:

  • Committed storage (not provisioned) is less than 300G.

  • Power state is Off.

  • No iso backing on CD/DVD unit

We use thin provisioning on the ITS Private Cloud to help avoid over-allocating storage space and save storage.

Thin provisioning uses just as much storage capacity as currently needed and then add the required amount of storage space at a later time. (Source: VMware).

This tutorial walks you through the process of exporting a given virtual machine.

Validate virtual machine

First, we need to double check if the committed_gb size is lower than 300GB. This can be done by executing the command vss-cli compute vm ls but modifying the output columns with the --columns option as follows:

vss-cli --columns "moref,name,folder.path,provisioned_gb,committed_gb,power_state" compute vm ls -f moref=vm-10342 moref name folder.path provisioned_gb committed_gb power_state --------- ------------------ ------------------------ ---------------- -------------- ------------- vm-123456 2210P-FrontEnd-1u0 Public > Customer 123456 60 19.67 poweredOn

In this particular case, we can proceed since the committed space is lower than 300GB.

If the virtual machine power_state is poweredOn, shut it down by sending a shutdown signal through the OS via VMware Tools or a hard power off as follows:

vss-cli compute vm set <name-or-vm-id> state shutdown Host Name: ubuntu (Ubuntu Linux (64-bit)) IP Address: 192.168.2.100, fe80::250:56ff:fe92:d463 Are you sure you want to change the state from "running to shutdown" of the above VM? [y/N]: y

Finally, verify if the VM’s CD/DVD unit is not backed by an ISO image file:

vss-cli compute vm get <name-or-vm-id> cd label backing connected -------------- --------- ------------ CD/DVD drive 1 client disconnected

Execute vss-cli compute vm set <name-or-vm-id> cd <unit> --iso client if an ISO image is shown in CD backing.

Export virtual machine

Run vss-cli compute vm set <name-or-vm-id> export to submit an export task. The command does not require any argument or options.

Once the command is executed, a VM Export Request is created and all related activity including export status is recorded in it. To check the status, execute vss-cli request export get <request-id>.

The request object holds more attributes, however the above listed are more important for this example. status=Processed tells us that the request has been completed. transferred=yes indicates that resulting files were successfully transferred to your VSKEY-STOR space. To confirm, you could either go to a web browser and open VSKEY-STOR and sign in or execute vss-cli stor ls <vm-id> and you should get something like:

Download virtual machine export

To download the files you could either go to a web browser and open VSKEY-STOR and sign in, go to the <vm_name-vm_id> folder and download the files or execute vss-cli stor dl <vm_name-vm_id>/<file> as follows:

Alternatively, you could just launch the web UI via the la command and browse the ut-vss bucket to download the files via your web browser:

That’s it, at this point the OVF and disks are ready to be imported to a desired platform.

Related content

How-to archive a Virtual Machine
How-to archive a Virtual Machine
More like this
Deploy Instance from Image with the vss-cli
Deploy Instance from Image with the vss-cli
More like this
How-to Import large Virtual Machines into the ITS Private Cloud
How-to Import large Virtual Machines into the ITS Private Cloud
More like this
How-to Create Virtual Machines
How-to Create Virtual Machines
More like this

University of Toronto - Since 1827