VMware Cloud Community
jselleck
Contributor
Contributor

Set StoragePath in VCO during WFStubBuildingMachine

I'm trying to set the storagepath during the WFStubBuildingMachine stub. 

Currently the stub calls VCO where it gets the storage path.

The two things I've tried:

1. Set with VCO via teh iaas plugin.

The option does not seem to set the value. vcacVM.storagepath = 'path';

2. Set the path as a VCO output and assign storagepath in iaas designer.

method used:

machine.storagePath = outStorage;

Where machine is a VirtualMachine type and outstorage is a string assigned via the workflowOutputCollection("storagePath").tostring().

I use this same technique with vmname and it works fine.

The error I'm getting for storage is: In vcac: Request failed: server123 not found, and possibly deleted before provisioning finished.

SO Question:  What approach has been used by someone that works? If I'm on the right track what am I missing? Can you share your code or provide some direction for such a solution?

Thanks!

Reply
0 Kudos
8 Replies
kericmiles
Enthusiast
Enthusiast

What are you trying to accomplish? If you are trying to put certain VMs on specific datastores it would be better to use reservation policies through vRA.

Reply
0 Kudos
GrantOrchardVMw
Commander
Commander

You can use the VirtualMachine.DiskN.Storage custom property to define datastore per disk if you want an easy method. If you need more flexibility than this gives you then you could use the SPBM vCO package that's on solutionexchange.vmware.com.

https://solutionexchange.vmware.com/store/products/vrealize-automation-vcloud-automation-center-and-...

Provides Day Two actions to migrate as well.

Grant

Grant http://grantorchard.com
Reply
0 Kudos
bdamian
Expert
Expert

Same problem here!

I need to accomplish exactly the same thing but I cannot find a way.

I've tried with the following Custom Properties with no result, the VM disks are always deployed on the Storage Path with higher priority:

. VirtualMachine.Storage.Name

. VirtualMachine.Disk0.StorageReservationPolicy

. Storage.Cluster.Name

. VirtualMachine.DiskN.Storage

Any ideas?

Thanks a lot,

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos
bdamian
Expert
Expert

I've found the way to do this!

The problem was that is not a custom property... there are 3 custom properties for the VM and 3 for each HardDisk.

So, in the WFStubBuildingMachine you need to set this Custom Properties:

For the VM:

  • VirtualMachine.Storage.Name
  • VirtualMachine.Storage.Cluster.Name
  • VirtualMachine.Storage.Cluster.ExternalReferenceId

And for each HD (change N for the disk number):

  • VirtualMachine.DiskN.Storage.Name
  • VirtualMachine.DiskN.Storage.Cluster.Name
  • VirtualMachine.DiskN.Storage.Cluster.ExternalReferenceId

Now, in order to determine how many disks has the VM, you need to find the existing virtual properties for each disk and update it.

Hard but it works.

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos
DLally
Enthusiast
Enthusiast

So are you saying on top of the:

  • VirtualMachine.Storage.Name
  • VirtualMachine.Storage.Cluster.Name
  • VirtualMachine.Storage.Cluster.ExternalReferenceId

i'd still have to set each disk manually as well?  That kind of seems a bit over the top if you're setting it at the cluster level.   

I'm still a novice scripter, how did you pull in each disk that you'd have to modify?

Reply
0 Kudos
bdamian
Expert
Expert

Hi DLally,

After some testing, I drop this idea and back to what vRealize already does out of the box. So, I'll recommend to create Reservation Policies, then tag the storage paths on the reservation and enable "Allow user to see and change storage reservation policies" on the Blueprint.

vRealize do not offer a way to select a storage path for VM at the moment. Maybe VMware fix this in future versions.

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos
DLally
Enthusiast
Enthusiast

That's what I was previously using, my only issue is the chance for user error.  If a user requests a DR'd server, but doesnt select the proper reservation policy...that could be bad.  Might be a use case for approvals so we can verify configurations

Reply
0 Kudos
bdamian
Expert
Expert

Hi DLally,

I know that, I explore myself some alternatives with my clients but after some POCs, we decided to use the "out of the box" support of vRA. It's very limited but I hope this will improve in the future.

The problem with change the storage on pre-provisioning stub is that all validation already occur and I can't find a way if the reservation has space remaining for the new VM. If you change the storage path on the stub, the VM will be created in that storage even if not exists in the reservations or if is out of space.

D.

---
Damián Bacalov
vExpert 2017-2023 (7 years)
https://www.linkedin.com/in/damianbacalov/
https://tecnologiaimasd.blogspot.com/
twitter @bdamian
Reply
0 Kudos