VMware Cloud Community
Lie_DW
Contributor
Contributor
Jump to solution

VirtualMachine.DiskN.StorageReservationPolicy

Hi,

vRealize Automation 7.4, vSphere machine blueprint (Create - BasicVMWorkflow), custom form

I have several datastores and created reservation policies for them.

I found the custom property VirtualMachine.DiskN.StorageReservationPolicy in the Custom Properties Reference. When I add this custom propery to the disk I get: You cannot use a reserved propery. I do not want to have the disk grid layout because it's too detailed and I only want to be able to change the Storage Policy.

I was thinking about a checkbox that will set the disk policy to something specific like noSRM datastore if needed.

Is there another way to accomplish this?

Thanks

Reply
0 Kudos
1 Solution

Accepted Solutions
rwk1982
Enthusiast
Enthusiast
Jump to solution

OK... then the vRO Action is easy Smiley Happy

Create a new Action "BuildDiskLayout" with return type "Array/string"

Add two string Parameters:

in_template_disks

in_StorageReservationPolicy

The Scripting Part:

#SnipStart -------------------------------

var disks = []

var disk_number = 0

for each (disk_size in in_template_disks.split("|")) {

     disks.push({"is_clone":true,

     "initial_location":null,

     "volumeId":disk_number,

     "id":null,

     "label":null,

     "userCreated":false,

     "storage_reservation_policy":in_StorageReservationPolicy,

     "capacity":disk_size})

disk_number++

}

return disks

#SnipEnd -------------------------------

In the Custom Form add a DropDown TextBox "Storage Reservation" and add your StorageReservationPolicies to the Values. For Example:

SRM|SRM Storage,noSRM|No SRM Storage

"SRM" and "noSRM" are the names of your StorageReservationPolicies. "SRM Storage" and "No SRM Storage" are the Lables in the Dropdown. Set the default Value to "SRM".

Now add a new Tab to the Custom Form ("Debug"). To the new Tab add the Disks Data Grid. Change the Value Source to "External source" and Select the Action "BuildDiskLayout".

Set the "

Set the "in_StorageReservationPolicy" to "Field" and select "Storage Reservation" from the dropdown.

Save the Custom Form go back to vRA and change the Return Type of the Action to "Array/Properties". Why? This is a bug in vRA... it only finds Actions with "Array/String" return types but the DataGrid needs "Array/Properties" to work. This will be fixed in the next vRA release.

Thats all... Your Disks Data Grid should now be build from the vRO Action Smiley Happy

Drink coffee.. Do stupid things faster with more energy...

View solution in original post

Reply
0 Kudos
4 Replies
rwk1982
Enthusiast
Enthusiast
Jump to solution

Hello!

The DataGrid only accepts static and external value sources so i think the only way to change the StorageReservationPolicy based on custom form inputs is a vRO Action.

Are the users allowed to add additional Disks to the VM in the request?

Drink coffee.. Do stupid things faster with more energy...
Reply
0 Kudos
Lie_DW
Contributor
Contributor
Jump to solution

No, the users are not allowed to add additional disks, our linux machines are pretty standard with a 50GB disk. For our windows servers, we're using a template.

The noSRM option is only for exceptions but I thought it would be good to have that option in the form.

I have now idea if it would be an option to use an event subscription to do a storage vMotion to a particular datastore after the creation of the machine and not to use storage policies.

Reply
0 Kudos
rwk1982
Enthusiast
Enthusiast
Jump to solution

OK... then the vRO Action is easy Smiley Happy

Create a new Action "BuildDiskLayout" with return type "Array/string"

Add two string Parameters:

in_template_disks

in_StorageReservationPolicy

The Scripting Part:

#SnipStart -------------------------------

var disks = []

var disk_number = 0

for each (disk_size in in_template_disks.split("|")) {

     disks.push({"is_clone":true,

     "initial_location":null,

     "volumeId":disk_number,

     "id":null,

     "label":null,

     "userCreated":false,

     "storage_reservation_policy":in_StorageReservationPolicy,

     "capacity":disk_size})

disk_number++

}

return disks

#SnipEnd -------------------------------

In the Custom Form add a DropDown TextBox "Storage Reservation" and add your StorageReservationPolicies to the Values. For Example:

SRM|SRM Storage,noSRM|No SRM Storage

"SRM" and "noSRM" are the names of your StorageReservationPolicies. "SRM Storage" and "No SRM Storage" are the Lables in the Dropdown. Set the default Value to "SRM".

Now add a new Tab to the Custom Form ("Debug"). To the new Tab add the Disks Data Grid. Change the Value Source to "External source" and Select the Action "BuildDiskLayout".

Set the "

Set the "in_StorageReservationPolicy" to "Field" and select "Storage Reservation" from the dropdown.

Save the Custom Form go back to vRA and change the Return Type of the Action to "Array/Properties". Why? This is a bug in vRA... it only finds Actions with "Array/String" return types but the DataGrid needs "Array/Properties" to work. This will be fixed in the next vRA release.

Thats all... Your Disks Data Grid should now be build from the vRO Action Smiley Happy

Drink coffee.. Do stupid things faster with more energy...
Reply
0 Kudos
Lie_DW
Contributor
Contributor
Jump to solution

You are my true hero Smiley Happy

It's working like a charm!

Reply
0 Kudos