From bd82c6a3e5efeae69151040c751e483404877656 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 12 Dec 2018 12:51:45 +0000 Subject: [PATCH] MNAIO: Recovery the galera cluster with no gvwstate.dat file On occasion, a set of saved images may not have a gvwstate.dat file. Given that the MNAIO tooling is for test purposes only, we can take the risk of just making one up in order to ensure that the cluster starts on boot. DO NOT DO THIS IN PRODUCTION! Change-Id: I1b055ef0d02d77afe03d1a90baa2e6890e986c32 --- multi-node-aio/playbooks/deploy-vms.yml | 2 +- .../playbooks/kvm/prepare-image-galera.sh | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/multi-node-aio/playbooks/deploy-vms.yml b/multi-node-aio/playbooks/deploy-vms.yml index 7f7ad997..d8069be8 100644 --- a/multi-node-aio/playbooks/deploy-vms.yml +++ b/multi-node-aio/playbooks/deploy-vms.yml @@ -131,7 +131,7 @@ command: /opt/prepare-image-galera.sh register: _galera_prepare - # guestfissh does not always give a return code which indicates + # guestfish does not always give a return code which indicates # failure, so we look for our final stdout output as an indicator - name: Fail if the preparation script did not complete fail: diff --git a/multi-node-aio/playbooks/kvm/prepare-image-galera.sh b/multi-node-aio/playbooks/kvm/prepare-image-galera.sh index 87a43df2..f3eba058 100755 --- a/multi-node-aio/playbooks/kvm/prepare-image-galera.sh +++ b/multi-node-aio/playbooks/kvm/prepare-image-galera.sh @@ -54,6 +54,10 @@ for cnt in $(ls -1 /tmp | grep galera_container); do master_gvwstate_path=${gvwstate_path} master_cnt=${cnt} fi + else + # if there is no gvwstate.dat file, then we will + # need to use my_uuid later to generate one + my_uuid=${uuid_map[$cnt]} fi # if a master container was found, overwrite the uuid @@ -70,8 +74,15 @@ if [[ "${master_gvwstate_path:-none}" != "none" ]]; then elif [[ "${last_gvwstate_path:-none}" != "none" ]]; then cp ${last_gvwstate_path} ${tmp_gvwstate} else - echo "ERROR: No gvwstate.dat file was found. Cannot prepare galera cluster for cluster initialization." - exit 1 + echo "No gvwstate.dat file was found. Attempting to put one together." +cat > ${tmp_gvwstate}<< EOF +my_uuid: ${my_uuid} +#vwbeg +view_id: 3 ${my_uuid} 3 +bootstrap: 0 +member: ${my_uuid} 0 +#vwend +EOF fi member_num=$(awk '/^member: '${my_uuid}'/ {print $3}' ${tmp_gvwstate})