Add retry_with_timeout to RetryBlock

Signed-off-by: Tom Xing <xingzhou@cn.ibm.com>
Cluster object is actually a symbol

We set cluster managed object on :obj

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Add get_managed_objects_with_attribute to vsphere client

Allows to find objects based on custom attribute key

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Refactor VSphereClient

Extract searching functionality to CloudSearcher. That allows all
classes to abstract getting object from vsphere cloud. This makes
testing simpler as it allows to stub returned objects.

Signed-off-by: Tom Xing <xingzhou@cn.ibm.com>
Add DRS rules functionality

* Create attribute 'drs_rule' in vsphere when creating VM
* Tag VM with DRS rule name. Tagging was introduced to keep track of VMs
that should belong to DRS rule since DRS rule can only be created with
at least two VMs.
* Create DRS rule after VM is created. Creating DRS rule gets all VMs
tagged with the the rule name and attempts to create or update it if it
exists under lock in vsphere.
* Lock is a state saved in VSphere - custom attribute that can only have
unique name. Timeout to acquire lock is 30 seconds.
* Save DRS rules config on cluster object.
* Introduce DRS rule cleaner which cleans up attribute if there are no
VMs tagged with that attribute.
* Changing cloud properties recreates VM, VSphere handles VM removal from
DRS rules automatically. DRS rules are being cleaned up if they have
less than two VMs.

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Clean up drs rules after vm deletion

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Only allow drs rule type separate_vms

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Validate DRS rule config

* Only allow one DRS rule in cloud properties
* Only allow separate_vms type

Signed-off-by: Maria Shaldibina <mariash@pivotallabs.com>
Add logging to drs rules

Signed-off-by: Tom Xing <xingzhou@cn.ibm.com>