diff --git a/mtce-common/src/common/nodeBase.h b/mtce-common/src/common/nodeBase.h index 3fc4e867..77af3c84 100755 --- a/mtce-common/src/common/nodeBase.h +++ b/mtce-common/src/common/nodeBase.h @@ -106,7 +106,7 @@ void daemon_exit ( void ); #define CONFIG_PASS_FILE ((const char *)"/var/run/.config_pass") #define CONFIG_FAIL_FILE ((const char *)"/var/run/.config_fail") #define NODE_LOCKED_FILE ((const char *)"/var/run/.node_locked") -#define NODE_LOCKED_FILE_BACKUP ((const char *)"/etc/mtc/tmp/.node_locked") +#define NODE_LOCKED_FILE_BACKUP ((const char *)"/var/persist/mtc/.node_locked") #define NODE_RESET_FILE ((const char *)"/var/run/.node_reset") #define SMGMT_DEGRADED_FILE ((const char *)"/var/run/.sm_degraded") #define SMGMT_UNHEALTHY_FILE ((const char *)"/var/run/.sm_node_unhealthy") diff --git a/mtce/debian/deb_folder/mtce.install b/mtce/debian/deb_folder/mtce.install index b30cf33e..75773d98 100644 --- a/mtce/debian/deb_folder/mtce.install +++ b/mtce/debian/deb_folder/mtce.install @@ -23,6 +23,7 @@ etc/services.d/storage/mtcTest etc/services.d/worker/mtcTest etc/syslog-ng/conf.d/mtce.conf etc/systemd/system-preset/ +usr/lib/tmpfiles.d/mtc.conf usr/lib/ocf/resource.d/platform/mtcAgent usr/local/bin/fsmond usr/local/bin/hbsAgent diff --git a/mtce/debian/deb_folder/mtce.postinst b/mtce/debian/deb_folder/mtce.postinst index 48e4e318..985fa253 100644 --- a/mtce/debian/deb_folder/mtce.postinst +++ b/mtce/debian/deb_folder/mtce.postinst @@ -7,17 +7,24 @@ case "$1" in configure) # Replace the default hwclock.sh with our copy if [ -e /etc/init.d/hwclock.sh ]; then + if [ -e /etc/init.d/hwclock.sh.dpkg-bak ]; then + rm -f /etc/init.d/hwclock.sh.dpkg-bak + fi mv -f /etc/init.d/hwclock.sh /etc/init.d/hwclock.sh.dpkg-bak fi cp -a /usr/share/mtce/hwclock.sh /etc/init.d/hwclock.sh + # Replace the default hwclock.service with our copy if [ -e /lib/systemd/system/hwclock.service ]; then + if [ -e /lib/systemd/system/hwclock.service.bak ]; then + rm -f /lib/systemd/system/hwclock.service.bak + fi mv -f /lib/systemd/system/hwclock.service /lib/systemd/system/hwclock.service.bak fi cp -a /usr/share/mtce/hwclock.service /lib/systemd/system/hwclock.service ;; *) - echo "mtce postinst called with an unknown argument \`$1'" >&2 + echo "mtce postinst called with an unsupported argument \`$1'" >&2 exit 1 ;; esac diff --git a/mtce/debian/deb_folder/rules b/mtce/debian/deb_folder/rules index 3929f924..5a7a60d8 100644 --- a/mtce/debian/deb_folder/rules +++ b/mtce/debian/deb_folder/rules @@ -17,7 +17,8 @@ export COLLECTDIR = $(SYSCONFDIR)/collect.d export INITDIR =$(SYSCONFDIR)/init.d export LOGDIR = $(SYSCONFDIR)/logrotate.d export SERVICESDIR = $(SYSCONFDIR)/services.d - +export TMPFILESDIR = $(ROOT)/usr/lib/tmpfiles.d +export PERSISTDIR = $(ROOT)/var/persist export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') export MAJOR = $(shell echo $(DEB_VERSION) | cut -d. -f1) export MINOR = $(shell echo $(shell echo $(DEB_VERSION) | cut -d. -f2) | cut -d- -f1) @@ -28,8 +29,8 @@ export MINOR = $(shell echo $(shell echo $(DEB_VERSION) | cut -d. -f2) | cut -d- override_dh_auto_install: # Resource agent files install -m 755 -d $(SYSCONFDIR) - install -m 755 -d $(SYSCONFDIR)/mtc install -m 755 -d $(SYSCONFDIR)/mtc/tmp + install -m 755 -d $(PERSISTDIR)/mtc install -m 755 -d $(OCFPLATFORMDIR) install -m 755 -p -D scripts/mtcAgent $(OCFPLATFORMDIR)/mtcAgent install -m 755 -p -D hwmon/scripts/ocf/hwmon $(OCFPLATFORMDIR)/hwmon @@ -43,7 +44,7 @@ override_dh_auto_install: install -m 600 -p -D pmon/scripts/pmond.conf $(SYSCONFDIR)/mtc/pmond.conf install -m 600 -p -D lmon/scripts/lmond.conf $(SYSCONFDIR)/mtc/lmond.conf install -m 600 -p -D hostw/scripts/hostwd.conf $(SYSCONFDIR)/mtc/hostwd.conf - + install -m 600 -p -D scripts/tmpfiles.conf $(TMPFILESDIR)/mtc.conf install -m 755 -d $(BMCCONFDIR) install -m 644 -p -D scripts/sensor_hp360_v1_ilo_v4.profile $(BMCCONFDIR)/sensor_hp360_v1_ilo_v4.profile install -m 644 -p -D scripts/sensor_hp380_v1_ilo_v4.profile $(BMCCONFDIR)/sensor_hp380_v1_ilo_v4.profile diff --git a/mtce/src/maintenance/mtcNodeComp.cpp b/mtce/src/maintenance/mtcNodeComp.cpp index da899d43..feba9341 100644 --- a/mtce/src/maintenance/mtcNodeComp.cpp +++ b/mtce/src/maintenance/mtcNodeComp.cpp @@ -1439,6 +1439,17 @@ void daemon_service_run ( void ) } } + /* Cleanup the old obsoleted persistent node locked file */ + #define OBSOLETED_NODE_LOCKED_FILE_BACKUP ((const char *)"/etc/mtc/tmp/.node_locked") + if ( strcmp (NODE_LOCKED_FILE_BACKUP, OBSOLETED_NODE_LOCKED_FILE_BACKUP ) ) + { + if ( daemon_is_file_present ( OBSOLETED_NODE_LOCKED_FILE_BACKUP ) ) + { + ilog ("removing obsoleted %s file", OBSOLETED_NODE_LOCKED_FILE_BACKUP ); + daemon_remove_file ( OBSOLETED_NODE_LOCKED_FILE_BACKUP ); + } + } + /* If the mtcClient starts up and finds that its persistent node * locked backup file is present then make sure the volatile one * is also present. */ diff --git a/mtce/src/scripts/tmpfiles.conf b/mtce/src/scripts/tmpfiles.conf new file mode 100644 index 00000000..a9a08a78 --- /dev/null +++ b/mtce/src/scripts/tmpfiles.conf @@ -0,0 +1,4 @@ +d /var/persist/mtc 755 root root + +# For stx.11 only: +r /etc/mtc/tmp/.node_locked