vRealize Automation 8.4 brings some enhancements to storage management at cloud template level. Since this a topic that I am particularly interested in, I've decided to take a look at the topic. I've focused on two cases cases:
- cloud template with predefined number of disks
- cloud template with dynamic number of disks
Cloud template with predefined number of disks
First I've created a template with 2 additional disks attached to it. Both disk are attached to SCSI controller 1 and their size is given as input. Both disk are thin provisioned. The template looks as following:
Let's see the code behind the template. There are 2 main sections:
- inputs: where the input parameters are defined
- resources: where template resources are defined.
Inputs section contains parameters for VM image flavor (defaults to micro) and disk sizes (default to 5GB each)
Resources section has 3 resources - the VM (Cloud_Machine_1) and its 2 additional disks (Cloud_Volume_1 and Cloud_Volume_2). Each resource is defined by a type and properties.
The disks are mapped to the VM resource using attachedDisks property. The input parameters can be seen under each resource, for example for disk capacity: ${input.flavor}, ${input.disk1Capacity} and ${input.disk2Capacity}. Please note that in this case the SCSI controller and the unit number are given in the template.
formatVersion: 1
inputs:
flavor:
type: string
title: Flavor
default: micro
disk1Capacity:
type: integer
title: App Disk Capacity GB
default: 5
disk2Capacity:
type: integer
title: Log Disk Capacity GB
default: 5
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: CentOS7
flavor: '${input.flavor}'
constraints:
- tag: 'vmw:az1'
attachedDisks:
- source: '${resource.Cloud_Volume_1.id}'
- source: '${resource.Cloud_Volume_2.id}'
Cloud_Volume_1:
type: Cloud.Volume
properties:
SCSIController: SCSI_Controller_1
provisioningType: thin
capacityGb: '${input.disk1Capacity}'
unitNumber: 0
Cloud_Volume_2:
type: Cloud.Volume
properties:
SCSIController: SCSI_Controller_1
provisioningType: thin
capacityGb: '${input.disk2Capacity}'
unitNumber: 1
Once the template is created, you can run a test to see if all constraints are met and if code will run as expected. This is a useful feature and it is similar to unit tests used in development processes.
If tests are successful, you can deploy the template. After the resources are provisioned, you can select in the topology view any of the resources and check the details and the available day 2 actions in the right pane.
For the disks we can find out the resource name, its capacity, its state (if it is attached or not), if it is encrypted and to what machine it is associated.
More details are displayed under custom properties such as the controller name, datastore on which the disk is placed and so on. A lot more details are displayed under custom properties such as the controller name, datastore on which the disk is placed and so on.
We can resize the disks and also remove the disks from the machine (delete). You can see below a resize action where the existing value is displayed and the new value is typed:
Cloud template with dynamic number of disks
The first example uses a predefined number of disks in the template even though the disk size is given as an input parameter. Another use case is to let the consumer specify how many disks he needs attached to the VM (obviously with some limitations).
formatVersion: 1
inputs:
flavor:
type: string
title: Flavor
default: micro
disks:
type: array
minItems: 0
maxItems: 6
items:
type: object
properties:
size:
type: integer
title: Size (GB)
minSize: 1
maxSize: 50
resources:
Cloud_Machine_1:
type: Cloud.Machine
properties:
image: CentOS7
flavor: '${input.flavor}'
constraints:
- tag: 'vmw:az1'
attachedDisks: '${map_to_object(resource.disk[*].id, "source")}'
disk:
type: Cloud.Volume
allocatePerInstance: true
properties:
provisioningType: thin
capacityGb: '${input.disks[count.index].size}'
count: '${length(input.disks)}'
When requesting the deployment, an user can leave the default disk in the VM image or add up to 6 more disks
Details about the disks and controllers can be seen directly from vRA. In the example below all disks are placed on the same controller:
Caveats
When adding same size disks an error is displayed about "data provided already entered". Not clear at this time if it is my code or it is a limitation.
The controller type is automatically taken from the VM template (image). Being able to actually specify the controller type or even change it as a day 2 operation would be also helpful.
2 comments:
Did you find any solution when passing disk size of same value? Data provided is already entered.
Hello,
Did you find any solution for error message "Data provided is already entered" when passing disk size of same value?
Post a Comment