Merge pull request #12 from mnederlof/custom-scheduler-filters
Include option for custom scheduler filter for newton and ocata
diff --git a/README.rst b/README.rst
index bb8f2de..d6d5dd8 100644
--- a/README.rst
+++ b/README.rst
@@ -131,6 +131,9 @@
enabled: true
virtualization: kvm
availability_zone: availability_zone_01
+ aggregates:
+ - hosts_with_fc
+ - hosts_with_ssd
security_group: true
resume_guests_state_on_host_boot: False
bind:
@@ -281,6 +284,21 @@
- availability_zone_01
- availability_zone_02
+
+
+Aggregates
+
+.. code-block:: yaml
+
+ nova:
+ client:
+ enabled: true
+ server:
+ identity:
+ aggregates:
+ - aggregate1
+ - aggregate2
+
SR-IOV
------
diff --git a/_modules/novang.py b/_modules/novang.py
index d2009ae..dcac2fc 100644
--- a/_modules/novang.py
+++ b/_modules/novang.py
@@ -243,3 +243,44 @@
'Availability Zone': item.__getattr__('availability_zone'),
}
return ret
+
+def aggregate_list(profile=None):
+ '''
+ list existing aggregates
+ '''
+ connection_args = get_connection_args(profile)
+ conn = _auth(profile)
+ nt_ks = conn.compute_conn
+ ret = nt_ks.aggregates.list()
+ return ret
+
+
+def aggregate_get(name, profile=None):
+ '''
+ list existing aggregates
+ '''
+ connection_args = get_connection_args(profile)
+ conn = _auth(profile)
+ nt_ks = conn.compute_conn
+ aggregate_exists=False
+ items = aggregate_list(profile)
+ for p in items:
+ item = nt_ks.aggregates.get(p).__getattr__('name')
+ if item == name:
+ aggregate_exists = True
+ return aggregate_exists
+
+
+def aggregate_create(name, aggregate, profile=None):
+ '''
+ create aggregate
+ '''
+ connection_args = get_connection_args(profile)
+ conn = _auth(profile)
+ nt_ks = conn.compute_conn
+ item = nt_ks.aggregates.create(name, aggregate)
+ ret = {
+ 'Id': item.__getattr__('id'),
+ 'Aggregate Name': item.__getattr__('name'),
+ }
+ return ret
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
diff --git a/nova/client.sls b/nova/client.sls
index 2d20a8f..57d62e5 100644
--- a/nova/client.sls
+++ b/nova/client.sls
@@ -44,6 +44,17 @@
{%- endif %}
+{%- if identity.aggregates is defined %}
+
+{%- for aggregate_name in identity.aggregates %}
+nova_aggregate_{{ aggregate_name }}:
+ novang.aggregate_present:
+ - aggregate: {{ aggregate_name }}
+ - profile: {{ identity_name }}
+{%- endfor %}
+
+{%- endif %}
+
{%- endfor %}
{%- endif %}
diff --git a/nova/compute.sls b/nova/compute.sls
index a599fcf..efc8b0a 100644
--- a/nova/compute.sls
+++ b/nova/compute.sls
@@ -120,8 +120,6 @@
- watch:
- file: /etc/nova/nova.conf
-{%- if compute.availability_zone != None %}
-
{%- set ident = compute.identity %}
{%- if ident.get('api_version', '2') == '3' %}
@@ -138,6 +136,8 @@
{%- set identity_params = " --os-username="+ident.user+" --os-password="+ident.password+" --os-project-name="+ident.tenant+" --os-auth-url="+protocol+"://"+ident.host+":"+ident.port|string+"/"+version %}
+{%- if compute.availability_zone != None %}
+
Add_compute_to_availability_zone_{{ compute.availability_zone }}:
cmd.run:
- name: "nova {{ identity_params }} aggregate-add-host {{ compute.availability_zone }} {{ pillar.linux.system.name }}"
@@ -145,6 +145,14 @@
{%- endif %}
+{%- for aggregate in compute.aggregates %}
+Add_compute_to_aggregate_{{ aggregate }}:
+ cmd.run:
+ - name: "nova {{ identity_params }} aggregate-add-host {{ aggregate }} {{ pillar.linux.system.name }}"
+ - unless: "nova {{ identity_params }} aggregate-details {{ aggregate }} | grep {{ pillar.linux.system.name }}"
+
+{%- endfor %}
+
{%- if compute.virtualization == 'kvm' %}
{% if compute.ceph is defined %}
diff --git a/nova/files/juno/nova-controller.conf.Debian b/nova/files/juno/nova-controller.conf.Debian
index 8e8d138..0415ff6 100644
--- a/nova/files/juno/nova-controller.conf.Debian
+++ b/nova/files/juno/nova-controller.conf.Debian
@@ -70,7 +70,6 @@
security_group_api = neutron
rpc_backend = nova.rpc.impl_kombu
-start_guests_on_host_boot=truembu
{%- if controller.cache is defined %}
memcached_servers={%- for member in controller.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
@@ -114,7 +113,6 @@
{%- endif %}
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
rpc_cast_timeout = 30
rpc_conn_pool_size = 300
diff --git a/nova/files/kilo/nova-controller.conf.Debian b/nova/files/kilo/nova-controller.conf.Debian
index e61da50..99dfe00 100644
--- a/nova/files/kilo/nova-controller.conf.Debian
+++ b/nova/files/kilo/nova-controller.conf.Debian
@@ -72,7 +72,6 @@
security_group_api = neutron
rpc_backend = nova.rpc.impl_kombu
-start_guests_on_host_boot=truembu
{%- if controller.cache is defined %}
memcached_servers={%- for member in controller.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
@@ -103,7 +102,6 @@
{%- endif %}
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
rpc_cast_timeout = 30
rpc_conn_pool_size = 300
diff --git a/nova/files/liberty/nova-compute.conf.Debian b/nova/files/liberty/nova-compute.conf.Debian
index 4df50c7..283f9c4 100644
--- a/nova/files/liberty/nova-compute.conf.Debian
+++ b/nova/files/liberty/nova-compute.conf.Debian
@@ -92,7 +92,7 @@
block_device_allocate_retries=600
block_device_allocate_retries_interval=10
-resume_guests_state_on_host_boot = True
+resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', True) }}
service_down_time = 90
{% if pillar.ceilometer is defined %}
@@ -125,8 +125,6 @@
notification_driver = messagingv2
{%- endif %}
-resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', False) }}
-
{%- if compute.identity.get('version', 2) == 2 %}
[keystone_authtoken]
diff --git a/nova/files/liberty/nova-controller.conf.Debian b/nova/files/liberty/nova-controller.conf.Debian
index bf7d9dd..1109fa4 100644
--- a/nova/files/liberty/nova-controller.conf.Debian
+++ b/nova/files/liberty/nova-controller.conf.Debian
@@ -73,7 +73,6 @@
security_group_api = neutron
rpc_backend = nova.rpc.impl_kombu
-start_guests_on_host_boot=true
{%- if controller.cache is defined %}
memcached_servers={%- for member in controller.cache.members %}{{ member.host }}:11211{% if not loop.last %},{% endif %}{%- endfor %}
@@ -105,7 +104,6 @@
{%- endif %}
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
rpc_cast_timeout = 30
rpc_conn_pool_size = 300
diff --git a/nova/files/mitaka/nova-compute.conf.Debian b/nova/files/mitaka/nova-compute.conf.Debian
index c2f522d..33ccb4a 100644
--- a/nova/files/mitaka/nova-compute.conf.Debian
+++ b/nova/files/mitaka/nova-compute.conf.Debian
@@ -56,7 +56,7 @@
block_device_allocate_retries=600
block_device_allocate_retries_interval=10
-resume_guests_state_on_host_boot = True
+resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', True) }}
service_down_time = 90
{% if pillar.ceilometer is defined %}
@@ -72,8 +72,6 @@
notify_on_state_change = vm_and_task_state
{%- endif %}
-resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', False) }}
-
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
diff --git a/nova/files/mitaka/nova-controller.conf.Debian b/nova/files/mitaka/nova-controller.conf.Debian
index 848a77e..f03eecc 100644
--- a/nova/files/mitaka/nova-controller.conf.Debian
+++ b/nova/files/mitaka/nova-controller.conf.Debian
@@ -61,7 +61,6 @@
{%- endif %}
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
rpc_cast_timeout = 30
rpc_response_timeout = 3600
diff --git a/nova/files/newton/nova-compute.conf.Debian b/nova/files/newton/nova-compute.conf.Debian
index 2c1a7a0..b0ce077 100644
--- a/nova/files/newton/nova-compute.conf.Debian
+++ b/nova/files/newton/nova-compute.conf.Debian
@@ -58,7 +58,7 @@
block_device_allocate_retries=600
block_device_allocate_retries_interval=10
-resume_guests_state_on_host_boot = True
+resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', True) }}
service_down_time = 90
{%- if compute.message_queue.members is defined %}
@@ -86,8 +86,6 @@
notify_on_state_change = vm_and_task_state
{%- endif %}
-resume_guests_state_on_host_boot = {{ compute.get('resume_guests_state_on_host_boot', False) }}
-
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
diff --git a/nova/files/newton/nova-controller.conf.Debian b/nova/files/newton/nova-controller.conf.Debian
index d5cee23..159485f 100644
--- a/nova/files/newton/nova-controller.conf.Debian
+++ b/nova/files/newton/nova-controller.conf.Debian
@@ -65,8 +65,6 @@
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
-resume_guests_state_on_host_boot=true
rpc_cast_timeout = 30
rpc_response_timeout = 3600
diff --git a/nova/files/newton/nova-controller.conf.RedHat b/nova/files/newton/nova-controller.conf.RedHat
index 7f87aa4..c8382d7 100644
--- a/nova/files/newton/nova-controller.conf.RedHat
+++ b/nova/files/newton/nova-controller.conf.RedHat
@@ -62,8 +62,6 @@
allow_resize_to_same_host=True
-start_guests_on_host_boot=true
-resume_guests_state_on_host_boot=true
rpc_cast_timeout = 30
rpc_response_timeout = 3600
diff --git a/nova/files/ocata/nova-compute.conf.Debian b/nova/files/ocata/nova-compute.conf.Debian
index 55d89a2..7039384 100644
--- a/nova/files/ocata/nova-compute.conf.Debian
+++ b/nova/files/ocata/nova-compute.conf.Debian
@@ -669,7 +669,7 @@
# resume their state each time the compute node boots or restarts.
# (boolean value)
#resume_guests_state_on_host_boot=false
-resume_guests_state_on_host_boot=true
+resume_guests_state_on_host_boot={{ compute.get('resume_guests_state_on_host_boot', True) }}
#
# Number of times to retry network allocation. It is required to attempt network
diff --git a/nova/files/ocata/nova-controller.conf.Debian b/nova/files/ocata/nova-controller.conf.Debian
index 274a930..a2add91 100644
--- a/nova/files/ocata/nova-controller.conf.Debian
+++ b/nova/files/ocata/nova-controller.conf.Debian
@@ -652,14 +652,6 @@
#live_migration_retry_count=30
#
-# This option specifies whether to start guests that were running before the
-# host rebooted. It ensures that all of the instances on a Nova compute node
-# resume their state each time the compute node boots or restarts.
-# (boolean value)
-#resume_guests_state_on_host_boot=false
-resume_guests_state_on_host_boot=true
-
-#
# Number of times to retry network allocation. It is required to attempt network
# allocation retries if the virtual interface plug fails.
#
diff --git a/nova/map.jinja b/nova/map.jinja
index 10577d5..1842234 100644
--- a/nova/map.jinja
+++ b/nova/map.jinja
@@ -47,6 +47,7 @@
'debug': false,
'notification': false,
'availability_zone': None,
+ 'aggregates': [],
'identity': {
'region': 'RegionOne'
},