Categories
Aria Automation VMware

Aria Automation vCenter VM Folder Picker

VMware Aria Automation developers sometimes require the ability for their customers to easily select which vCenter folder to build a virtual machine in via a custom form. Dropdowns or combo boxes can provide a searchable folder list, but there’s no user experience more native than a tree picker.

The root challenge to solve is passing a full VM folder path string to the Cloud Template during provisioning so vCenter knows where to build the virtual machine. Unfortunately, the Tree Picker field doesn’t natively output a full path string, so there’s some work to be done.

In this post, I will step through an in-depth tutorial on configuring a VM folder tree picker, converting the selected folder into a full path string via an Orchestrator action, and then passing the output into a Cloud Template for provisioning.

We’ll be working with a custom form in Service Broker, creating an Action in Orchestrator, and consuming the output in a Cloud Template. Here’s a diagram of what we’ll build:

We begin our work in a cloud template inside Aria Automation Assembler.

Assembler

I have a Cloud Template with a Cloud Machine resource type and many properties defined, but in this scenario, we’re only concerned with the folderName property. What’s important is that the property only accepts a String as an input.

The the sake of an the example, here’s what a bare-bones cloud template looks like, provisioning a virtual machine straight into a static-defined folder, where the VM would be provisioned into the same folder each time:

Virtual_Machine:
    type: Cloud.Machine
    properties:
      folderName: "Datacenters/DC-TAM-Lab/vm/MGMT"

If you’re curious to further understand resource types and what properties can be configured on them, refer to the Aria Automation Resource Type Schema documentation on developer.vmware.com.

We’ll convert folderName to a dynamic value (something the custom form user can choose) by first creating a new vCenter Folder input. The input much be of the type string, and then we need to assign the input value to the folderName property via ${input.vCenterFolder}.

inputs:
  vCenterFolder:
    type: string
    title: vCenter Folder
    default: n/a

Virtual_Machine:
    type: Cloud.Machine
    properties:
      folderName: ${input.vCenterFolder}

Now, the folderName property will accept any string value passed to it from the input field. There are a few caveats to keep in mind:

  • The folderName path is case sensitive: Datacenters/DC-TAM-Lab/vm/MGMT is different from Datacenters/DC-TAM-Lab/vm/mgmt.
  • The full path is required.

Fortunately, the nature of this configuration will address both of these.

Service Broker

After Saving and Importing your Content Source, open and edit the Custom Form for this Cloud Template. Drag the vCenter Folder Schema Element onto the form. Secondly, drag a Tree Picker from Generic Elements onto the form, providing it with a name, such as Folder.

The Tree Picker field Appearance Reference type property needs to be set to: VC:VmFolder. This property is what tells the Tree Picker what types of objects are selectable by the end user.

The vCenter Folder field will not need to be visible to the end user once complete, but we’ll leave it in place for testing and demonstration purposes for now.

Now, save the custom form and test. The Tree Picker will allow us to choose the folder of our choice. However, the hidden vCenter Folder text field will remain blank, which is ok and expected.

Orchestrator

We now need to create an Orchestrator action to accept the chosen folder object and return the full folder path back to the custom form’s hidden field. Head over to Orchestrator and create a new Action; mine is named convertFolderToPath.

First, set the Return type to string, then create a single input named folder with the type VC:VmFolder.

The Javascript to covert the folder to a full path string is fairly straightforward. We iterate backward through the VM folder structure, from the folder that we want to place the virtual machine into, through each parent folder, until reaching the root folder. We then join the folders together to create and return the full folder path.

Here’s the code:

if (folder != null) {
    // Initialize an array to store folder names
    var folderNames = [];

    // Iterate through the parent folders, adding each folder name to the array
    while (folder != null) {
        folderNames.unshift(folder.name); // Add the folder name to the beginning of the array
        folder = folder.parent; // Move to the parent folder
    }

    // Join the folder names with '/' to create the folder string
    var folderString = folderNames.join('/');

    // Return the folder string
    return folderString;
}

Saving and running the Action will allow us to quickly select a folder and verify that the full path is returned:

Now, for the final step, we need to go back to the custom form in Service Broker to glue everything together, by binding the newly created action to the hidden text field.

On the hidden vCenter folder text field, set the Values Select action to the name of the recently created action. Secondly, set the Value Action inputs folder field to the Folder field. This step binds the action input to the user-selected VM folder.

Save the custom form, and we’re ready to test.

vCenter Folder will be the full folder path string generated from the Tree Picker and is unnecessary to show the end user, so it can be hidden. Go back to the custom form and set the element Appearance Visibility property to No.

At this point – the job is done.

As you can see, with minimal effort, we can build a rich user experience and a more dynamic custom form.

Categories
VMware

vCenter Server Installer Deployment Size Error

