Blog from April, 2020

We are pleased to announce we released the ITS Cloud API v3.8.1ย with the following improvements and bug fixes:

Improvements

HA Group migration from UUID to Moref (#1313)ย 

Endpoints

  • /v2/vm/<vm-id>/vss/ha-group (GET, PUT, PATCH)

Description

We were using UUIDs as VM identifier which were taking too much space to store in the annotation field (24 chars each). If you have multiple VMs within a single HA Group, let's say 5, there's going to be 5x24 chars of space used. Also,ย UUIDs cannot be accessed within the vSphere client. Meaning that if you cut and paste a single UUID, and paste into the vSphere Client URL, it won't be accessible.ย 

In order to mitigate above described situation, we have replaced the use of UUIDs in HA Groups withย Managed Object Reference IDs (Morefs). Morefsย are VM identifiers as well and widely used by vCenter API, vSphere client, etc. Morefs are more user friendly structured as vm-NNNN. In the Virtual machine annotation field (where we store VM's metadata aka `/vss`), will change:

From:ย 

UTvssHAGroup: 5012db5c-57a0-7bd2-49a5-665d3b406670,5012f72a-f9c7-366f-5cf0-e1ac6afe4466,50120c23-4c9a-ab78-af30-8f74768ed011

To:

UTvssHAGroup: vm-12086,vm-12077,vm-12085

With this change we have optimized the space in the annotation field and have provided a reference accessible from the vSphere client. For instance by just replacing the <VM-MOREF> variable in the following link, you will be able to quickly identify the vm that belongs to an ha-group:

https://vctr5-1.dcb.eis.utoronto.ca/ui/#?extensionId=vsphere.core.vm.summary&objectId=urn:vmomi:VirtualMachine:<VM-MOREF>:<VC-ID>&navigator=vsphere.core.viTree.vmsAndTemplatesView

Although we have migrated all the current VMs with ha-groups, the VSS API has a resource to perform migrations which will update the vm in question and all members of the HA Group:

PATCH /v2/vm/<vm-id>/vss/ha-group

HA Group creation using UUIDs still works but morefs will be stored in the annotation field


Add moref to Inventory resource (#1323)

Endpoints

  • /v2/inventory

Description

Inventory files will include moref as well as uuid as default virtual machine identifiers.

Get VM info to provide moref in response (#1320)

Endpoints

  • /v2/vm/<vm-id>

Description

Addsย morefย to response payload.


Store vm_moref in Virtual Machine related requests (#1315)

Endpoints

  • /v2/request/<request-type>

  • /v2/request/<request-type>/<request-id>

Description

Addsย morefย to response payload.

Bug Fixes

HA Group resource cache clearing (#1322)

Endpoints

  • /vm/<vm-id>/vss/ha-group (PUT, DELETE, PATCH)

Description

HA group application cache resource was not cleared after task completed.

VSS-CLI v0.7.0ย is available for download viaย PyPIย orย GitLab. Latest version includes the following improvements and bug fixes:

Managed Object Reference Identifier for Virtual Machines

UUIDs have been always too hard to manage. They are long and sometimes meaningless but originally the ideal way to identify and efficiently look up a virtual machine in vCenter. However, earlier this year we have added support to the VSS API to lookup and identify virtual machine objects with its Managed Object Reference Identifier (moref).ย Every object within a vSphere environment is internally tracked, and referred to, by a unique identifier called moref. If you are familiar with other virtual infrastructure objects such as clusters, networks, folders and so on, they have a moref. In the search for a better user experience, we have decided to prioritize the vSphere identifier (moref) over the UUID which brings an additional level of interoperability between the ITS Private Cloud components (VSS CLI, PyVSS and VSS API) with the vCenter REST API and ease of use to the vss-cli.

Version 0.7.0 adds support to handle virtual machine commands with VM morefs in addition to UUID and Name. UUIDs will be marked as deprecatedย and will be removed in a future version of the vss-cli but for now, backwards compatibility is provided. This means the vss-cli supports both MoRef and UUID as virtual machine identifiers. Again, the VSS API, VSS CLI and PyVSS will still be working with UUIDs but we are planning to stick with morefs.

Improvements

List VM command adds moref to default attributes (#278)

Commands:

  • compute vm ls

For example

vss-cli compute vm ls -f name=Front

moref    name             folder.path                  cpu_count    memory_gb  power_state    ip_address
-------  ---------------  -------------------------  -----------  -----------  -------------  ------------
vm-2183  2004T-Frontend2  VSS > Development > Dev02            2            2  poweredOff
vm-2185  2004T-Frontend3  VSS > Development > Dev03            1            1  poweredOn

Get VM info command adds support to use morefย in addition to name and uuid (#279)

Get VM info command adds `moref` attribute (#283)

Commands:

  • compute vm get

The following command demonstrates how to get basic Virtual Machine summary with its moref.

vss-cli compute vm get vm-2183

moref               : vm-2183
uuid                : 50309a8a-88ca-5291-2ad3-63f2522c3f8e
name                : 2004T-Frontend2
folder.path         : VSS > Development > Dev02
guest_id            : centos8_64Guest
version             : vmx-15
overall_status      : green
power_state         : poweredOff
alarms              : False
cpu                 : 2
memory_gb           : 2.0
provisioned_gb      : 82.18
snapshot            : True
disks               : 1, 2
nics                : 1
floppies            : 1

Update VM command adds support to use moref in addition to name andย uuid (#280)

Commands:

  • compute vm set

Updating any vm attribute works with managed object reference id:

vss-cli compute vm set --wait vm-2183 cpu count 2

id                  : 186
status              : IN_PROGRESS
task_id             : 06acfd3e-3278-4123-af8d-7e17aa07aed9
message             : Request has been accepted for processing
โณ Waiting for request 186 to complete...
๐ŸŽ‰ Request 186 completed successfully:
warnings            : New CPU is 2
errors              :

Decommission VM command adds support to use moref and name in addition to uuid (#284)

Commands:

  • compute vm rm

Decommissioning virtual machines is easier now. The command now has autocompletion and supports both vm identifiers (moref, uuid) and name:

vss-cli compute vm rm --wait vm-2173 vm-2180 1908Q-VM-2

  id  status       task_id                               message
----  -----------  ------------------------------------  ----------------------------------------
 191  IN_PROGRESS  526ec374-4cbc-49f5-a91b-d9e3927711de  Request has been accepted for processing
 192  IN_PROGRESS  6398c56b-bf95-4307-acd2-ecaaad483c56  Request has been accepted for processing
 193  IN_PROGRESS  c8f4b4c8-f6b7-4117-b0b6-20685eb0c2bf  Request has been accepted for processing

โณ Waiting for request 191 to complete...
โณ Waiting for request 192 to complete...
โณ Waiting for request 193 to complete...
๐ŸŽ‰ Request 191 completed successfully:
warnings            : Virtual Machine has been deleted.
errors              :
๐ŸŽ‰ Request 193 completed successfully:
warnings            : Virtual Machine has been deleted.
errors              :
๐ŸŽ‰ Request 192 completed successfully:
warnings            : Virtual Machine has been deleted.
errors              :

VM requests commands provideย  vm_moref (#287)

Commands:

  • request new ls
  • request change ls
  • request export ls
  • request snapshot ls

The vm_moref attribute has been added to the request objects and shown as follows.

vvss-cli request new ls -f vm_name=Front

  id  created_on                   updated_on                   status     vm_moref    vm_name           approval.approved    built_from
----  ---------------------------  ---------------------------  ---------  ----------  ----------------  -------------------  ------------
  75  2020-04-24 Fri 15:36:20 EDT  2020-04-24 Fri 15:36:22 EDT  PROCESSED  vm-2182     2004T-Frontend-1  True                 os_install
  76  2020-04-24 Fri 16:36:15 EDT  2020-04-24 Fri 16:37:31 EDT  ERROR      vm-2183     2004T-Frontend2   True                 clone
  78  2020-04-24 Fri 17:06:49 EDT  2020-04-24 Fri 17:06:51 EDT  PROCESSED  vm-2185     2004T-Frontend3   True                 os_install

vss-cli request change ls -f vm_name=Front

  id  created_on                   updated_on                   status     vm_moref    vm_name           approval.approved    attribute
----  ---------------------------  ---------------------------  ---------  ----------  ----------------  -------------------  -----------
 183  2020-04-27 Mon 16:29:06 EDT  2020-04-27 Mon 16:29:06 EDT  PROCESSED  vm-2182     2004T-Frontend-1  True                 template
 185  2020-04-28 Tue 10:28:23 EDT  2020-04-28 Tue 10:28:24 EDT  PROCESSED  vm-2183     2004T-Frontend2   True                 cpu
 186  2020-04-28 Tue 10:28:31 EDT  2020-04-28 Tue 10:28:32 EDT  PROCESSED  vm-2183     2004T-Frontend2   True                 cpu

Virtual Machine HA-Group mk command support for moref or name (#281)

Virtual Machine HA-Group get command support for moref or name (#282)

Commands:

  • compute vm set ha-group mk
  • compute vm get ha-group

Create a virtual machine ha-group with morefs or names:

vss-cli compute vm set --wait vm-2183 ha-group mk vm-2185

id                  : 195
status              : IN_PROGRESS
task_id             : d7adc2cd-1e83-42de-bf85-75ec159d512f
message             : Request has been accepted for processing
โณ Waiting for request 195 to complete...
๐ŸŽ‰ Request 195 completed successfully:
warnings            : New VM HA Group updated on vm-2183 to vm-2185, vm-2183, New VM HA Group updated on vm-2185 to vm-2185, vm-2183
errors              :

vss-cli compute vm get vm-2185 ha-group

moref    name             VALID
-------  ---------------  -------
vm-2183  2004T-Frontend2  False
vm-2185  2004T-Frontend3  False

Virtual Machine HA-Group mg for existing ha-group migrationย (#294)

Commands:

  • compute vm set ha-group mg

Although all existing HA Groups have been migrated to the new Moref format, we have created a command to migrate existing vm with ha-group:

vss-cli compute vm set --wait vm-2183 ha-group mg

Get quick link to vSphere Client from vss-cli (#286)

Commands:

  • compute vm get vsphere-link

The command allows to generate and launch a vSphere client link to a given virtual machine:

Usage: vss-cli compute vm get vsphere-link [OPTIONS]

  Get vSphere Client Link to VM

Options:
  -l, --launch  Launch link to default handler
  --help        Show this message and exit.

vss-cli compute vm get Frontend vsphere-link --launch

value               : https://vcenter-lab.eis.utoronto.ca/ui/#?extensionId=vsphere.core.inventory.serverObjectViewsExtension&objectId=urn:vmomi:VirtualMachine:vm-2183:f699427d-21a0-4509-8184-dff02273538a&navigator=vsphere.core.viTree.vmsAndTemplatesView

Updated documentation to prioritize moref over uuid (#293)

Update pyvss from 0.13.1-> 0.14.1 (#285)

Update click-spinner fromย v0.1.8 -> v0.1.10 (#291)

Bug Fixes

Missing autocompletion for request new get command (#289)

Missing autocompletion for request snapshot get command (#290)

Upgrade

Remember, VSS-CLI documentation is now available inย VSS-CLIย and the fullย Change Logย is available here.ย Upgrade or install VSS-CLI as follows:

# using vss-cli
vss-cli upgrade 

# upgrade with pip
pip install vss-cli --upgrade

# install
pip install vss-cli 


For more information, please refer to the official documentationย site.

VSS-CLI v0.6.2ย is available for download viaย PyPIย orย GitLab. Latest version includes the following improvements and bug fixes:

Improvements

VM deployment option to power on vm after deployment --power-on (#268)

Commands:

  • compute vm mk from-clone
  • compute vm mk from-template
  • compute vm mk from-image
  • compute vm mk shell
  • compute vm mk from-spec
  • compute vm mk from-file

Option --power-on allows new virtual machine deployment to turn on after successful deployment.

vss-cli compute vm mk from-clone -s 2001D-ubuntu-tmpl --custom-spec '{"hostname": "fe1", "domain": "eis.utoronto.ca", "interfaces": [{"dhcp":true}]}' --power-on --description 'testing deployment' front-end-1

Completion support for Fish (#270)

Commands:

  • completion

Enable completion for shell with any of the following methods:

1. Add this to ~/.config/fish/completions/vss-cli.fish

eval (env _VSS_CLI_COMPLETE=source_fish vss-cli) 

2. Alternatively, export the generated completion code as a static script to be executed as follows:

 _VSS_CLI_COMPLETE=source_fish vss-cli > ~/.config/fish/completions/vss-cli.fish

After enabling auto-completion for fish, you could get something like:

Table format option --table-format allows recently introduced "pretty" (#274)

Commands:

  • (*) ls

Option --table-format takesย pretty option to format output table

vss-cli --columns moref,name,folder.path,power_state --table-format pretty compute vm ls -f name=ubu
+----------+--------------------------+--------------------------------+-------------+
|  moref   |           name           |          folder.path           | power_state |
+----------+--------------------------+--------------------------------+-------------+
| vm-17870 |  2004T-ubuntu-clone-po   |  VSS > Sandbox > jm > APIDemo  | poweredOff  |
| vm-11955 |  1802D-from-ubuntu-tmpl  | VSS > Sandbox > jm > Templates | poweredOff  |
| vm-17016 |    2001D-ubuntu-clone    |  VSS > Sandbox > jm > APIDemo  | poweredOff  |
| vm-13816 |       1811D-ubuntu       | VSS > Sandbox > jm > Templates | poweredOff  |
| vm-17716 | 2004D-ubuntu-clone-clone |  VSS > Sandbox > jm > APIDemo  | poweredOff  |
+----------+--------------------------+--------------------------------+-------------+

VMware Paravirtual SCSI controller migration how-to (windows) (#265)

Update from 0.13.0-> 0.13.1 (#267)

Update click from 7.0.0 -> 7.1.1 (#269)

Update pick 0.6.6 -> 0.6.7 (#271)

Update validators 0.14.2 -> 0.14.3 (#272)

Update tabulate 0.8.6 -> 0.8.7 (#273)

Update dateparser 0.7.2 -> 0.7.4 (#275)

Update ruaml.yaml 0.16.5 -> 0.16.10 (#276)

Upgrade

Remember, VSS-CLI documentation is now available inย VSS-CLIย and the fullย Change Logย is available here.ย Upgrade or install VSS-CLI as follows:

# using vss-cli
vss-cli upgrade 

# upgrade with pip
pip install vss-cli --upgrade

# install
pip install vss-cli 


For more information, please refer to the official documentationย site.