kvm-host: migrate-vm exits if DRBD is not up-to-date
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2623|2|2621|2|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/343//ansiblelint">Evolix » ansible-roles » unstable #343</a>
gitea/ansible-roles/pipeline/head This commit looks good
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2623|2|2621|2|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/343//ansiblelint">Evolix » ansible-roles » unstable #343</a>
gitea/ansible-roles/pipeline/head This commit looks good
This commit is contained in:
parent
2af2e5ee78
commit
41004e20b4
|
@ -32,7 +32,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
|||
* fail2ban: add default variable fail2ban_dbpurgeage_default
|
||||
* fail2ban: add default variable fail2ban_dbpurgeage_default
|
||||
* fail2ban: add variable fail2ban_sshd_port to configure sshd port
|
||||
* kvm-host: release 23.08 for migrate-vm.sh
|
||||
* kvm-host: release 23.09 for migrate-vm.sh
|
||||
* nagios-nrpe: add a NRPE check-local command with completion.
|
||||
* nagios-nrpe: add a proper monitoring plugin for glusterfs (on servers, not for clients)
|
||||
* php: add new variable to disable oveeriding settings of php-fpm default pool (www)
|
||||
|
|
|
@ -11,13 +11,13 @@
|
|||
# * migrate "from"
|
||||
# * switch to Bash to use local and readonly variables
|
||||
|
||||
VERSION="23.08"
|
||||
VERSION="23.09"
|
||||
|
||||
show_version() {
|
||||
cat <<END
|
||||
migrate-vm version ${VERSION}
|
||||
|
||||
Copyright 2018-2021 Evolix <info@evolix.fr>,
|
||||
Copyright 2018-2023 Evolix <info@evolix.fr>,
|
||||
Jérémy Lecour <jlecour@evolix.fr>,
|
||||
Victor Laborie <vlaborie@evolix.fr>
|
||||
and others.
|
||||
|
@ -70,6 +70,20 @@ is_drbd_resource() {
|
|||
test -f "$(drbd_config_file "${resource}")" && drbdadm role "${resource}" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
check_drbd_sync() {
|
||||
resource=${1:-}
|
||||
|
||||
set +e
|
||||
dstate=$(drbdadm dstate "${resource}" | grep -vF 'UpToDate/UpToDate')
|
||||
cstate=$(drbdadm cstate "${resource}" | grep -vF 'Connected')
|
||||
set -e
|
||||
|
||||
if [ -n "${dstate}" ] || [ -n "${cstate}" ]; then
|
||||
echo "DRBD resource ${resource} is not up-to-date" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
drbd_peers() {
|
||||
drbd_config_file=$(drbd_config_file "${1:-}")
|
||||
|
||||
|
@ -227,6 +241,8 @@ migrate_to() {
|
|||
|
||||
echo "Start migration of ${vm} to ${remote_ip} (${remote_host})"
|
||||
|
||||
check_drbd_sync "${resource}"
|
||||
|
||||
set_drbd_role primary "${resource}" "${remote_ip}"
|
||||
migrate_vm_to "${vm}" "${remote_ip}"
|
||||
set_drbd_role secondary "${resource}"
|
||||
|
|
Loading…
Reference in a new issue