Czernobog
Expert
Expert

vRA 7.6 - changing the value of a custom property on a Cafe Deployment

During initial provisioning, I add a custom property with a value to the deployment. The property is defined in the Property Dictionary and assigned to a machine blueprint.

When the deplyoemnt is progressing, I need to change the value of this property. I have tried 2 approaches:

1. Using REST:

          PUT query: /catalog-service/api/consumer/deployments/{deployment_id}, with body {"customProp":"value"}

2. Using the Orchestrator REST client:

          restClient = vraHost.createRestClient("com.vmware.csp.core.cafe.catalog.api");

          var props = new Properties();

          props.put("customProp","value");

          var response = restClient.put("/consumer/deployments/{deployment_id}", props);

I get a success response using both methods, but the change is not made in vRA, there is stil lthe old value of the property.

Also, what I have discovered afterwards is, that even when I dump the whole Deployment configuration using the API, the custom  property is nowhere to be found.

Can someone please give me any tips on this?

Tags (1)
0 Kudos
8 Replies
daphnissov
Immortal
Immortal

SovLabs property toolkit should allow you to do this, I believe, as well as changing the value of those properties after the deployment is complete.

0 Kudos
bdamian
Expert
Expert

Hi Czernobog,

Are you attaching the custom property to the Deployment or to the Machine?

You said "I add a custom property with a value to the deployment" and I don't quite understand the meaning of this.

D.

Damián Bacalov
vExpert 2017-2018-2019-2020-2021
https://www.linkedin.com/in/damianbacalov/
twitter @bdamian
0 Kudos
Czernobog
Expert
Expert

Yes, I have created some custom properties, bundled them together in a property group and assigned this group to the composite blueprint (not the machine blueprint). That way they get saved as properties of the provisioned deployment.

Changing proeprty values on a machine object is simple, but I could now find a method to change values of custom properties on the deployment.

0 Kudos
Czernobog
Expert
Expert

The Sovlabs toolkit can only be used to change properties on a VM, not the deployment.

0 Kudos
GeiAll
Enthusiast
Enthusiast

Hi.

2 Possible solutions:

You can use the vCACEntityManager object to read and update the properties from vRO. 

<code>

var property = new Properties();  
var host = Server.findAllForType("vCAC:vCACHost")[0];
var model = "ManagementModelEntities.svc";  

var vmproperties = vCACEntityManager.readModelEntitiesByCustomFilter(host.id, model, "VirtualMachineProperties", property, null);  

// To update use vCACEntityManager.updateModeEntityBySeralizedKey
</code>


Or you can update the values in the vRA database directly.
We have been using this approch since vRA 7.2 (and now in vRA 7.6), To change IP addresses of deployed VM's.
(Witch requires update to the VirtualMachineProperties table aswell. )


(We created a Stored Procedure in the vRA database, witch we trigger from a vRO workflow.)

Since this is directly into the database this might break at any upgrades, but so far it's been working like a charm since version 7.2.

0 Kudos
Czernobog
Expert
Expert

I know of this method, but it is meant for virtual machines and not for deplyoments.

COnfiguring properties on a deployment just seems to be some sort of black hole, you can set then during the initial deployment, but not change afterwards.

0 Kudos
GeiAll
Enthusiast
Enthusiast

Hi.

Sorry for the misunderstanding.

Deployments are part of the builtin postgres database.

You can access them through vCACCAFE object in vRO. Unfortunately I do not have any code examples for this. But you should be able to access the properties here.

However, I presume (I have not verified this) that Properygroups behave the same in vCACCAFE as in vCAC propertygroups. If it does, it means you cannot change the values for a single deployment. (The value is stored in the property group and linked to the vm/deployment (So any changes will reflect all deployments using the propertygroup)

0 Kudos
Czernobog
Expert
Expert

I know what you mean, but this is sadly not valid for Deployments. I use a similar method to what you described, by grabbing properties from the CatalogResource.resourceData, but this works only if the CatalogResource is a VM. The resourceData property holds all custom properties of the VM,  but it is empty on a Deployment.

You can also grab all deployments from the API and resourceData is empty also.

I've given up the search, honestly, and have moved the property value I want to change from the composite blueprint to the machine blueprint. The problem is here, that there is no known to me way, to edit proeprties on the machine blueprint, so it was again a bit of manual work. This all confirms the jankines of the product though and is nothing suprising :smileyplain:

0 Kudos