Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds support for cold migration to drain script #93

Draft
wants to merge 4 commits into
base: stackhpc/xena
Choose a base branch
from

Conversation

jovial
Copy link
Contributor

@jovial jovial commented Jul 22, 2022

No description provided.

@jovial jovial force-pushed the feature/xena/cold-migration branch from 43af6af to 18ec478 Compare July 22, 2022 09:42
@@ -5,68 +5,39 @@
tags:
- nova-compute-drain
vars:
venv: "{{ virtualenv_path }}/openstack"
live_migration_fatal: true
nova_compute_migration_fatal: true
tasks:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to put this in a main.yml, using include_tasks instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

virtualenv: "{{ nova_compute_drain_venv }}"
name:
- python-openstackclient

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confusing blank line?

pip:
virtualenv: "{{ nova_compute_drain_venv }}"
name:
- python-openstackclient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we pin it, or use upper constraints? (as was done before)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, In train where I was testing this we couldn't use: --os-compute-api-version 2.25. So I needed to install a later version IIRC. I'll re-add constraints.

extra_args: "{% if pip_upper_constraints_file %}-c {{ pip_upper_constraints_file }}{% endif %}"
- include_role:
name: nova-compute-drain
tasks_from: setup.yml
run_once: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not required

ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"
register: result
failed_when:
- result is failed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need delegate_to?

register: instances
environment: "{{ openstack_auth_env }}"
vars:
ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need delegate_to?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yep looks like it. Not sure, how that got lost! I'll re-add.

until: result.stdout == 'SHUTOFF'
retries: 10
delay: 30
environment: "{{ openstack_auth_env }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need delegate_to?

environment: "{{ openstack_auth_env }}"
vars:
ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"
instance_uuid: "{{ item.ID | default }}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit odd having this loop variable without a loop in this file.

virtualenv: "{{ nova_compute_drain_venv }}"
name:
- python-openstackclient

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

register: instances
environment: "{{ openstack_auth_env }}"
vars:
ansible_host: "{{ hostvars[nova_compute_drain_delegate_host].ansible_host }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yep looks like it. Not sure, how that got lost! I'll re-add.

- name: Query instances
command: >
{{ nova_compute_drain_venv }}/bin/openstack
server list --host {{ ansible_facts.fqdn }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
server list --host {{ ansible_facts.fqdn }}
server list --host {{ ansible_facts.nodename }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the cloud I was testing on their was some funkiness around the compute host names. nodenmae is the correct value to use.

@@ -5,68 +5,39 @@
tags:
- nova-compute-drain
vars:
venv: "{{ virtualenv_path }}/openstack"
live_migration_fatal: true
nova_compute_migration_fatal: true
tasks:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

@jovial jovial requested a review from a team as a code owner November 16, 2022 09:38
@jovial jovial marked this pull request as draft November 16, 2022 09:39
@jovial
Copy link
Contributor Author

jovial commented Nov 16, 2022

Awaiting testing after refactoring

@jovial jovial closed this Nov 16, 2022
@jovial jovial reopened this Nov 16, 2022
@markgoddard
Copy link
Contributor

Is this ready for another review?

Copy link
Contributor

@markgoddard markgoddard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jovial
Copy link
Contributor Author

jovial commented Feb 23, 2023

Could we add this role to https://github.com/stackhpc/ansible-collection-openstack-ops instead?

Sounds good. I may have an opportunity to test this soon so will propose something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants