Skip to content

Commit 969de52

Browse files
committed
Address code review comments
1 parent 18ec478 commit 969de52

File tree

5 files changed

+5
-34
lines changed

5 files changed

+5
-34
lines changed

etc/kayobe/ansible/nova-compute-drain.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,3 @@
99
tasks:
1010
- include_role:
1111
name: nova-compute-drain
12-
tasks_from: setup.yml
13-
run_once: true
14-
15-
- include_role:
16-
name: nova-compute-drain
17-
tasks_from: instance-info.yml
18-
19-
- include_role:
20-
name: nova-compute-drain
21-
tasks_from: live-migrate.yml
22-
loop: "{{ nova_compute_drain_instance_info | selectattr('Status', 'equalto', 'ACTIVE') | list }}"
23-
loop_control:
24-
label: "{{ item.ID | default }}"
25-
26-
- include_role:
27-
name: nova-compute-drain
28-
tasks_from: cold-migrate.yml
29-
loop: "{{ nova_compute_drain_instance_info | selectattr('Status', 'equalto', 'SHUTOFF') | list }}"
30-
loop_control:
31-
label: "{{ item.ID | default }}"
32-
33-
- include_role:
34-
name: nova-compute-drain
35-
tasks_from: instance-info.yml
36-
37-
- name: Fail if there are instances still on the host
38-
fail:
39-
msg: >
40-
Instances still on {{ inventory_hostname }}: {{ instances.stdout | from_json }}
41-
when:
42-
- nova_compute_migration_fatal | bool
43-
- nova_compute_drain_instance_info | length > 0

etc/kayobe/ansible/roles/nova-compute-drain/tasks/cold-migrate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
retries: 10
3232
delay: 30
3333
environment: "{{ openstack_auth_env }}"
34+
delegate_to: "{{ nova_compute_drain_delegate_host }}"
3435
vars:
3536
ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"
3637
instance_uuid: "{{ item.ID | default }}"

etc/kayobe/ansible/roles/nova-compute-drain/tasks/instance-info.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
- name: Query instances
33
command: >
44
{{ nova_compute_drain_venv }}/bin/openstack
5-
server list --host {{ ansible_facts.fqdn }}
5+
server list --host {{ ansible_facts.nodename }}
66
--all-projects
77
--format json
88
register: instances
9+
delegate_to: "{{ nova_compute_drain_delegate_host }}"
910
environment: "{{ openstack_auth_env }}"
1011
vars:
1112
ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"

etc/kayobe/ansible/roles/nova-compute-drain/tasks/live-migrate.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
{{ instance_uuid }}
99
--live-migration
1010
--wait
11+
delegate_to: "{{ nova_compute_drain_delegate_host }}"
1112
environment: "{{ openstack_auth_env }}"
1213
vars:
1314
instance_uuid: "{{ item.ID | default }}"

etc/kayobe/ansible/roles/nova-compute-drain/tasks/setup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
virtualenv: "{{ nova_compute_drain_venv }}"
2121
name:
2222
- python-openstackclient
23-
23+
extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
2424
run_once: true
2525
delegate_to: "{{ nova_compute_drain_delegate_host }}"
2626
vars:

0 commit comments

Comments
 (0)