
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>
76 lines
2.1 KiB
Makefile
76 lines
2.1 KiB
Makefile
#
|
|
# Copyright(c) 2012-2019 Intel Corporation
|
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
#
|
|
|
|
CASCTL_DIR = /lib/opencas
|
|
UDEVRULES_DIR = /lib/udev/rules.d
|
|
UDEV:=$(shell which udevadm)
|
|
SYSTEMCTL := $(shell which systemctl)
|
|
PYTHON3 := $(shell which python3)
|
|
|
|
ifneq "$(wildcard /usr/lib/systemd/system)" ""
|
|
SYSTEMD_DIR=/usr/lib/systemd/system
|
|
else
|
|
SYSTEMD_DIR=/lib/systemd/system
|
|
endif
|
|
|
|
# Just a placeholder when running make from parent dir without install/uninstall arg
|
|
all: ;
|
|
|
|
install:
|
|
ifeq (, $(PYTHON3))
|
|
$(error package 'python3' not found)
|
|
else
|
|
@echo "Installing Open-CAS utils"
|
|
|
|
@install -m 755 -d $(CASCTL_DIR)
|
|
@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
|
|
|
|
@ln -fs $(CASCTL_DIR)/casctl /sbin/casctl
|
|
|
|
@install -m 644 60-persistent-storage-cas-load.rules $(UDEVRULES_DIR)/60-persistent-storage-cas-load.rules
|
|
@install -m 644 60-persistent-storage-cas.rules $(UDEVRULES_DIR)/60-persistent-storage-cas.rules
|
|
|
|
@install -m 755 -d /usr/share/doc/opencas
|
|
|
|
@$(UDEV) control --reload-rules
|
|
|
|
@install -m 644 casctl.8 /usr/share/man/man8/casctl.8
|
|
|
|
@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 -rf $(CASCTL_DIR)
|
|
|
|
@rm /sbin/casctl
|
|
|
|
@rm /usr/share/man/man8/casctl.8
|
|
|
|
@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
|