VMware Cloud Community
heino_skov
Enthusiast
Enthusiast

Updating a blueprint with new template (automated)

Hello all,

Is it possible to update an existing blueprint with a new template using vCO automatically? I can't seem to find any built-in workflows / or action to do this?

The case is to clone a number of production VM's for instance once a week and update the predefined multi-machine blueprint automatically after the clone process completes.

Regards,
Heino

5 Replies
christianpg
Enthusiast
Enthusiast

No idea about vCO, but here's a brainstorm:

I have noticed that the DB table VirtualMachineTemplate uses a separate table VirtualMachineTemplateProperties with two relevant PropertyNames: "__clonefrom" and "__clonefromid".

Since you're updating the same template, I suspect the trick would be to update "__clonefromid" which can, at least be found with PowerShell:

Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer -Server  -Credential $c
$views = Get-View -Filter @{"Name"="<myTemplate>"} -ViewType VirtualMachine -Property Name, Config.Uuid, Config.Template
$uuid = $views[0].config.uuid
0 Kudos
jddias
VMware Employee
VMware Employee

Hello Heino,

  There isn't a workflow in vCO, but there is an action included with the vCAC Extensibility package named "updatePropertyFromBlueprint" that can be used to modify the __clonefrom property as suggested by Christian in his PS example.

Visit my blog for vCloud Management tips and tricks - http://www.storagegumbo.com
0 Kudos
rszymczak
Hot Shot
Hot Shot

Uhm, this seems not to be true any longer. The ID stored in __clonefromid dosn't match any ID used in vCenter (not the Uuid nor the BiosUuid - nothing). The link between the (vSphere) template to use for cloneing by a clone-blueprint seems to be done using __clonefrom, which stores the name of the template.

E.g. if you search the hole database for the id used by __clonefromid you'll only find two places where it exists:

1. within the [dbo].[VirtualMachineTemplateProperties] - just where we found it

2. within [dbo].[VirtualMachineHistoryProperties] - only exists if you every deployed a instance

Further evidence for this are linked-clone based blueprints, which don't even have the __clonefromid property but only the __clonefrom property and the id / name of the snapshot to use for the linked clone.

So to say: I guess the __clonefromid is not used at all and just lagecy trash (just like about 40% of all IaaS Database entries)

Obviously (hopefully) vRA dosn't then just use that name for cloneing. I guess that the current implementation will use the __clonefrom name to get the corresponding entry from [dbo].[VirtualMachine] and then uses the ExternalReferanceId along with the HostId to get the correct vSphere template to clone from (or the VMUniqueId from the [dbo].[VirtualMachine] table (which is the vm.config.InstanceUuid) along with the Endpoint uuid ).

Can anybody confirm this?

0 Kudos
radiojosh18
Contributor
Contributor

The UUID in __clonefromid is the UUID (vCACVirtualMachine.virtualMachineID) of the VCAC VM.  You'll find it in the dbo.VirtualMachine table, but capitalized.

pizzle85
Expert
Expert

What i do is provide a custom field in my vRA ASD workflow (this could be IaaS too) that is custom.template and i populate it with the names of the VMs inside a specific vcenter folder. When the user sends the request i just run the "Create/Update property on VM" workflow from the vCAC library to update the "CloneFrom" IaaS property with the value that the user selected.

So i have an IaaS blueprint that deploys a template.

I have a custom property of custom.template that lets the user select which vm they want to clone (it doesn't have to be a template)

vRO updates the IaaS property of "CloneFrom" (which is a native hidden property) to the value of custom.template

propertyName = "CloneFrom";

propertyValue = vCACVmProperties.get("custom.template");

0 Kudos