Forward Pacemaker notifications to daemon shadow
This commit is contained in:
@@ -59,6 +59,61 @@ mc_pg_native_demote_target()
|
||||
mc_pg_demote_notification_target true
|
||||
}
|
||||
|
||||
mc_pg_notify_daemon_shadow()
|
||||
{
|
||||
local socket_path resource parameters response rc
|
||||
|
||||
socket_path="${MC_PROXY_SOCKET:-/run/user/1000/managed-containerd/managed-containerd.sock}"
|
||||
resource="${OCF_RESOURCE_INSTANCE:-}"
|
||||
resource="${resource%%:*}"
|
||||
|
||||
[ -n "${resource}" ] || return 0
|
||||
|
||||
parameters="$(
|
||||
python3 -c '
|
||||
import json
|
||||
import os
|
||||
|
||||
print(json.dumps({
|
||||
"type": os.environ.get("OCF_RESKEY_CRM_meta_notify_type", ""),
|
||||
"operation": os.environ.get("OCF_RESKEY_CRM_meta_notify_operation", ""),
|
||||
"promote_uname": os.environ.get("OCF_RESKEY_CRM_meta_notify_promote_uname", ""),
|
||||
"demote_uname": os.environ.get("OCF_RESKEY_CRM_meta_notify_demote_uname", ""),
|
||||
"promoted_uname": os.environ.get("OCF_RESKEY_CRM_meta_notify_promoted_uname", ""),
|
||||
"unpromoted_uname": os.environ.get("OCF_RESKEY_CRM_meta_notify_unpromoted_uname", ""),
|
||||
}, separators=(",", ":")))
|
||||
'
|
||||
)" || {
|
||||
ocf_log warn "unable to encode daemon notification parameters"
|
||||
return 0
|
||||
}
|
||||
|
||||
response="$(
|
||||
timeout --kill-after=1s 3s \
|
||||
python3 \
|
||||
"${MC_PROXY_CLIENT:-/usr/lib/ocf/resource.d/loxthelion/managed-container.d/proxy_client.py}" \
|
||||
"${socket_path}" \
|
||||
"${resource}" \
|
||||
"notify" \
|
||||
10 \
|
||||
11 \
|
||||
"${parameters}"
|
||||
)"
|
||||
rc=$?
|
||||
|
||||
if [ "${rc}" -ne 0 ]; then
|
||||
ocf_log warn \
|
||||
"managed-containerd notify shadow unavailable rc=${rc}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ocf_log info \
|
||||
"managed-containerd notify shadow accepted: ${response}"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
managed_notify()
|
||||
{
|
||||
local state_dir state_file
|
||||
@@ -116,5 +171,7 @@ managed_notify()
|
||||
>> "${state_dir}/${OCF_RESOURCE_INSTANCE:-managed-container}.notify.log"
|
||||
} || true
|
||||
|
||||
mc_pg_notify_daemon_shadow
|
||||
|
||||
return "${OCF_SUCCESS}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user