For MS Windows deployments I’m adding a multiple disks to a VM. This way I hope to be able to add second day operation for disk expiation directly on a device, which should improve user experience. The question is how to create disks input and then how to translate this in to multiple devices of different sizes connected to a VM?
Lets start with disk form input. This is what we are looking for:
YAML code below should build this input for you.
I need only size and disk letter (mount point) but you can add storage type based on tag or disk label if you wish. Just be aware that some of those options will require additional automation on OS level. I force users to add at least one additional disk and allow to add max ten. For more sophisticated validation you will have to use vRO action and custom form validation option.
inputs:
disks:
type: array
title: Additional Disks
description: Additional data disks.
maxItems: 10
minItems: 1
items:
type: object
properties:
mountPoint:
type: string
title: Mount Point
size:
type: integer
title: Size (GB)
minSize: 1
maxSize: 1000
default:
- mountPoint: 'd:'
size: 8
Now how to change this input in to disk devices? Add Cloud.vSphere.Disk in to your design canvas connect toy your VM and set count and capacityGb properties like this:
resources:
Disks:
type: Cloud.vSphere.Disk
allocatePerInstance: true
properties:
capacityGb: '${input.disks[count.index].diskSize}'
mountPoint: '${input.disks[count.index].diskMount}'
count: '${length(input.disks)}'
provisioningType: thin
Now on your vSphere machine map the disks like this:
VM:
type: Cloud.vSphere.Machine
properties:
....
attachedDisks: '${map_to_object(resource.Disks[*].id, "source")}'
This will not format and mount the disk for you on OS level. You still have to do it via Cloudbase-Init or via tools scripting. But it will create right sized devices and connect it to your VM
vRA deployment view:
vSphere VM configuration: