Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Affinity rule on a particular VM to stop DRS #25

Closed
reubenur-rahman opened this issue Apr 7, 2014 · 2 comments
Closed

Set Affinity rule on a particular VM to stop DRS #25

reubenur-rahman opened this issue Apr 7, 2014 · 2 comments
Labels

Comments

@reubenur-rahman
Copy link

Hi guys,

I'm writing a python code to Set Affinity rule on a particular VM to stop DRS. I am taking help from Steve Jin's DrsAffRule.java .

I am doing something like :

affinityspec = vim.cluster.AffinityRuleSpec()
affinityspec.name = "My Affinity Group"
affinityspec.enabled = True
affinityspec.vm(my_vm)

The equivalent Java Code I found :

    ClusterAffinityRuleSpec cars = new ClusterAffinityRuleSpec();
    cars.setName("App and DB Appliance Bundle");
    cars.setEnabled(Boolean.TRUE);
    ManagedObjectReference vm1 = createMOR("VirtualMachine", vm1_oid);
    ManagedObjectReference vm2 = createMOR("VirtualMachine", vm2_oid);
    cars.setVm(new ManagedObjectReference[] {vm1, vm2});

Now the problem is affinityspec.vm() takes the MOR of VM . Any idea how do I write a createMOR() function ???

  • Reuben
@joshk0
Copy link
Contributor

joshk0 commented Apr 7, 2014

Try using dir(affinityspec) to see what you can do with the object. The
mapping of schema to methods/properties is sometimes a little weird
compared to Java.
On Apr 7, 2014 2:14 AM, "rreubenur" notifications@github.com wrote:

Hi guys,

I'm writing a python code to Set Affinity rule on a particular VM to stop
DRS. I am taking help from Steve Jin's DrsAffRule.java .

I am doing something like :

affinityspec = vim.cluster.AffinityRuleSpec()affinityspec.name = "My Affinity Group"
affinityspec.enabled = True
affinityspec.vm(my_vm)

The equivalent Java Code I found :

ClusterAffinityRuleSpec cars = new ClusterAffinityRuleSpec();
cars.setName("App and DB Appliance Bundle");
cars.setEnabled(Boolean.TRUE);
ManagedObjectReference vm1 = createMOR("VirtualMachine", vm1_oid);
ManagedObjectReference vm2 = createMOR("VirtualMachine", vm2_oid);
cars.setVm(new ManagedObjectReference[] {vm1, vm2});

Now the problem is affinityspec.vm() takes the MOR of VM . Any idea how do
I write a createMOR() function ???

  • Reuben


Reply to this email directly or view it on GitHubhttps://github.com//issues/25
.

@hartsock
Copy link
Member

hartsock commented Jun 4, 2014

Opened a sample request for this.

@hartsock hartsock closed this as completed Jun 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants