How to get DRS Rules associated with each VM in the DRS cluster

//:: # Author: Vikas Shitoleff//:: # Author: Vikas Shitole
//:: # Website: www.vThinkBeyondVM.com
//:: # Product/Feature: vCenter Server/DRS
//:: # Description: Script to find all the rules associated with all the VMs in the DRS cluster
//::# Reference: http://vthinkbeyondvm.com/how-to-get-all-drs-rules-associated-with-each-vm-in-a-drs-cluster-using-api-interesting-api-in-vsphere-6-0/
//:# How to run this sample: http://vthinkbeyondvm.com/getting-started-with-yavi-java-opensource-java-sdk-for-vmware-vsphere-step-by-step-guide-for-beginners/
//:: # Author: Vikas Shitole
//:: # Product/Feature: vCenter Server/DRS
//:: # Description: Script to find all the rules associated with all the VMs in the DRS cluster
//::# Reference: http://vthinkbeyondvm.com/how-to-get-all-drs-rules-associated-with-each-vm-in-a-drs-cluster-using-api-interesting-api-in-vsphere-6-0/
//:# How to run this sample: http://vthinkbeyondvm.com/getting-started-with-yavi-java-opensource-java-sdk-for-vmware-vsphere-step-by-step-guide-for-beginners/
 
//:: # Website: www.vThinkBeyondVM.com
//:: # Product/Feature: vCenter Server/DRS
//:: # Description: Script to find all the rules associated with all the VMs in the DRS cluster
//::# Reference: http://vthinkbeyondvm.com/how-to-get-all-drs-rules-associated-with-each-vm-in-a-drs-cluster-using-api-interesting-api-in-vsphere-6-0/
//:# How to run this sample: http://vthinkbeyondvm.com/getting-started-with-yavi-java-opensource-java-sdk-for-vmware-vsphere-step-by-step-guide-for-beginners/

Sign in to be able to add comments.

Comments 2


1361664789 6 years ago
Hey Bro, How can I get the rules with SDK 5? the method findRulesForVM() in the class VimPortType has 2 parameters... I'm new on all this thing
shitolev 6 years ago
Hi Bro, findRulesForVM() method is available only on vSphere 6.0 (not on any release prior to 6.0), hence above sample may not work for you. There is a way to achieve the same on SDK 5 as well but it is little tricky. I will come back with another sample and share with you.