From 633361419a6c0a747210e3576a7a3c8b5c241989 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathieu=20Dupr=C3=A9?= Date: Tue, 17 Sep 2024 14:27:24 +0200 Subject: [PATCH] pacemaker_ra/VirtualDomain: add support of sync_config_on_stop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the support of the "sync_config_on_stop parameter" when "seapath" parameter is set to "true". When the "sync_config_on_stop" parameter is set to "true", the domain configuration is saved to the rbd image metadata when the resource is stopped. Signed-off-by: Mathieu Dupré --- .../files/pacemaker_ra/VirtualDomain | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/debian_physical_machine/files/pacemaker_ra/VirtualDomain b/roles/debian_physical_machine/files/pacemaker_ra/VirtualDomain index 3bbdc56f5..09a4c9834 100755 --- a/roles/debian_physical_machine/files/pacemaker_ra/VirtualDomain +++ b/roles/debian_physical_machine/files/pacemaker_ra/VirtualDomain @@ -819,7 +819,15 @@ save_config(){ if virt-xml-validate ${CFGTMP} domain 2>/dev/null ; then ocf_log info "Saving domain $DOMAIN_NAME to ${OCF_RESKEY_config}. Please make sure it's present on all nodes or sync_config_on_stop is on." if cat ${CFGTMP} > ${OCF_RESKEY_config} ; then - ocf_log info "Saved $DOMAIN_NAME domain's configuration to ${OCF_RESKEY_config}." + if ocf_is_true "$OCF_RESKEY_seapath" ; then + if rbd image-meta set system_${DOMAIN_NAME} xml "$(cat ${CFGTMP})" ; then + ocf_log info "Saved $DOMAIN_NAME domain's configuration to ${OCF_RESKEY_config} and rbd system_${DOMAIN_NAME} metadata" + else + ocf_log warn "Saving $DOMAIN_NAME domain's configuration to rbd system_${DOMAIN_NAME} metadata failed." + fi + else + ocf_log info "Saved $DOMAIN_NAME domain's configuration to ${OCF_RESKEY_config}." + fi if ocf_is_true "$OCF_RESKEY_sync_config_on_stop"; then sync_config fi