VMware Cloud Community
paetecsfb
Enthusiast
Enthusiast

new-drsrule issues

Hello all,

I have a series of scripts of run to create my DRS rules, but for some reason they are no longer working.  They stopped since I've upgraded to 4.1 U1, and also don't work on a fresh install of PowerCLI either.

Here is the syntax I've tried, both failing... well sorta failing.  They'll produce the error below but the rules do in fact get created and work as expected:

Get-Cluster -VM "nyroctrdwa01","nyroctrdwa02" | New-DrsRule -name "nyroctrdwa01,nyroctrdwa02" -KeepTogether $false -vm "nyroctrdwa01","nyroctrdwa02"
New-DrsRule -Cluster "Corporate 2" -name "nyroctrdwa01,nyroctrdwa02" -KeepTogether $false -vm "nyroctrdwa01","nyroctrdwa02"

The error is the following:

New-DrsRule : 3/25/2011 9:44:53 AM    New-DrsRule        Unable to cast object
of type 'VMware.Vim.ClusterVmHostRuleInfo' to type 'VMware.Vim.ClusterAntiAffin
ityRuleSpec'.
At line:1 char:12
+ New-DrsRule <<<<  -Cluster "Corporate 2" -Name test -KeepTogether $false -VM
nyroctrdwa01,nyroctrdwa02
    + CategoryInfo          : NotSpecified: (:) [New-DrsRule], ViError
    + FullyQualifiedErrorId : Client20_ClientSideTaskImpl_ThreadProc_Unhandled
   Exception,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewDrsRule
I've tried with and without quotes and changing the name to something simple without commas, like "test".  Neither work anymore.  Does anyone have any ideas?
Reply
0 Kudos
7 Replies
chriswahl
Virtuoso
Virtuoso

Based on the error information, it seems that whatever is contained in ClusterVmHostRuleInfo is the issue. The reference material on that particular bit of information is located at this link. It might help get you pointed in the right direction.

ClusterVmHostRuleInfo stores only the names of the relevant virtual machine and host groups. The group contents are stored in the virtual machine and host group objects.

http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.cluster.VmHostRuleInfo.h...

The ClusterAntiAffinityRuleSpec data object defines a set of virtual machines. DRS will attempt to schedule the virtual machines to run on different hosts.

http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/vim.cluster.AntiAffinityRule...

VCDX #104 (DCV, NV) ஃ WahlNetwork.com ஃ @ChrisWahl ஃ Author, Networking for VMware Administrators
Reply
0 Kudos
LucD
Leadership
Leadership

I can't reproduce your error with PowerCLI 4.1U1.

Did you run the command from the PowerCLI prompt ?

Are you running this against a vCenter 4.1 ?


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

Reply
0 Kudos
paetecsfb
Enthusiast
Enthusiast

I am running it from within the PowerCLI prompt and I am also at 4.1U1.  I also tried running the command from the actual vcenter server with a fresh install as well.

You know what I think the issue is, My environment is at 4.1, not 4.1u1, but I updated PowerCLI to 4.1u1 to do some VMware View stuff.  I am guessing that that's the issue.

Reply
0 Kudos
LucD
Leadership
Leadership

I also ran it against vSphere 4.1, so that's probably not it.


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

Reply
0 Kudos
paetecsfb
Enthusiast
Enthusiast

Hi LucD, thanks for your testing.  I tested some more and even at version 4.0, and 4.1 (non-update 1) on new systems the error still appears.  I recently (within the last three weeks) moved the vCenter server to new hardware and moved the database to a new DB server (from SQL 2005 to SQL 2008).  I'm wondering if this has something to do with it.

I'll continue to investigate on my end.

Reply
0 Kudos
LucD
Leadership
Leadership

Since the creation of the rule seems to work from the vSphere client, I don't think the database is involved.

And PowerCLI intercats with a vSphere server, it doesn't  do anything with the vCenter database.

Do you have a spare PC with PowerShell ?

Perhaps do a fresh PowerCLI installation on that PC and try from there.

Do you have another cluster without a blank in the name ?

Just a wild guess, but perhaps try it against another cluster.


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

Reply
0 Kudos
paetecsfb
Enthusiast
Enthusiast

The issue is now resolved.

I  tried multiple new clients with PowerCLI at various versions to no avail.  I did however test the syntax against another cluster and it worked fine.

I have no idea what it was or what it could have been, but re-creating the cluster solved the issue.

Reply
0 Kudos