From 9a3bbc2508364513317b5087238d27a99d10e3a2 Mon Sep 17 00:00:00 2001 From: Qi Zhang Date: Wed, 1 Mar 2023 21:34:16 +0800 Subject: [PATCH] Pause 30s for refreshing client VM's IP Signed-off-by: Qi Zhang --- .../pvrdma_network_device_ops.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/linux/network_device_ops/pvrdma_network_device_ops.yml b/linux/network_device_ops/pvrdma_network_device_ops.yml index 6c5eeab68..af8a3ffc7 100644 --- a/linux/network_device_ops/pvrdma_network_device_ops.yml +++ b/linux/network_device_ops/pvrdma_network_device_ops.yml @@ -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" @@ -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: