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

please give documentation about DRS rules #112

Open
Zugschlus opened this issue Sep 18, 2017 · 5 comments
Open

please give documentation about DRS rules #112

Zugschlus opened this issue Sep 18, 2017 · 5 comments

Comments

@Zugschlus
Copy link

Hi,
I would like to create virtual machines with a DRS rule to not place two machines (culster nodes) together on the same ESX server if possible. I have seen in the change log that fog-vsphere supports DRS rules but there is absolutly no documentation. Is it possible to have docs or even examples, so that I can try making sense out of things with the help of my VMware people?
Thanks!
Greetings
Marc

@jrgarcia
Copy link
Contributor

While I did approve and go through the change, I don't remember exactly how it was done. I'll see if I can pull that up and write something up for you. Thanks for reporting!

@jrgarcia jrgarcia self-assigned this Sep 18, 2017
@pedantic-git
Copy link
Contributor

It's been a long time but I think it was me that added the DRS rules, although I think only cluster affinity is supported (adding others should be easy).

There are examples of usage in the test file: https://github.com/fog/fog-vsphere/blob/master/tests/models/compute/rules_tests.rb

@Zugschlus
Copy link
Author

Hi, @jrgarcia, anything new happening here?
@pedantic-git, I obviously don't have enough VMware knowledge to guess what the example code means :-(

@carlospuga
Copy link
Contributor

I also added code to the DRS rules but for anti-affinity.
It too was a long time ago but the following is an implementation that you can use as a sample.
The add_node.rb calls the drs_rule_manager.rb which leverages the fog-vsphere-1.5.1.gem.
Hope it can help.
https://github.com/oneops/circuit-oneops-1/blob/master/components/cookbooks/vsphere/recipes/add_node.rb
https://github.com/oneops/circuit-oneops-1/blob/master/components/cookbooks/vsphere/libraries/drs_rule_manager.rb

@pedantic-git
Copy link
Contributor

Hi @Zugschlus - it's been a long time, but from the example code I'm pretty sure you can just create a new rule by calling cluster.rules.new and then assign VMs to it:

rule = cluster.rules.new(name: 'affinity-foo', enabled: true, type: RbVmomi::VIM::ClusterAffinityRuleSpec)
rule.vms = [server1, server2] # server objects
rule.save

The RbVmomi::VIM::ClusterAffinityRuleSpec is a rule type constant taken from RbVmomi. If you need something different from affinity you could take a look at the constants in that library.

The cluster is a fog cluster object retrieved by datacenter.clusters.get('ClusterName').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants