Create aggregates + add hosts to aggregates
diff --git a/_states/novang.py b/_states/novang.py
index 46fae9c..17ba41c 100644
--- a/_states/novang.py
+++ b/_states/novang.py
@@ -67,6 +67,20 @@
return _already_exists(availability_zone, 'availabilty zone')
return existing_availability_zones
+def aggregate_present(name=None, aggregate=None, profile=None):
+ '''
+ Ensures that the nova aggregate exists
+ '''
+ name = aggregate
+ aggregate_exists = __salt__['novang.aggregate_get'](name, profile)
+ if aggregate_exists == False:
+ item_created = __salt__['novang.aggregate_create'](name, aggregate, profile)
+ if bool(item_created):
+ return _created(aggregate, 'aggregate', item_created)
+ else:
+ return _already_exists(aggregate, 'aggregate')
+ return existing_aggregate
+
def instance_present(name, flavor, image, networks, security_groups=None, profile=None, tenant_name=None):
ret = {'name': name,
@@ -166,4 +180,4 @@
else:
changes_dict['comment'] = \
'{0} {1} is in correct state'.format(resource, name)
- return changes_dict
\ No newline at end of file
+ return changes_dict