VMware Cloud Community
PGEEK
Contributor
Contributor

Get-Datastorecluster

Hello,

Last year I wrote a script that uses some basic forms to deploy multiple VM's based upon inputs. It works fine on our old 4.1 cluster.

We are getting ready to deploy some new hardware with some 5.0 clusters on it and and am in the process of converting my little script to take advantage of some of the things we are doing on the new clusters.

One of thos things is we want to deploy to datastore clusters. In my script I do a couple of things like suck down a list of the datastores and then verify that that datastore is accessible from the host you are trying to deploy to. I do it (clumsily) like this.

$dsonhost = Get-Datastore -VMHost $Hostdropdown.Text | Select-Object -ExpandProperty Name
if ($dsonhost -notcontains $storedropdown.Text)
{
$msg = [System.Windows.Forms.MessageBox]
$msg::Show("The datastore you choose does not exist on the host. Please check your selections.")
}
else
{blargblargblarg}

Well there doesnt seem to be a way to the same thing with a ds cluster.

Am I missing something?

Thanks!

Reply
0 Kudos
6 Replies
CRad14
Hot Shot
Hot Shot

You are not missing anything, as far as I know, there are currently no Datastore Cluster Cmdlets.

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
PGEEK
Contributor
Contributor

Uggg..thats what I thought but was hoping I was wrong. Get-datastorecluster appears pretty limited.

Thanks for the confirmation!

Reply
0 Kudos
LucD
Leadership
Leadership

While you're waiting for the DatastoreCluster cmdlets to become available, you could use some functions from vSphere 5 Top 10 – Storage DRS.

What exactly are you trying to do ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

PGEEK
Contributor
Contributor

Hi LucD.

First of all let me thank you. What I wrote last year works as well as it does because I spent many hours reading your stuff.

I did look at your article and its actually opened in another tab as I write this.

What I have is a form that allows my co-workers to enter in a bunch of parameters around a new VM (or multiple) they want to create. When they hit go it will gen up the vm's based on template and customizations they choose and the servers will build, boot, patch, add to domain, etc. They can queue up 20 new servers, hit go, head to lunch and come back with a fully functional enviroment for whatever project they are working on.

To make it easier on them I do things like prepopulate drop down lists with things like networks, hosts, datastores, etc. They are read in when the script starts.

One thing I do before the build execution is do a sanity check on their selections like does the network live on that host (I used some of your stuff for the vds queries), ip-gw-mask all proper, stuff like that.

One of the checks is that the datastore chosen is accessible from the host they choose. Now we have dsclusters with groups of those datastores that are only accessible to certain hosts. It was easy to check that connectivity before (see my slop above), but its doesnt seem as straightforward now.

I suppose I could go at it backwards and see if I could figure out the datastores in the dscluster then loop then through one at a time against the host they choose. Not sure how I would even go about that though.

Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership

There is a simple trick to get the datastores in a datastorecluster.

$dsc = Get-DatastoreCluster MyDsc | Get-View 
Get-View $dsc.ChildEntity | Select Name

With the list of datastores you should be able to do your sanity check I suppose


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
PGEEK
Contributor
Contributor

I will give that a shot.

Thanks!

Reply
0 Kudos