Skip to content

Commit

Permalink
Add VM to messages for easier to identify PVRDMA server or client VM
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <[email protected]>
  • Loading branch information
keirazhang committed Mar 2, 2023
1 parent 9a3bbc2 commit 369c0ad
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
8 changes: 5 additions & 3 deletions linux/network_device_ops/apply_new_network_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
- nm_add_connection is defined
- nm_add_connection.rc is defined
- nm_add_connection.rc == 0
fail_msg: "Failed to add network connection"
success_msg: "{{ nm_add_connection.stdout | default('Successfully added network connection') }}"
fail_msg: "Failed to add network connection on VM {{ vm_name }}"
success_msg: "{{ nm_add_connection.stdout |
default('Successfully added network connection on VM ' ~ vm_name) }}"
when: guest_os_network_manager == "NetworkManager"

# Set network config file in guest OS except VMware Photon OS
Expand Down Expand Up @@ -175,7 +176,8 @@
- link_status.stdout is defined
- search_ip in link_status.stdout
fail_msg: >-
Network adapter '{{ new_network_adapter }}' failed to obtain IPv4 address after 100 seconds.
Network adapter '{{ new_network_adapter }}' on VM {{ vm_name }}
failed to obtain IPv4 address after 100 seconds.
Its current IPv4 address is '{{ link_status.stdout | default("") }}'.
- name: "Print the new networ adapter IP address"
Expand Down
2 changes: 1 addition & 1 deletion linux/network_device_ops/check_and_reload_pvrdma.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
that:
- rdma_devices_after_hotadd | length > 0
- rdma_devices_after_hotadd | difference(rdma_devices_before_hotadd) | length == 1
fail_msg: "No new RDMA device is detected"
fail_msg: "No new RDMA device is detected on VM {{ vm_name }}"

- name: "Set fact of new RDMA device"
ansible.builtin.set_fact:
Expand Down
4 changes: 2 additions & 2 deletions linux/network_device_ops/hot_add_network_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ansible.builtin.assert:
that:
- new_network_adapter_dmesg | length > 0
fail_msg: "There is no message about new {{ adapter_type }} network adapter in dmesg"
fail_msg: "There is no message about new {{ adapter_type }} network adapter in dmesg on VM {{ vm_name }}"

- name: "Get network adapters status after hot-add"
include_tasks: ../utils/get_network_adapters_status.yml
Expand All @@ -47,7 +47,7 @@
ansible.builtin.assert:
that:
- network_adapters_after_hotadd | difference(network_adapters_before_hotadd) | length > 0
fail_msg: "Fail to detect new added {{ adapter_type }} network adapter in guest OS"
fail_msg: "Guest OS failed to detect new added {{ adapter_type }} network adapter on VM {{ vm_name }}"

# Get new added network interface
- name: "Set fact of new added network adapter"
Expand Down
4 changes: 2 additions & 2 deletions linux/network_device_ops/hot_remove_network_adapter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
ansible.builtin.assert:
that:
- network_adapters_after_hotremove | difference(network_adapters_before_hotadd) | length == 0
fail_msg: "After hot removing the new network adapter, guest OS still can detect it"
success_msg: "The new {{ adapter_type }} adapter interface is removed from guest OS"
fail_msg: "After hot removing the new network adapter from VM {{ vm_name }}, guest OS still can detect it"
success_msg: "The new {{ adapter_type }} adapter interface is removed in guest OS on VM {{ vm_name }}"
2 changes: 1 addition & 1 deletion linux/network_device_ops/network_status_validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@
- ping_success_after_ifup
- not ping_success_after_disconnect
- ping_success_after_reconnect
fail_msg: "At least one result of ping VLAN gateway is not correct"
fail_msg: "At least one result of ping VLAN gateway is not correct on VM {{ vm_name }}"
17 changes: 9 additions & 8 deletions linux/network_device_ops/pvrdma_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
pvrdma_server_vm_ipv4: "{{ vds_vmk_ip_addr | ansible.utils.ipmath(1) }}"
pvrdma_server_vm_net_prefix: "{{ vds_vmk_net_prefix }}"
pvrdma_server_vm_gateway: "{{ vds_vmk_ip_addr }}"
pvrdma_client_vm_name: "{{ vm_name }}_{{ timestamp }}"
pvrdma_client_vm_name: "{{ vm_name }}_client_{{ timestamp }}"
pvrdma_client_vm_ipv4: "{{ vds_vmk_ip_addr | ansible.utils.ipmath(2) }}"
pvrdma_client_vm_guest_ip: ""

Expand Down Expand Up @@ -125,16 +125,11 @@
ansible.builtin.assert:
that:
- ping_success_after_hotadd | bool
fail_msg: "Failed to ping gateway from client VM PVRDMA device"
fail_msg: "Failed to ping gateway from PVRDMA device on client VM {{ vm_name }}"

- name: "Check PVRDMA device status and reload it if necessary on client VM"
include_tasks: check_and_reload_pvrdma.yml

# Switch to server VM
- name: "Switch to server VM"
ansible.builtin.set_fact:
vm_name: "{{ pvrdma_server_vm_name }}"

# rping server VM from client VM
- name: "RDMA ping server VM '{{ pvrdma_server_vm_name }}' from client VM '{{ pvrdma_client_vm_name }}'"
ansible.builtin.shell: "rping -c -I {{ pvrdma_client_vm_ipv4 }} -a {{ pvrdma_server_vm_ipv4 }} -C 5 -vV"
Expand All @@ -152,9 +147,15 @@
- rping_server_result.rc is defined
- rping_server_result.rc == 0
fail_msg: >-
RDMA pinging server VM from client VM failed.
Failed to run RDMA ping from client VM '{{ pvrdma_client_vm_name }}'
to server VM '{{ pvrdma_server_vm_name }}' failed.
Hit error '{{ rping_server_result.stderr | default() }}'
# Switch to server VM
- name: "Switch to server VM"
ansible.builtin.set_fact:
vm_name: "{{ pvrdma_server_vm_name }}"

- name: "Power off the client VM"
include_tasks: ../../common/vm_set_power_state.yml
vars:
Expand Down

0 comments on commit 369c0ad

Please sign in to comment.