Skip to content

Commit

Permalink
dev: potential fix for red job
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudguruab committed Oct 25, 2023
1 parent 41dc88c commit b65a471
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 20 deletions.
2 changes: 0 additions & 2 deletions os_migrate/plugins/module_utils/workload_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,9 @@ def _get_attachment(self, volume, vm):
Get the attachment object from the volume with the matching server ID.
Convenience method for use only when the attachment is already certain.
"""

for attachment in volume.attachments:
if attachment.server_id == vm.id:
return attachment

raise RuntimeError('Volume is not attached to the specified instance!')

def _wait_for_volume_dev_path(self, conn, volume, vm, timeout):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def _get_root_and_data_volumes(self):
if self.source_disks and volume.id not in self.source_disks:
self.log.info('Volume is not in specified disk list, ignoring.')
continue
self.log.info("server_id - %s", volume)

dev_path = self._get_attachment(volume, sourcevm).device
self.volume_map[dev_path] = dict(
source_dev=None, source_id=volume.id, dest_dev=None,
Expand Down
15 changes: 0 additions & 15 deletions os_migrate/roles/import_workloads/tasks/workload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@
- prelim is defined and prelim.changed
- item["_migration_params"]["data_copy"]|default(true)

- name: debug source volumes
ansible.builtin.debug:
msg: "{{ item }}"

- name: expose source volumes
os_migrate.os_migrate.import_workload_export_volumes:
cloud: src
Expand All @@ -87,21 +83,10 @@
ssh_user: "{{ os_migrate_conversion_host_ssh_user }}"
timeout: "{{ os_migrate_timeout }}"
register: exports
ignore_errors: true
when:
- prelim is defined and prelim.changed
- item["_migration_params"]["data_copy"]|default(true)

- name: Capture file contents
ansible.builtin.command: 'tail -n 300 {{ os_migrate_data_dir }}/workload_logs/osm_server.log'
register: file_contents
changed_when: false

- name: Print entire file contents
ansible.builtin.debug:
var: file_contents.stdout
changed_when: false

- name: transfer volumes to destination
os_migrate.os_migrate.import_workload_transfer_volumes:
cloud: dst
Expand Down
23 changes: 22 additions & 1 deletion tests/e2e/tasks/tenant/run_workload_existing_fip.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: get dst auth token
openstack.cloud.auth:
auth: "{{ os_migrate_dst_auth }}"
register: os_migrate_dst_token

- name: create osm_fip in destination
ansible.builtin.shell: |
Expand All @@ -11,7 +12,7 @@
environment:
OS_AUTH_TYPE: token
OS_AUTH_URL: "{{ os_migrate_dst_auth.auth_url }}"
OS_TOKEN: "{{ os_migrate_dst_auth.auth_token }}"
OS_TOKEN: "{{ os_migrate_dst_token.auth_token }}"
OS_PROJECT_ID: "{{ os_migrate_dst_auth.project_id|default('') }}"
OS_PROJECT_NAME: "{{ os_migrate_dst_auth.project_name|default('') }}"
OS_PROJECT_DOMAIN_ID: "{{ os_migrate_dst_auth.project_domain_id|default('') }}"
Expand All @@ -24,9 +25,29 @@
path: "{{ os_migrate_data_dir }}/workloads.yml"
regexp: "floating_ip_mode: .*"
replace: "floating_ip_mode: existing"
environment:
OS_AUTH_TYPE: token
OS_AUTH_URL: "{{ os_migrate_dst_auth.auth_url }}"
OS_TOKEN: "{{ os_migrate_dst_token.auth_token }}"
OS_PROJECT_ID: "{{ os_migrate_dst_auth.project_id|default('') }}"
OS_PROJECT_NAME: "{{ os_migrate_dst_auth.project_name|default('') }}"
OS_PROJECT_DOMAIN_ID: "{{ os_migrate_dst_auth.project_domain_id|default('') }}"
OS_PROJECT_DOMAIN_NAME: "{{ os_migrate_dst_auth.project_domain_name|default('') }}"
register: fip_mode
changed_when: "fip_mode.rc == 0"

- name: set floating_ip_address
ansible.builtin.replace:
path: "{{ os_migrate_data_dir }}/workloads.yml"
regexp: "floating_ip_address: .*"
replace: "floating_ip_address: {{ existing_fip.stdout }}"
environment:
OS_AUTH_TYPE: token
OS_AUTH_URL: "{{ os_migrate_dst_auth.auth_url }}"
OS_TOKEN: "{{ os_migrate_dst_token.auth_token }}"
OS_PROJECT_ID: "{{ os_migrate_dst_auth.project_id|default('') }}"
OS_PROJECT_NAME: "{{ os_migrate_dst_auth.project_name|default('') }}"
OS_PROJECT_DOMAIN_ID: "{{ os_migrate_dst_auth.project_domain_id|default('') }}"
OS_PROJECT_DOMAIN_NAME: "{{ os_migrate_dst_auth.project_domain_name|default('') }}"
register: set_fip
changed_when: "set_fip.rc == 0"
20 changes: 19 additions & 1 deletion tests/e2e/tasks/tenant/seed_workload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
openstack server create osm_server
--flavor "{{ os_migrate_src_osm_server_flavor|default(m1.small) }}"
--key-name osm_key
--image "{{ workload_image }}"
--network osm_net
--security-group osm_security_group
--image "{{ workload_image }}"
--wait
environment:
OS_AUTH_TYPE: token
Expand All @@ -37,3 +37,21 @@
OS_PROJECT_DOMAIN_NAME: "{{ os_migrate_src_auth.project_domain_name|default('') }}"
register: _result_osm_server
changed_when: "_result_osm_server.rc == 0"

- name: Output server id and volume id
ansible.builtin.debug:
msg: "{{ _result_osm_server.stdout }}"

- name: Add volume to osm_server
ansible.builtin.command:
cmd: openstack server add volume osm_server osm_volume
environment:
OS_AUTH_TYPE: token
OS_AUTH_URL: "{{ os_migrate_src_auth.auth_url }}"
OS_TOKEN: "{{ auth_token_src.auth_token }}"
OS_PROJECT_ID: "{{ os_migrate_src_auth.project_id|default('') }}"
OS_PROJECT_NAME: "{{ os_migrate_src_auth.project_name|default('') }}"
OS_PROJECT_DOMAIN_ID: "{{ os_migrate_src_auth.project_domain_id|default('') }}"
OS_PROJECT_DOMAIN_NAME: "{{ os_migrate_src_auth.project_domain_name|default('') }}"
register: _result_osm_server_add
changed_when: "_result_osm_server_add.rc == 0"

0 comments on commit b65a471

Please sign in to comment.