VMware Cloud Community
jpryder83
Contributor
Contributor
Jump to solution

Clone a VM to a Datastore Cluster

Hi,

Really simple (hopefully), but I'm trying to write a workflow which includes provisioning a VM to a datastore cluster. I'm linking to the 'Clone virtual machine, no customization' workflow which only accepts a datastore as input.

I hope I'm being a bit stupid here and there is a simple answer?

Thanks.

Reply
0 Kudos
1 Solution

Accepted Solutions
jarushepic
Enthusiast
Enthusiast
Jump to solution

There is no simple answer.  DRS clusters are actually a set of rules and not an actual thing you can deploy a VMDK to.  I suggest using Onyx to deploy a VM to a DRS cluster and see what it outputs.  If I recall correctly, it basically runs DRS rules to get a recommendation for where to put a VMDK and then uses the output to actually deploy the template.

I opted to just write a simple workflow that found the datastore with the most freespace that matches a string - for example, if I have a DRS cluster named DSCluster_ugabuga, I've got a bunch of datastores named something like 'ugabuga....".  So you query those datastores and find the one with the most freespace.

View solution in original post

Reply
0 Kudos
5 Replies
bansne
Enthusiast
Enthusiast
Jump to solution

Still didn't get your query

Reply
0 Kudos
jarushepic
Enthusiast
Enthusiast
Jump to solution

There is no simple answer.  DRS clusters are actually a set of rules and not an actual thing you can deploy a VMDK to.  I suggest using Onyx to deploy a VM to a DRS cluster and see what it outputs.  If I recall correctly, it basically runs DRS rules to get a recommendation for where to put a VMDK and then uses the output to actually deploy the template.

I opted to just write a simple workflow that found the datastore with the most freespace that matches a string - for example, if I have a DRS cluster named DSCluster_ugabuga, I've got a bunch of datastores named something like 'ugabuga....".  So you query those datastores and find the one with the most freespace.

Reply
0 Kudos
FreddyFredFred
Hot Shot
Hot Shot
Jump to solution

Try this thread:

CloneVm to SDRS Cluster / Storage Pod

It's not the easiest thing but if you go through both pages of that thread, you should be able to get it working as the code you need is there. (I posted to the thread and got the hiccup I ran into resolved)

Reply
0 Kudos
jpryder83
Contributor
Contributor
Jump to solution

Thanks All,

I've give it a go tomorrow and reply with what I did in the end. I'll hopefully be moving to vvols shortly - not sure if that will make it easier or more difficult!

Reply
0 Kudos
jpryder83
Contributor
Contributor
Jump to solution

OK, I simply wrote a workflow to take a load of datastores from an array, and go through them one by one checking the freesize; whichever one won gets output, as long as it has more than 100GB free.

I should have populated the datastore array automatically from selecting the cluster folder (can't do it by datastore name due to convention) but we'll be switching to vvols soon so couldn't be bothered. Also could have put in the size of the requested VM, and to verify that this would not reduce the free space below the alarm threshold, but again, too much work for the short term and 100GB free is fine for now.

Thanks!

Reply
0 Kudos