I am having an issue with adding multiple disks do a vm in a blueprint. What I want to achieve is, that a user can add mutliple disks of various sizes, when requesting a new vsphere vm. I am almost there, however all of the disks added have the same size. I suspect the issue lies in the iteration of the disk configuration, whis is input as an array. Here are the relevant code snippets.
Disk configuration as input:
formatVersion: 1
inputs:
disks:
type: array
title: Add disk
description: Add new disks
minItems: 0
maxItems: 12
items:
type: object
properties:
size:
type: integer
title: Size in GB
maxSize: 2048
minSize: 1
Disk resource:
Cloud_vSphere_Disk_1:
type: Cloud.vSphere.Disk
properties:
count: '${length(input.disks)}'
capacityGb: '${input.disks[count.index].size}'
VM resource:
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
attachedDisks: '${map_to_object(resource.Cloud_vSphere_Disk_1[*].id, "source")}'
When a vm is deployed, the user can add an array of disks sizes. The number of disks added to the vm is correct as a result, but the size of all of them is equal to the size of the first disk added, example: user adds 3 disks in sizes 1GB, 2GB, 3GB. The resulting vm has the boot disk and 3 additional disks, all of size 1GB.
The blueprint documentation sadly only provides information about creating a new array, not iterating over value of an existing one. In most examples only the first element of an array is loaded.
I assume the issue is in Cloud_vSphere_Disk_1, where the size is improperly read from the array by index.count.
Could anyone give me a tip on how to resolve the issue?
edit: a word
edit2: added count.index to title
Krishna,
What information are you looking for?
Please see my post is this thread - it will address the disks all having the same size instead of different sizes from the array.
You will need allocatePerInsance: true
Is there any update to this at all?
https://developer.vmware.com/samples?id=7490#
I saw the link above, but it doesn't seem to work for me. Drives don't come in the right order and drive letters aren't being passed as well.
I'm not sure this works for 8.6. I've had to update the workflow "Get ordered mountpoints/drive letters" to authenticate and get the bearer token as that was not working. However I'm still having issues grabbing the deployment info.
So .. I had to play with this workflow a lot to get it working. Because we have something set in vcenter that changes the names of the files to match the hostname, so the canned workflow doesn't work as it apparently splits the filename it is expecting. So I am taking advantage of the other bug that a form can't accept the same disk size for any attached disk. in the "Get Ordered disk name" script I added
Is the disk ordering issue detailed here still an issue in vRA/vRO 8.8.1?
https://developer.vmware.com/samples?id=7490
Seeing issue where attached disks are not showing up on OS in the same order specified in the cloud template.
Thanks
to my knowledge it still is.. I am still using the workaround and have been checking the release notes of all new versions hoping this gets fixed.