test: ensure testing uses correct mdmon
When testing we want to run mdmon directly, not use systemctl to get systemd to run it. So allow an environment variable to make that choice. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
4389b648bb
commit
9540cc244d
3
test
3
test
|
@ -30,6 +30,9 @@ if grep -s 'Personalities : .*multipath' > /dev/null /proc/mdstat ; then
|
|||
fi
|
||||
INTEGRITY=yes
|
||||
|
||||
# make sure to test local mdmon, not system one
|
||||
export MDADM_NO_SYSTEMCTL=1
|
||||
|
||||
# assume md0, md1, md2 exist in /dev
|
||||
md0=/dev/md0 md1=/dev/md1 md2=/dev/md2
|
||||
mdp0=/dev/md_d0
|
||||
|
|
9
util.c
9
util.c
|
@ -1711,6 +1711,7 @@ int start_mdmon(char *devnm)
|
|||
pathbuf[0] = '\0';
|
||||
|
||||
/* First try to run systemctl */
|
||||
if (!check_env("MDADM_NO_SYSTEMCTL"))
|
||||
switch(fork()) {
|
||||
case 0:
|
||||
/* FIXME yuk. CLOSE_EXEC?? */
|
||||
|
@ -1721,14 +1722,16 @@ int start_mdmon(char *devnm)
|
|||
else
|
||||
skipped = 0;
|
||||
|
||||
/* Don't want to see error messages from systemctl.
|
||||
* If the service doesn't exist, we start mdmon ourselves.
|
||||
/* Don't want to see error messages from
|
||||
* systemctl. If the service doesn't exist,
|
||||
* we start mdmon ourselves.
|
||||
*/
|
||||
close(2);
|
||||
open("/dev/null", O_WRONLY);
|
||||
snprintf(pathbuf, sizeof(pathbuf), "mdmon@%s.service",
|
||||
devnm);
|
||||
status = execl("/usr/bin/systemctl", "systemctl", "start",
|
||||
status = execl("/usr/bin/systemctl", "systemctl",
|
||||
"start",
|
||||
pathbuf, NULL);
|
||||
status = execl("/bin/systemctl", "systemctl", "start",
|
||||
pathbuf, NULL);
|
||||
|
|
Loading…
Reference in New Issue