VMware Cloud Community
pizzle85
Expert
Expert
Jump to solution

vRA 7.0.1 Request a Catalog Item vRO Workflow 400 BAD_REQUEST

Has anyone gotten this working?

When i attempt to submit the workflow against an IaaS Blueprint that has just one vSphere machine element the following entries cause a 400 BAD_REQUEST error:

  • provider-VirtualMachine.Memory.Size
  • provider-VirtualMachine.CPU.Count

I have tried populating the values for these properties several ways, all of them result in the same 400 BAD_REQUEST error:

  • inputs.put("provider-VirtualMachine.Memory.Size", "1024"); //STRING
  • inputs.put("provider-VirtualMachine.Memory.Size", 1024); //NUMBER
  • inputs.put("provider-VirtualMachine.Memory.Size", new vCACCAFEIntegerLiteral(1024).getValue()); //INT
  • inputs.put("provider-VirtualMachine.Memory.Size", new vCACCAFEDecimalLiteral(1024).getValue()); //DEC

If i leave those two properties out the process works and just get created with 1 vCPU and 1024MB of memory.

This process works fine in my 6.2 environments.

0 Kudos
1 Solution

Accepted Solutions
pizzle85
Expert
Expert
Jump to solution

Engineering pointed me to the "Request a catalog item with provisioning request" workflow in the 7.0.1 vRA plug-in. You need to duplicate the workflow, uncomment the "customize request data" section of the workflow and add your custom propertys. Its all JSON so you just want to add it just like you see in the output from the jsonData variable.

I walked through it in two steps:

1.

////Uncomment to customize request data

var jsonData = vCACCAFERequestsHelper.getProvisioningRequestData(provisioningRequest);

System.log(jsonData);

This will log out the full property set in a JSON format. You can past this into a JSON viewer like Online JSON Viewer and browse it.

request.PNG

In my test case i had a blueprint with one vSphere machine named "vSphere_Machine_1". In this case i want to set the CPU count to 2 and memory to 2048.

2.

////Uncomment to customize request data

var jsonData = vCACCAFERequestsHelper.getProvisioningRequestData(provisioningRequest);

//System.log(jsonData);

var json = JSON.parse(jsonData);

////Change cpu example

json.vSphere_Machine_1.data.cpu = 2;

json.vSphere_Machine_1.data.memory = 2;

//System.log(JSON.stringify(json));

vCACCAFERequestsHelper.setProvisioningRequestData(provisioningRequest, JSON.stringify(json));

View solution in original post

0 Kudos
5 Replies
pizzle85
Expert
Expert
Jump to solution

Digging in a bit deeper led me to this error on the vRA appliance:

[Rest Error]: {Status code: 400}, {Error code: 11008} , {Error Source: null}, {Error Msg: The current data type DECIMAL for the 'memory' field must be INTEGER.}, {System Msg: The current data type DECIMAL for the field with id memory must be INTEGER.}

So just to be sure i added a couple lines in my vRO process:

var memory = new vCACCAFEIntegerLiteral(json.memory * 2048);

System.log(memory.getTypeId());

System.log(memory.getValue());

inputs.put("provider-VirtualMachine.Memory.Size", memory.getValue());

Which outputs:

[2016-04-11 11:05:45.200] [I] DynamicWrapper (Instance) : [vCACCAFEDataTypeId]-[class com.vmware.vcac.platform.content.schema.DataTypeId] -- VALUE : INTEGER

[2016-04-11 11:05:45.201] [I] 2048

[2016-04-11 11:05:45.203] [I] {"provider-custom.hostname":"eio-admins-dev-b2","provider-Infoblox.IPAM.defaultDnsSuffix":"osg.ufl.edu","provider-VirtualMachine.Memory.Size":2048,"provider-custom.network":"1325-vcac-hosting-1:ssrb","provider-VirtualMachine.Network0.Name":"1325-vcac-hosting-1:ssrb","provider-Vrm.DataCenter.Location":"SSRB Hosting","provider-VMware.VirtualCenter.Folder":"eiosystems","provider-VirtualMachine.Admin.Owner":"pgsmith@ad.ufl.edu","provider-VMware.VirtualCenter.OperatingSystem":"windows7Server64Guest","provider-custom.testing":"true","provider-custom.reprovision":"false","provider-VirtualMachine.Disk0.StorageReservationPolicy":"Silver","provider-VirtualMachine.Disk0.Size":"10"}

It looks like its an Integer in vRO but the vRA rest client is interpreting it as a decimal. If i place the value in another property say "test.memoryProperty", in the vRA logs I see the JSON for the property set and the value of the memory "Integer" is indeed 2048.0, a decimal...

0 Kudos
pizzle85
Expert
Expert
Jump to solution

Engineering pointed me to the "Request a catalog item with provisioning request" workflow in the 7.0.1 vRA plug-in. You need to duplicate the workflow, uncomment the "customize request data" section of the workflow and add your custom propertys. Its all JSON so you just want to add it just like you see in the output from the jsonData variable.

I walked through it in two steps:

1.

////Uncomment to customize request data

var jsonData = vCACCAFERequestsHelper.getProvisioningRequestData(provisioningRequest);

System.log(jsonData);

This will log out the full property set in a JSON format. You can past this into a JSON viewer like Online JSON Viewer and browse it.

request.PNG

In my test case i had a blueprint with one vSphere machine named "vSphere_Machine_1". In this case i want to set the CPU count to 2 and memory to 2048.

2.

////Uncomment to customize request data

var jsonData = vCACCAFERequestsHelper.getProvisioningRequestData(provisioningRequest);

//System.log(jsonData);

var json = JSON.parse(jsonData);

////Change cpu example

json.vSphere_Machine_1.data.cpu = 2;

json.vSphere_Machine_1.data.memory = 2;

//System.log(JSON.stringify(json));

vCACCAFERequestsHelper.setProvisioningRequestData(provisioningRequest, JSON.stringify(json));

0 Kudos
mhhutt
Contributor
Contributor
Jump to solution

So far so good but what if I want to specify something like VirtualMachine.Network0.Address using the example below just results in errors as it is looking for subsections in the JSON for VirtualMachine, Network0, and finally a property called Address.

0 Kudos
pizzle85
Expert
Expert
Jump to solution

Ultimately this became too difficult to automate easily. I reverted back to using the old method and just setting the CPU and Memory properties through vRO during the building phase. This causes the request to not show the actual entries for those two properties that the customer entered but it makes generating arrays of NIC and DISK much simpler.

0 Kudos
langfb
Contributor
Contributor
Jump to solution

Hi All,

Not sure if this will help but it has worked for me, there seems to be a way to achieve what you are attempting with modifying the original workflow you were running:

1. Copy the original workflow "Request a catalog Item"  then remove the "Compositetypetoprop" action and replace it with a scriptable task.

2. Set the scriptable task to accept the input values you had in your original script here is my example:

pastedImage_0.png

This properties parsed to the inputs of the "requestCatalogItem" action provisioned the blueprint as required. Sorry if this isn't what you needed but it worked for my needs, so I thought I would share the experience.

0 Kudos