So...I made some progress in digging into this issue:
- Check out my other post: Re: vRA 7.4 Custom Forms and Custom Properties
- The Constrains work for the normal integer field just fine. Just not for Memory and CPU (BUG!)
- Creating integer custom property only lets you choose Sting values on the canvas
- Using Custom Properies such as VirtualMachine.Memory.Size or VirtualMachine.CPU.Count in the Custom Forms result in allocation error.
What works..but its bloody stupid is the following:
- Create two integer fields in the Custom Form, put external restrictions on it as required.
- create an workflow where you link the integer fields to the custom properties VirtualMachine.Memory.Size and VirtualMachine.CPU. (See attached...you can get LogAllProps here: logAllProps). Please not that you integer field will have a different FieldID.
- Create an Subscription to PRE VMPSMasterWorkflow32.BuildingMachine (block) and the workflow
- Add the custom Property Extensibility.Lifecycle.Properties.VMPSMasterWorkflow32.BuildingMachine with value * to your VM blueprint
The two MAJOR problem with that method.
1) it goes behind vRAs Resource Management system. vRA will thing that you are provisioning a VM with 1CPU and 1GB...but then you change it before its build...so you have to be careful with that.
2) the Values of the VCACVM entity isn't updated....so you need to add a function to update them as well.
preVMBuild.workflow.zip 6.6 K
1 person found this helpful
You can workaround this by using External Validations tab.
- Create vRO action which accepts a number parameter and returns a string
- Open the Designer and click on the External Validations tab
- Add new custom validation and search for your action
- For the input parameter select the CPU
- If you want the validation to be triggered, in the vRO action return a string with the error message. If you return null or empty sting the value will be considered as valid.
The custom validation will be triggered when the submit button is clicked, and all other validations are executed before that.
For more details you can look at my blogpost for using the Custom Forms at: Customizing request forms using the new Custom Forms - VMware Cloud Management
You can find more details for the Custom Validations at the end of the blogpost.