One of newer additions to VMware Cloud Director (VCD) is the ability to use a VM sizing policy – or VDC Compute Policy – to provide granular resource control on a per VM basis. In this post, I will review how a VCD provider can implement advanced VM properties on a per-workload basis. While this example is SAP HANA specific, this could be used for any additional advanced VM property.
Introduction
In our Cloud Provider Slack workspace, Daniël Zuthof asked about supporting SAP HANA workloads in a VCD platform. SAP has documented several configuration parameters to optimize workload performance in a vSphere-based environment.
Optimizing SAP HANA on vSphere 6.5 and later – Configuration Parameter List
While VCD has flexibility to process VM-specific changes, we typically refrain from making VM-level changes. Daniël specifically asked how we could implement the following in VCD for specific VMs –
- Enable SAP monitoring on the host -> Misc.GuestLibAllowHostInfo and set the value to 1
- Enable SAP monitoring on the guest VM tools.guestlib.enableHostInfo = true
- Edit VMX and add: monitor_control.halt_in_monitor = “TRUE”
- Set ”ethernetX.coalescingScheme” to disable
- Set idleLoopSpinBeforeHalt = “TRUE”
While the first selection is host specific, the other four are VM specific.
VCD VM Policies
To start, VM sizing and placement policies are a new construct within the 10.x releases. What I’ll be showing will work for any version after VCD 10.0.
First off, let’s review both policies. Note these policies are not mutually exclusive: one can use them simultaneously for their specific use case.
VM Placement Policy
Placement policies allow a provider administrator to define the exact placement of a VM within a provider VDC (pVDC). This is used in tandem with VM-host affinity rules and host groups within the backed vCenter instance.
This is typically used for licensing constraints, but could be used for specific hardware requirements.
VM Sizing Policy
A VM sizing policy allows us to scope the resource considerations on a per VM basis. Previously, resource considerations and allocation models are defined at the organization VDC (oVDC) level. Using VM sizing policies allow us to further control granular aspects on a per-workload basis.
While there is a table in our official documentation that discusses all of the attributes, we will be using “extraConfigs” attribute for these SAP HANA parameters –
This Extra Configurations sub-category allows for a provider to define advanced attributes that would be applied to the specific VM. Creating a VM Sizing Policy with this attribute must be done via the API. Let’s review an example next.
Creating a VCD SAP HANA Sizing Policy
In this example, I will be creating a VM sizing policy that includes the specific SAP HANA attributes that were called up above. Moreover, we will also guarantee CPU and memory reservation at 100%.
Swagger UI
While many have seen my posts using Postman to work with the VCD API, I’ll be using the Swagger UI that comes with VCD.
To access the Swagger UI, simply go to the top right corner and select the Question Icon -> API Explorer –
The provider admin can also access the direct API Explorer from the following URL:
https://<VCD-URL>/api-explorer/provider
Scroll down and look for the “vdcComputePolicies” section. This is where we will be creating our first sizing policy.
Creating a VM Sizing Policy with SAP HANA Attributes
Before we create one, let’s use the Swagger UI to view the existing compute policies. Select the GET /1.0.0/vdcComputePolicies and press Try it Out –
Within my environment, we can see all of the compute policies available along with their attributes in JSON format –
Note that existing sizing policies are immutable. The only exception is the description field. This is to prevent cascading changes to associated workloads.
To create a new sizing policy, we will be doing a POST with a specific body. The only mandatory fields are the name and description, but remember once created, other aspects cannot be modified. Below is the reference body –
{ "id": "string", "description": "string", "name": "string", "cpuSpeed": 0, "memory": 0, "cpuCount": 0, "coresPerSocket": 0, "memoryReservationGuarantee": 0, "cpuReservationGuarantee": 0, "cpuLimit": 0, "memoryLimit": 0, "cpuShares": 0, "memoryShares": 0, "extraConfigs": { "additionalProp1": "string", "additionalProp2": "string", "additionalProp3": "string" }, "pvdcComputePolicyRef": { "name": "string", "id": "string" }, "pvdcComputePolicy": { "name": "string", "id": "string" }, "compatibleVdcTypes": [ "string" ], "pvdcId": "string", "namedVmGroups": [ [ { "name": "string", "id": "string" } ] ], "logicalVmGroupReferences": [ { "name": "string", "id": "string" } ], "isAutoGenerated": true }
For my example SAP HANA sizing policy, below is the body I will be using to create a new policy called “SAP HANA – Standard Policy” –
{ "description": "SAP HANA Sizing Policy", "name": "SAP HANA - Standard Policy", "memoryReservationGuarantee": 1, "cpuReservationGuarantee": 1, "extraConfigs": { "tools.guestlib.enableHostInfo": "TRUE", "monitor_control.halt_in_monitor": "TRUE", "ethernet0.coalescingScheme": "disable", "idleLoopSpinBeforeHalt": "TRUE" } }
Now, I am ready to send this to my VCD instance and create the policy. I post the body into the Swagger UI…
Success! We receive a 201 –
From the VCD Provider UI, we now see this as an available sizing policy along with the advanced parameters –
Now, we are ready to assign this to a respective oVDC and create or assign it to our first workload.
Assigning the VCD SAP HANA Sizing Policy
We are now ready to assign the API-created sizing policy to one of my organization VDCs.
Within my oVDC, Daniel-A-0VDC-01, I have several existing sizing policies available. Note that the sizing policy can be selected during the VM or vApp creation workflow.
Let’s press Add and now add our “SAP HANA – Standard Policy” we created in the previous step –
I am also going to set this as my default sizing policy within this oVDC –
SAP HANA Sizing Policy Testing
Finally, let’s test our new policy within the lab environment.
Existing VM Testing
I have an existing vApp – Test2 – that has the default sizing policy (System Default) attached to it with one powered on VM.
Let’s see what happens when we apply the newly created SAP HANA policy to this powered on vApp/VM –
I see the task completed within VCD, but let’s see what happened within the backed vCenter instance.
Excellent! I can see within the Configuration Parameters that the explicit settings were applied.
Now, these applied settings were configured regardless of the VM power state. If a specific attribute requires a VM to be powered off, I would presume this would fail.
New VM Testing
Since we selected the new SAP HANA sizing policy as our default policy, we can see that this is already selected within the workflow –
If one wanted to modify the selection, that could be done via the dropdown menu. As a provider, you have the ability to provide a single sizing policy to enforce these parameters.
As expected, the VM is created with the explicit attributes stated within the policy.
Summary
In closing, this is a great addition for those of you looking for advanced VM-level attributes that may not be presented inside of VCD as of today. I can see solution-specific examples (like this SAP HANA example) along with our telecommunication providers.
Thanks for reading and I’d love to hear about your specific implementation details!
-Daniel
thanks for this article.
good method to implement copy/paste in VMRC, which requires VM customisation to work. Saves a lot of Customer support calls.
https://kb.vmware.com/s/article/57122