I ran into the following error while deploying a vCenter Appliance via Rocky Linux:

A problem occurred while reading the OVA file.:
TypeError: Cannot read properties of undefined (reading 'length')

The installer log file can be found in the directory /tmp/vcsaUiInstaller and running cat installer-*.log shows:

2024-01-07T19:27:44.519Z - debug: Deployment size page description: Select the deployment size for this vCenter Server.
2024-01-07T19:27:44.519Z - info: ovftoolCmd: /home/vmware/Downloads/VCSA/vcsa/ovftool/lin64/ovftool
2024-01-07T19:27:44.520Z - debug: ovaFileNameRe: /.*_OVF10.ova$/
2024-01-07T19:27:44.520Z - debug: files in /home/vmware/Downloads/VCSA/vcsa: VMware-vCenter-Server-Appliance-8.0.2.00100-22617221_OVF10,VMware-vCenter-Server-Appliance-8.0.2.00100-22617221_OVF10.ova,ovftool,version.txt
2024-01-07T19:27:44.520Z - info: ovaFile: /home/vmware/Downloads/VCSA/vcsa/VMware-vCenter-Server-Appliance-8.0.2.00100-22617221_OVF10.ova
2024-01-07T19:27:44.543Z - info: probeOvf exited with status 127
2024-01-07T19:27:44.544Z - debug: probeRes: 
2024-01-07T19:27:44.547Z - info: layout file: /home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/resources/layout.json
2024-01-07T19:27:44.548Z - error: probeOvf unexpected error: TypeError: Cannot read properties of undefined (reading 'length')
    at push../application/app/core/ovf-probe.service.ts.OvfProbeService.parseDeploymentOptions (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:3656:52)
    at push../application/app/core/ovf-probe.service.ts.OvfProbeService.probeOvf (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:3605:38)
    at push../application/app/pages/select-size/select-size-v1.ts.SelectSizePageV1.getProfileLayoutData (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:29702:50)
    at push../application/app/pages/select-size/select-size-v1.ts.SelectSizePageV1.onLoad (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:29545:14)
    at push../application/app/wizard/vcsa-wizard.ts.VcsaWizard.onLoad (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:38105:26)
    at VcsaWizard_ng_container_14_clr_wizard_page_1_Template_clr_wizard_page_clrWizardPageOnLoad_0_listener (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/main.js:38065:826)
    at executeListenerWithErrorHandling (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/vendor.js:29613:16)
    at wrapListenerIn_markDirtyAndPreventDefault (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/vendor.js:29648:22)
    at SafeSubscriber.schedulerFn [as _next] (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/vendor.js:40205:17)
    at push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (file:///home/vmware/Downloads/VCSA/vcsa-ui-installer/lin64/resources/app/dist/vendor.js:140635:16)
2024-01-07T19:27:44.548Z - error: OVF probe error: TypeError: Cannot read properties of undefined (reading 'length')

At first glance, the error reads as if there’s a permissions issue on the layout.json file, but after double-checking, the permissions are correct.

I then ran ovftool to ensure it wasn’t having issues:

[vmware@console lin64]$ ./ovftool
./ovftool.bin: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

The error shows that libnsl is missing, so I installed it via dnf install libsnl:

[root@console vcsaUiInstaller]# dnf install libnsl
Last metadata expiration check: 0:40:08 ago on Sun 07 Jan 2024 02:22:58 PM EST.
Dependencies resolved.
===========================================================================================================================================================================
 Package                                Architecture                           Version                                        Repository                              Size
===========================================================================================================================================================================
Installing:
 libnsl                                 x86_64                                 2.34-83.el9.7                                  baseos                                  77 k

Transaction Summary
===========================================================================================================================================================================
Install  1 Package

Total download size: 77 k
Installed size: 99 k
Is this ok [y/N]: y
Downloading Packages:
libnsl-2.34-83.el9.7.x86_64.rpm                                                                                                            150 kB/s |  77 kB     00:00    
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                      108 kB/s |  77 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                   1/1 
  Installing       : libnsl-2.34-83.el9.7.x86_64                                                                                                                       1/1 
  Running scriptlet: libnsl-2.34-83.el9.7.x86_64                                                                                                                       1/1 
  Verifying        : libnsl-2.34-83.el9.7.x86_64                                                                                                                       1/1 

Installed:
  libnsl-2.34-83.el9.7.x86_64                                                                                                                                              

Complete!

I didn’t need to restart the installer, just went back one screen, then tried again – and it worked.

Categories
Aria Automation VMware

Aria Automation custom form Active Directory OU lookup

I recently ran into a fun challenge while working on an Aria Automation (formerly vRealize Automation) Windows Server build automation project. I needed to dynamically build a dropdown menu of Active Directory organizational units (OUs) for a user to select where the server’s computer object would reside once provisioned.