1

This is my first time asking a question on here, so please be gentle...

I have an automated process that deploys VMs in VMware from a template (using powercli) and it cannot deploy if the storage policy of the template is not supported by the cluster where the new VM is to be built. I am trying to work out a process by which the template (including its disks) would use the default storage policy of the target cluster whenever the template is deployed.

The command used to deploy is currently:

new-vm -resourcepool $VMWARE_CLUSTER -name $VIRTUAL_SERVER_NAME -template $TEMPLATE -Datastore $Datastore -DiskStorageFormat $disktype

I am not particularly proficient in powershell or powercli as I am a Linux sys admin, but I'm keen to learn.

1 Answers1

0

The issue isn't your PowerCLI code, as a storage policy can't be applied or altered using the New-VM cmdlet. You basically need to either create templates for each cluster, or edit your cluster and/or storage policies so that the cluster you're trying to deploy to fulfils the requirements set out by the storage policy defined for the template.

Or to put it another way: storage policies are working as intended, the template you're using has a requirement for a certain type of storage policy, and it won't let you deploy the VM to a cluster that doesn't fulfil that policy.

Stuggi
  • 209
  • 2
  • 5
  • 12