Reconfiguring VM from inline automate script


I’m trying to duplicate the VM reconfigure menu within a service dialog. I’m doing this since I’ll be hosting several tenants on the same vCenter using the same DVS, and I need to restrict which VLANs each can see. This logic isn’t available in the reconfigure menu.

The part I’m stuck on is instantiating a vm_reconfigure_request object. I’m assuming that once I create the request object, populate the necessary attributes, and run it the code within it will step through the request approval logic and, if successful, execute the vm_reconfigure_task.

Are there any examples of instantiating a new request object from within an inline script? Thoughts on other ways to accomplish the above goal are also welcome.

1 Like

You could tag VLANs and groups to restrict VLAN access.

I’m not sure what reconfigure menu you want to duplicate, as VM reconfiguration supports only RAM, CPU and disks changes for vCenter.

For clarity, I’m using RH Cloudforms. I’m surprised that isn’t available: I figured if anything Cloudforms would have less functionality than ManageIQ since it’s downstream from it.

I did try tagging VLANs but that didn’t affect which VLANs were displayed in the ‘VM Reconfigure’ menu.

This feature was added recently and I missed it in my aging appliance, sorry.

You can create provisioning request but the request type is VmReconfigureRequest in your case (just checked in Rails console). I don’t think this can be created from automation engine or API.
It does not seem to be exposed to $evm.execute in MiqAeServiceMethods, only prov request and automation request.

Unfortunately only set_number_of_cpus, set_memory, add_disk and remove_disk methods are exposed on VM object side. I expect this to be extended to include add_network_adapter and remove_network_adapter in the future. You can create a feature request but this will take time to land in the product (CF).

Let me check the tagging for you.

I did try tagging VLANs and neither provisioning nor reconfiguring dialogs filter by them :frowning:

Your method of creating custom automation dialogs and methods can work, and you can directly call vCenter API, some old samples here: CloudFormsPOC

Thanks for looking into that. I contacted our rep at RedHat and asked them to submit a feature request to add VLAN tagging via the GUI and have that vm reconfigure menu filter VLANs based on tag. I imagine it’ll take a long time to get noticed / integrated into CF like you said.

The problem with calling the API directly is that I’d like to use the quota / approval mechanisms for the CPU/Mem/disk additions. Calling the vCenter API would bypass those, so I’m going to hold off on this for the time being.