Skip to content

Commit

Permalink
Pause 30s for refreshing client VM's IP
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 c1a872e commit 9a3bbc2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions linux/network_device_ops/pvrdma_network_device_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@
- name: "Set facts for PVRDMA server VM and client VM"
ansible.builtin.set_fact:
pvrdma_server_vm_name: "{{ vm_name }}"
pvrdma_server_vm_guest_ip: "{{ vm_guest_ip }}"
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_ipv4: "{{ vds_vmk_ip_addr | ansible.utils.ipmath(2) }}"
pvrdma_client_vm_guest_ip: ""

# Clone a new VM as client VM from current VM, and current VM as server
- name: "Clone a new VM as PVRDMA client VM from current VM"
Expand Down Expand Up @@ -100,6 +102,20 @@
vars:
update_inventory_timeout: 300

- name: "Set fact of client VM guest IP"
ansible.builtin.set_fact:
pvrdma_client_vm_guest_ip: "{{ vm_guest_ip }}"

- name: "Wait client VM's guest IP to be refreshed if it is same with server VM's guest IP"
block:
- name: "Sleep 30s for client VM's guest IP refreshing"
ansible.builtin.pause:
seconds: 30

- name: "Update client VM's guest IP in inventory"
include_tasks: ../../common/update_inventory.yml
when: pvrdma_client_vm_guest_ip == pvrdma_server_vm_guest_ip

- name: "Hot add a new {{ adapter_type }} network adapter on client VM and apply network config"
include_tasks: hot_add_network_adapter.yml
vars:
Expand Down

0 comments on commit 9a3bbc2

Please sign in to comment.