VMware Cloud Community
KThorlund
Enthusiast
Enthusiast

Event broker and CloneFrom

Good morning, 

I have a workflow which is triggered by the evet broker, when it hits VMPSMasterWorkflow32.Requested. I use it to set a custom defined server name. Works very well. 

I try to do the same with the CloneFrom property which I can add to the VM blueprint. Thou I cant get it to work...

var virtualMachineEntity = System.getModule("com.vmware.library.vcac").getVirtualMachineEntityFromId(null,VMID) ;
var vmEntityProps = virtualMachineEntity.getProperties();
vmEntityProps.remove('VirtualMachineName'); ///////////// OK
vmEntityProps.put('VirtualMachineName', hostname); ///////////// OK
 
vmEntityProps.remove('CloneFrom'); ///////////// FAIL
vmEntityProps.put('CloneFrom', OSTemplate);  ///////////// FAIL

 

Is it possible to set that property, what is the exact name, and in what state should it be set?

Regards, Kjeld 

0 Kudos
7 Replies
rkrichevskiy
Enthusiast
Enthusiast

We use CloneFrom to override source template that's predefined in our blueprints. We set it prior to submitting provisioning request. Perhaps it's too late to set it within vRA provisioning flow when it hits VMPSMasterWorkflow32.Requested.

0 Kudos
KThorlund
Enthusiast
Enthusiast

Thanks, 

yes, that should be possible. Thou not here, as I have a single blueprint with a single machine. The request allows the user to create multiple machine, and should be change the clone from to different options, e.g. one machine is Windows 2012 second is Windows 2016. If I set it prior to I submit the request, I can only set the option once which will be the option for all machines (as I only have one VM object in my BP).

0 Kudos
rkrichevskiy
Enthusiast
Enthusiast

Yes, I suppose it depends on your provisioning requirements. We didn't want to have a ton of blueprints to maintain and we didn't really need for all VMs to reside under a common deployment in vRA.

So we have a single (generic) blueprint that's requested by vRO call to vRA. We set custom properties in vRO provisioning request prior to request submission, and fire off however many requests we need. This unfortunately results in a single type of VM per deployment but it does provide us with template source flexibility.

I'll keep an eye on this thread in case there are other options.

0 Kudos
KThorlund
Enthusiast
Enthusiast

So, a small update from here. I got it sorted, rather simple (like everying else when you finally know it..). 

- My blueprint has a field, OSListArray, which concatenates the selected OS' as shown on the picture. 
  The field / array ends with something like this [OSListArray] = Win2012|Win2016|Win2019|Win2016|Win2016|Win2016|Win2016|Win2016|Win2016|Win2016
  
- I catch the array in a blocking event on the VMPSMasterWorkflow32.Requested and split it. 

- I use the field "VirtualMachine.Cafe.Blueprint.Component.Cluster.Index" to know how "big" my array is. The array is full but I only neext the amount = Cluster index. 
  This specifies what template the VM should use:
  
  OSList = OSList.split("|"); 
  OSTemplate = OSList[clusterID]

- In bloking event I access and update the entity which is used for the cloning and build:
  var virtualMachineEntity = System.getModule("com.vmware.library.vcac").getVirtualMachineEntityFromId(null,VMID) ;
  System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(vRAHost,virtualMachineEntity,"CloneFrom",OSTemplate,false,false,false,false);
  
- Above is done for each machine within the blueprint. Again my cluster index is my reference and pointer.

- As an example my request looks like:


- And the final deployment with mixed setup with the 3 OS'.

- A scale out is made based on the default CloneFrom value set in the blueprint, i my case Win2016,

rkrichevskiy
Enthusiast
Enthusiast

Thanks again for sharing this. I tried it and it works. Great idea!

0 Kudos
KThorlund
Enthusiast
Enthusiast

.
0 Kudos
KThorlund
Enthusiast
Enthusiast

Just a small update. I have looked into a way on how to select the OS on a scale out. the idea is simple, but i need to work around for it. 

As I can not write a property/value to the actual deployment (parent of the VMs), I can not specify the CloneFrom during a Day-2 action. 

Instead I hacve written a simple Day-2 action, which stores the deplyment name on the CloneFrom value, e.g. Win2019, in a SQL server. 

When I do a scale out, my initial requested workflow will catch if it is a scale out, which has started. If a scale out, I grab the CloneFrom value from the SQL server baaed on the deplyment name, which is my key in this case. And then i can just pump in the CloneFrom value as previously done. 

Works good, and I can select the the OS I want to scale out on. The only thing it takes is to execute my Day-2 action prior to scale out. If I dont do it, scale out will be done on the initial scale out in the BP. 

But it would be nice if can could store the value in the actual Deployment and skip the SQL, thou, I dont think it is possible. 

Give it a try!

0 Kudos