Monday, April 19, 2021

vRealize Automation 8.4 Disk Management

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. 

formatVersion1
inputs:
  flavor:
    typestring
    titleFlavor
    defaultmicro
  disk1Capacity:
    typeinteger
    titleApp Disk Capacity GB
    default5
  disk2Capacity:
    typeinteger
    titleLog Disk Capacity GB
    default5
resources:
  Cloud_Machine_1:
    typeCloud.Machine
    properties:
      imageCentOS7
      flavor'${input.flavor}'
      constraints:
        - tag'vmw:az1'
      attachedDisks:
        - source'${resource.Cloud_Volume_1.id}'
        - source'${resource.Cloud_Volume_2.id}'
  Cloud_Volume_1:
    typeCloud.Volume
    properties:
      SCSIControllerSCSI_Controller_1
      provisioningTypethin
      capacityGb'${input.disk1Capacity}'
      unitNumber0
  Cloud_Volume_2:
    typeCloud.Volume
    properties:
      SCSIControllerSCSI_Controller_1
      provisioningTypethin
      capacityGb'${input.disk2Capacity}'
      unitNumber1



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). 


In this case the code is looking a bit different. We define an array as the input for the disk sizes. The array is dynamic, but in our case limited to maximum 6 values (6 disks). This array is then used to define the Cloud.Volume resource. 

formatVersion1
inputs:
  flavor:
    typestring
    titleFlavor
    defaultmicro
  disks:
    typearray
    minItems0
    maxItems6
    items:
      typeobject
      properties:
        size:
          typeinteger
          titleSize (GB)
          minSize1
          maxSize50
resources:
  Cloud_Machine_1:
    typeCloud.Machine
    properties:
      imageCentOS7
      flavor'${input.flavor}'
      constraints:
        - tag'vmw:az1'
      attachedDisks'${map_to_object(resource.disk[*].id, "source")}'
  disk:
    typeCloud.Volume
    allocatePerInstancetrue
    properties:
      provisioningTypethin
      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. 




No comments: