mcescalante's Posts

This makes perfect sense, and I grabbed the old ClusterVmGroup, and used "add" as the array update option. Still getting a SOAP fault. When I use "edit" with the existing ClusterVmGroup it sti... See more...
This makes perfect sense, and I grabbed the old ClusterVmGroup, and used "add" as the array update option. Still getting a SOAP fault. When I use "edit" with the existing ClusterVmGroup it still replaces all machines in the group with the one specified. Here is the code that is producing the SOAP Fault:                 my $groupSpec = new ClusterGroupSpec();                 $groupSpec->{operation} = new ArrayUpdateOperation("add");                 $groupSpec->{info} = $ClusterVmGroupView; #this is ONLY the ClusterVmGroup I'm editing (retrieved using configurationEx->group)                 $groupSpec->{info}->{vm} = [$vm_view];                 my $spec = new ClusterConfigSpecEx();                 $spec->{groupSpec} = [$groupSpec];                 $cluster_view->ReconfigureComputeResource(spec => $spec, modify => 1); And the error: SOAP Fault: ----------- Fault string: A specified parameter was not correct. Fault detail: InvalidArgument
For anyone referring in the future, here is some fairly primitive code that should work (nearly) out of the box. This was quickly pulled and edited from a larger script, but should be ok. fore... See more...
For anyone referring in the future, here is some fairly primitive code that should work (nearly) out of the box. This was quickly pulled and edited from a larger script, but should be ok. foreach my $vmsInCluster (@{$cluster_view->configurationEx->group}) {                        if (ref($vmsInCluster) eq "ClusterVmGroup") {                                 print "DRS rule name is: ", $vmsInCluster->name, "\n";                                 foreach my $vmNames (@{$vmsInCluster->vm}) {                                         my $vmMor = Vim::get_view(mo_ref => $vmNames);                                         print $vmMor->config->name, "\n";                                 }                          } }
My script is basically adding a single VM to a rule. This is super and works (more or less), but when I use "add" as the array op it throws a SOAP Invalid Argument. When I use "edit", it remov... See more...
My script is basically adding a single VM to a rule. This is super and works (more or less), but when I use "add" as the array op it throws a SOAP Invalid Argument. When I use "edit", it removes all other machines from the rule and then ONLY adds the machine specified. Is this because I am creating a wholly new "ClusterVmGroup"? Either way, I'd love to figure out why it's throwing on "add", or I'm glad to just use "edit" and add it to the existing group. Cheers!
I am working on a script and a PowerCLI commandlet seems to already be written for it. The script adds an existing vm to an existing DRS Rule. Here is the code for the commandlet I would like ... See more...
I am working on a script and a PowerCLI commandlet seems to already be written for it. The script adds an existing vm to an existing DRS Rule. Here is the code for the commandlet I would like to replicate: $spec = New-Object VMware.Vim.ClusterConfigSpecEx $spec.groupSpec = New-Object VMware.Vim.ClusterGroupSpec[] (1) $spec.groupSpec[0] = New-Object VMware.Vim.ClusterGroupSpec $spec.groupSpec[0].operation = "edit" $spec.groupSpec[0].info = $DrsGroup $spec.groupSpec[0].info.vm += $VM.ExtensionData.MoRef $Cluster.ExtensionData.ReconfigureComputeResource_Task($spec, $true) To my understanding, something along the following lines can be done to translate this to Perl: 1. Create a ClusterGroupSpec object with the correct information. I fail here, and am unsure of how to add "info.vm" into ClusterGroupSpec in Perl.      my $cluster_group_spec = ClusterGroupSpec->new(operation => "edit", info => $drs_rule_name... 2. Pass this as a ClusterConfigSpecEx object into rulesSpec      my $cluster_config_spec = ClusterConfigSpecEx->new(rulesSpec => [$cluster_group_spec]); 3. Reconfigure with spec as $cluster_config_spec. What I am confused about is how to pass in info.vm from the PowerCLI. There is no member of info or ClusterConfigInfo called "vm". How would I tell the Group Spec what VM to use? Updated the title to be more informative (it is no longer solely a "translation", the thread contains the answer to the title now).
In vSphere you can right click a Cluster, click "Edit Settings > DRS Groups Manager > (select a group), Edit" and see a list of virtual machines that are in the cluster. I am looking to get th... See more...
In vSphere you can right click a Cluster, click "Edit Settings > DRS Groups Manager > (select a group), Edit" and see a list of virtual machines that are in the cluster. I am looking to get this same list with the SDK... I have been hunting for a way to get it but cannot find where in the API this might be, any ideas of how I could get the list? Glad to provide code so far, but it's just some simple cluster related statistics and information; nothing actually related to the question.