One topic that seems to come up occasionally since it was disabled by default (KB2097593) is what people are doing with TPS. It seems to becoming common for companies to want to sweat their assets more now so making use of features to maximize the resources within an environment makes sense. But there are cases where it may not be desirable to be enabled for a specific VMs, or just enable certain ones in a certain “zone” to be able to share.
Since getting more hands on with vRA/vRO over the past few months I’ve been looking quite a lot at the “Resource Actions”, these are great for those repeatable tasks you may perform as part of your ‘Day 2’ operations on a VM so why not make a action here to allow a user to select the type of page sharing for their workload..?
So you can see here you can have multiple “Zones” and once selected the vRO workflow will run, apply the VM advanced setting “sched.mem.pshare.salt” (with custom salt values) or in this scenario if “Isolated” is selected the “sched.mem.pshare.salt” value will be the VM UUID (if per the KB article you have your host TPS Salting settings are set to “2” then you wont need to worry about this).
The workflow is pretty straight forward, (1) it determines the salt value based on the “Zone” selected and obtains the VM UUID and the advanced setting is applied to the VM, (2) vCenter task monitored, (3) the host of the VM and Cluster is obtained, (4) a random host in the cluster is calculated and lastly (5) the VM is migrated to another host for the new TPS setting to take effect (I haven’t had chance to test this, so this step might need to be changed to a full power-cycle, it mentions to power off in the KB but I think this is just so the advanced setting can be applied).
I borrowed some vRO scripts from these sites to make the above workflow work. In addition the main script in the workflow was based off a script William Lam had on Flowgrab that hardened VMs.