Change startup procedure
Current startup procedure works on an assumption that we will deal with asynchronously appearing devices in asynchronous way (udev rules) and synchronous events in the system (systemd units) won't interfere. If we would break anything (mounts) we would just take those units and restart them. This tactic was working as long as resetting systemd units took reasonable time. As hackish as it sounds it worked in all systems that the software has been validated on. Unfortunately it stopped working because of *.mount units taking MUCH longer time to restart even on mainstream OSes, so it's time to change. This change implements open-cas systemd service which will wait synchronously with systemd bootup process for all required Open CAS devices to start. If they don't we fail the boot process just as failing mounts would. We also make sure that this process takes place before any mounts (aside from root FS and other critical FS's) are even attempted. Now opencas-mount-utility can be discarded. To override this behaviour on per-core basis you can specify lazy_startup=true option in opencas.conf. Signed-off-by: Jan Musial <jan.musial@intel.com>
This commit is contained in:
@@ -9,25 +9,11 @@ UDEV:=$(shell which udevadm)
|
||||
SYSTEMCTL := $(shell which systemctl)
|
||||
PYTHON3 := $(shell which python3)
|
||||
|
||||
ifeq (, $(shell which systemctl))
|
||||
define cas_install
|
||||
install -m 755 open-cas-shutdown /etc/init.d/open-cas-shutdown
|
||||
/sbin/chkconfig open-cas-shutdown on; service open-cas-shutdown start
|
||||
endef
|
||||
else
|
||||
ifneq "$(wildcard /usr/lib/systemd/system)" ""
|
||||
SYSTEMD_DIR=/usr/lib/systemd/system
|
||||
else
|
||||
SYSTEMD_DIR=/lib/systemd/system
|
||||
endif
|
||||
define cas_install
|
||||
install -m 644 open-cas-shutdown.service $(SYSTEMD_DIR)/open-cas-shutdown.service
|
||||
install -m 755 -d $(SYSTEMD_DIR)/../system-shutdown
|
||||
install -m 755 open-cas.shutdown $(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown
|
||||
$(SYSTEMCTL) daemon-reload
|
||||
$(SYSTEMCTL) -q enable open-cas-shutdown
|
||||
endef
|
||||
endif
|
||||
|
||||
# Just a placeholder when running make from parent dir without install/uninstall arg
|
||||
all: ;
|
||||
@@ -42,7 +28,6 @@ else
|
||||
@install -m 644 opencas.py $(CASCTL_DIR)/opencas.py
|
||||
@install -m 755 casctl $(CASCTL_DIR)/casctl
|
||||
@install -m 755 open-cas-loader $(CASCTL_DIR)/open-cas-loader
|
||||
@install -m 755 open-cas-mount-utility $(CASCTL_DIR)/open-cas-mount-utility
|
||||
|
||||
@ln -fs $(CASCTL_DIR)/casctl /sbin/casctl
|
||||
|
||||
@@ -55,14 +40,19 @@ else
|
||||
|
||||
@install -m 644 casctl.8 /usr/share/man/man8/casctl.8
|
||||
|
||||
$(cas_install)
|
||||
@install -m 644 open-cas-shutdown.service $(SYSTEMD_DIR)/open-cas-shutdown.service
|
||||
@install -m 644 open-cas.service $(SYSTEMD_DIR)/open-cas.service
|
||||
@install -m 755 -d $(SYSTEMD_DIR)/../system-shutdown
|
||||
@install -m 755 open-cas.shutdown $(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown
|
||||
@$(SYSTEMCTL) daemon-reload
|
||||
@$(SYSTEMCTL) -q enable open-cas-shutdown
|
||||
@$(SYSTEMCTL) -q enable open-cas
|
||||
endif
|
||||
|
||||
uninstall:
|
||||
@rm $(CASCTL_DIR)/opencas.py
|
||||
@rm $(CASCTL_DIR)/casctl
|
||||
@rm $(CASCTL_DIR)/open-cas-loader
|
||||
@rm $(CASCTL_DIR)/open-cas-mount-utility
|
||||
@rm -rf $(CASCTL_DIR)
|
||||
|
||||
@rm /sbin/casctl
|
||||
@@ -71,6 +61,15 @@ uninstall:
|
||||
|
||||
@rm /lib/udev/rules.d/60-persistent-storage-cas-load.rules
|
||||
@rm /lib/udev/rules.d/60-persistent-storage-cas.rules
|
||||
@$(UDEV) control --reload-rules
|
||||
|
||||
@$(SYSTEMCTL) -q disable open-cas-shutdown
|
||||
@$(SYSTEMCTL) -q disable open-cas
|
||||
@$(SYSTEMCTL) daemon-reload
|
||||
|
||||
@rm $(SYSTEMD_DIR)/open-cas-shutdown.service
|
||||
@rm $(SYSTEMD_DIR)/open-cas.service
|
||||
@rm $(SYSTEMD_DIR)/../system-shutdown/open-cas.shutdown
|
||||
|
||||
|
||||
.PHONY: install uninstall clean distclean
|
||||
|
Reference in New Issue
Block a user