summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Riedemann <mriedem.os@gmail.com>2019-05-01 11:24:27 -0400
committerMatt Riedemann <mriedem.os@gmail.com>2019-12-23 10:10:57 -0500
commit7661995b69c3302533646dc72446fcdea496e589 (patch)
tree091e600c4db9a320f88661ae963fd250e1c2c36e
parent6ebee92445d799a2e610116cf72b4bf3d3d6a2f3 (diff)
downloadnova-7661995b69c3302533646dc72446fcdea496e589.tar.gz
Enable cross-cell resize in the nova-multi-cell job
This changes the nova-multi-cell job to essentially force cross-cell resize and cold migration. By "force" I mean there is only one compute in each cell and resize to the same host is disabled, so the scheduler has no option but to move the server to the other cell. This adds a new role to write the nova policy.yaml file to enable cross-cell resize and a pre-run playbook so that the policy file setup before tempest runs. Part of blueprint cross-cell-resize Change-Id: Ia4f3671c40e69674afc7a96b5d9b198dabaa4224
-rw-r--r--.zuul.yaml27
-rw-r--r--playbooks/nova-multi-cell/pre.yaml7
-rw-r--r--roles/setup-multi-cell-policy/README.rst10
-rw-r--r--roles/setup-multi-cell-policy/defaults/main.yaml1
-rw-r--r--roles/setup-multi-cell-policy/tasks/main.yaml18
5 files changed, 52 insertions, 11 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index 28f7861ee1..d299257ba4 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -296,15 +296,19 @@
tempest_test_regex: ^tempest\.(scenario|(api\.compute))
tempest_test_blacklist: '{{ ansible_user_dir }}/{{ zuul.projects["opendev.org/openstack/nova"].src_dir }}/devstack/nova-multi-cell-blacklist.txt'
devstack_local_conf:
+ post-config:
+ $NOVA_CONF:
+ oslo_policy:
+ # The default policy file is policy.json but the
+ # setup-multi-cell-policy role will write to policy.yaml.
+ policy_file: policy.yaml
test-config:
$TEMPEST_CONFIG:
compute-feature-enabled:
- # TODO(mriedem): Enable cold migration once cross-cell resize is
- # supported. We cannot enable it until then because this job has
- # one compute in each cell and with
- # allow_resize_to_same_host=True cold migrate will try to migrate
- # on the same host which is not supported by the libvirt driver.
- cold_migration: false
+ # Enable cold migration for migrating across cells. Note that
+ # because NOVA_ALLOW_MOVE_TO_SAME_HOST=false, all cold migrations
+ # will move across cells.
+ cold_migration: true
devstack_services:
# Disable other non-essential services that we don't need for this job.
c-bak: false
@@ -312,11 +316,9 @@
USE_PYTHON3: True
# Setup two non-cell0 cells (cell1 and cell2).
NOVA_NUM_CELLS: 2
- # Resize to the same host is supported for now since we only have
- # two computes and they are in different cells.
- # TODO(mriedem): Disable resize to the same host once cross-cell resize
- # is supported so all resizes will move across cells.
- NOVA_ALLOW_MOVE_TO_SAME_HOST: true
+ # Disable resize to the same host so all resizes will move across
+ # cells.
+ NOVA_ALLOW_MOVE_TO_SAME_HOST: false
# We only have two computes and we don't yet support cross-cell live
# migration.
LIVE_MIGRATION_AVAILABLE: false
@@ -335,6 +337,9 @@
# Disable other non-essential services that we don't need for this
# job.
c-bak: false
+ # Perform setup for the multi-cell environment. Note that this runs
+ # before devstack is setup on the controller host.
+ pre-run: playbooks/nova-multi-cell/pre.yaml
- job:
name: nova-osprofiler-redis
diff --git a/playbooks/nova-multi-cell/pre.yaml b/playbooks/nova-multi-cell/pre.yaml
new file mode 100644
index 0000000000..329f51b1f9
--- /dev/null
+++ b/playbooks/nova-multi-cell/pre.yaml
@@ -0,0 +1,7 @@
+- hosts: controller
+ roles:
+ # /etc/nova/policy.yaml is going to be owned by the stack user so we need
+ # to make sure that user exists on the controller host first.
+ - setup-stack-user
+ # Write rules to the /etc/nova/policy.yaml file.
+ - setup-multi-cell-policy
diff --git a/roles/setup-multi-cell-policy/README.rst b/roles/setup-multi-cell-policy/README.rst
new file mode 100644
index 0000000000..cd7b9f3903
--- /dev/null
+++ b/roles/setup-multi-cell-policy/README.rst
@@ -0,0 +1,10 @@
+Setup multi-cell policy on the controller host. This should not require
+a restart of the n-api service (the policy changes should be read
+dynamically). The stack user must exist on the controller host first.
+
+**Role Variables**
+
+.. zuul:rolevar:: nova_config_dir
+ :default: /etc/nova
+
+ The nova configuration directory.
diff --git a/roles/setup-multi-cell-policy/defaults/main.yaml b/roles/setup-multi-cell-policy/defaults/main.yaml
new file mode 100644
index 0000000000..622a1a9e5b
--- /dev/null
+++ b/roles/setup-multi-cell-policy/defaults/main.yaml
@@ -0,0 +1 @@
+nova_config_dir: /etc/nova
diff --git a/roles/setup-multi-cell-policy/tasks/main.yaml b/roles/setup-multi-cell-policy/tasks/main.yaml
new file mode 100644
index 0000000000..9adc8aad18
--- /dev/null
+++ b/roles/setup-multi-cell-policy/tasks/main.yaml
@@ -0,0 +1,18 @@
+# Ensure the nova configuration directory exists before writing the policy
+# file to it.
+- name: Create nova conf dir
+ file:
+ path: '{{ nova_config_dir }}'
+ state: directory
+ owner: stack
+ become: yes
+
+# Write the policy file rule for multi-cell resize.
+- name: Setup multi-cell policy
+ copy:
+ content: |
+ # Enable cross-cell resize.
+ "compute:servers:resize:cross_cell": "rule:admin_or_owner"
+ dest: '{{ nova_config_dir }}/policy.yaml'
+ owner: stack
+ become: yes