Skip to contentSkip to conversation

init/FreeBSD: Minor fixes for FreeBSD init scripts

PATCH In review Roger Pau Monne 2 participants 12 messages Dec 19, 2016 – Dec 21, 2016

lore
Share & tools
lore
#1 lore raw

PATCH 1/4 init/FreeBSD: set correct PATH for xl devd

FreeBSD init scripts don't have /usr/local/{bin/sbin} in it's PATH, which prevents xl devd from working properly since hotplug scripts require the set of xenstore cli tools to be in PATH.

While there also fix the usage of --pidfile, which according to the xl help doesn't use "=", and add braces around XLDEVD_PIDFILE.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1 -1
index 8ece7c3..3917de2 100644
@@ -29,7 +29,7 @@ xendriverdomain_startcmd()
 {
 	printf "Starting xenservices: xl devd."
 
-	${sbindir}/xl devd --pidfile=$XLDEVD_PIDFILE ${XLDEVD_ARGS}
+	PATH="${bindir}:${sbindir}:$PATH" ${sbindir}/xl devd --pidfile ${XLDEVD_PIDFILE} ${XLDEVD_ARGS}
 
 	printf "\n"
 }
Signature · 7 lines
2.10.1 (Apple Git-78)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] init/FreeBSD: set correct PATH for xl devd

Quoted 8 lines · Roger Pau Monne

FreeBSD init scripts don't have /usr/local/{bin/sbin} in it's PATH, which prevents xl devd from working properly since hotplug scripts require the set of xenstore cli tools to be in PATH.

While there also fix the usage of --pidfile, which according to the xl help doesn't use "=", and add braces around XLDEVD_PIDFILE.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw

PATCH 2/4 init/FreeBSD: remove xendriverdomain_precmd

In reply to Roger Pau Monne

...because it's empty. While there also rename xendriverdomain_startcmd to xendriverdomain_start in order to match the nomenclature of the file.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1 -7
index 3917de2..c71871c 100644
@@ -13,19 +13,13 @@ LD_LIBRARY_PATH="${libdir}"
 export LD_LIBRARY_PATH
 
 name="xendriverdomain"
-start_precmd="xendriverdomain_precmd"
 start_cmd="xendriverdomain_startcmd"
 stop_cmd="xendriverdomain_stop"
 extra_commands=""
 
 XLDEVD_PIDFILE="@XEN_RUN_DIR@/xldevd.pid"
 
-xendriverdomain_precmd()
-{
-	:
-}
-
-xendriverdomain_startcmd()
+xendriverdomain_start()
 {
 	printf "Starting xenservices: xl devd."
 
Signature · 7 lines
2.10.1 (Apple Git-78)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] init/FreeBSD: remove xendriverdomain_precmd

Quoted 16 lines · Roger Pau Monne

...because it's empty. While there also rename xendriverdomain_startcmd to xendriverdomain_start in order to match the nomenclature of the file.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +0 -0
index 3917de2..c71871c 100644

tools/hotplug/FreeBSD/rc.d/xendriverdomain.in LD_LIBRARY_PATH="${libdir}" · line 16

Quoted 5 lines
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +0 -1
@@ -13,19 +13,13 @@ LD_LIBRARY_PATH="${libdir}"
 export LD_LIBRARY_PATH
 
 name="xendriverdomain"
-start_precmd="xendriverdomain_precmd"
 start_cmd="xendriverdomain_startcmd"

^^^^^^^^
You missed this.

otherwise:

Quoted 18 lines
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +1 -6
 stop_cmd="xendriverdomain_stop"
 extra_commands=""
 
 XLDEVD_PIDFILE="@XEN_RUN_DIR@/xldevd.pid"
 
-xendriverdomain_precmd()
-{
-	:
-}
-
-xendriverdomain_startcmd()
+xendriverdomain_start()
 {
 	printf "Starting xenservices: xl devd."
 
Signature · 1 line
2.10.1 (Apple Git-78)

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH 2/4] init/FreeBSD: remove xendriverdomain_precmd

Quoted 25 lines · Wei Liu
Quoted 16 lines · Roger Pau Monne

...because it's empty. While there also rename xendriverdomain_startcmd to xendriverdomain_start in order to match the nomenclature of the file.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +0 -0
index 3917de2..c71871c 100644

tools/hotplug/FreeBSD/rc.d/xendriverdomain.in LD_LIBRARY_PATH="${libdir}" · line 16

Quoted 5 lines
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +0 -1
@@ -13,19 +13,13 @@ LD_LIBRARY_PATH="${libdir}"
 export LD_LIBRARY_PATH
 
 name="xendriverdomain"
-start_precmd="xendriverdomain_precmd"
 start_cmd="xendriverdomain_startcmd"

^^^^^^^^
You missed this.

Quoted 3 lines

otherwise:

Would you like to fix this while committing, or should I push the updated series to a git branch?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw

PATCH 3/4 init/FreeBSD: fix xencommons so it can only be launched by Dom0

In reply to Roger Pau Monne

At the moment the execution of xencommons is gated on the presence of the privcmd device, but that's not correct, since privcmd is available to all Xen domains (privileged or unprivileged). Instead of using privcmd use the xenstored device, which will only be available to the domain that's in charge of running xenstored, and thus xencommons.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xencommons.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/hotplug/FreeBSD/rc.d/xencommons.in +1 -1
index efa8801..81f69f3 100644
@@ -16,7 +16,7 @@ start_cmd="xen_startcmd"
 stop_cmd="xen_stop"
 status_cmd="xen_status"
 extra_commands="status"
-required_files="/dev/xen/privcmd"
+required_files="/dev/xen/xenstored"
 
 XENSTORED_PIDFILE="@XEN_RUN_DIR@/xenstored.pid"
 XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
Signature · 7 lines
2.10.1 (Apple Git-78)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 3/4
#7 lore raw

Re: [PATCH 3/4] init/FreeBSD: fix xencommons so it can only be launched by Dom0

Quoted 7 lines · Roger Pau Monne

At the moment the execution of xencommons is gated on the presence of the privcmd device, but that's not correct, since privcmd is available to all Xen domains (privileged or unprivileged). Instead of using privcmd use the xenstored device, which will only be available to the domain that's in charge of running xenstored, and thus xencommons.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#8 lore raw

PATCH 4/4 init/FreeBSD: add rc control variables

In reply to Roger Pau Monne

Those are used in order to decide which scripts are executed at init.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/hotplug/FreeBSD/rc.d/xencommons.in      | 5 ++++-
 tools/hotplug/FreeBSD/rc.d/xendriverdomain.in | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
tools/hotplug/FreeBSD/rc.d/xencommons.in +4 -1
index 81f69f3..2fcd84a 100644
@@ -11,6 +11,7 @@ LD_LIBRARY_PATH="${libdir}"
 export LD_LIBRARY_PATH
 
 name="xencommons"
+rcvar="xencommons_enable"
 start_precmd="xen_precmd"
 start_cmd="xen_startcmd"
 stop_cmd="xen_stop"
@@ -23,6 +24,9 @@ XENCONSOLED_PIDFILE="@XEN_RUN_DIR@/xenconsoled.pid"
 #XENCONSOLED_TRACE="@XEN_LOG_DIR@/xenconsole-trace.log"
 #XENSTORED_TRACE="@XEN_LOG_DIR@/xen/xenstore-trace.log"
 
+load_rc_config $name
+: ${xencommons_enable:=no}
+
 xen_precmd()
 {
 	mkdir -p @XEN_LIB_STORED@ || exit 1
@@ -116,5 +120,4 @@ xen_status()
 	fi
 }
 
-load_rc_config $name
 run_rc_command "$1"
tools/hotplug/FreeBSD/rc.d/xendriverdomain.in +4 -1
index c71871c..1384fdd 100644
@@ -13,12 +13,16 @@ LD_LIBRARY_PATH="${libdir}"
 export LD_LIBRARY_PATH
 
 name="xendriverdomain"
+rcvar="xendriverdomain_enable"
 start_cmd="xendriverdomain_startcmd"
 stop_cmd="xendriverdomain_stop"
 extra_commands=""
 
 XLDEVD_PIDFILE="@XEN_RUN_DIR@/xldevd.pid"
 
+load_rc_config $name
+: ${xendriverdomain_enable:=no}
+
 xendriverdomain_start()
 {
 	printf "Starting xenservices: xl devd."
@@ -38,5 +42,4 @@ xendriverdomain_stop()
 	wait_for_pids $rc_pids
 }
 
-load_rc_config $name
 run_rc_command "$1"
Signature · 7 lines
2.10.1 (Apple Git-78)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 4/4
#9 lore raw

Re: [PATCH 4/4] init/FreeBSD: add rc control variables

Quoted 3 lines · Roger Pau Monne

Those are used in order to decide which scripts are executed at init.

Can't say I know much about FreeBSD init mechanism, but I trust your judgement:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH 4/4] init/FreeBSD: add rc control variables

Quoted 10 lines · Wei Liu
Quoted 3 lines · Roger Pau Monne

Those are used in order to decide which scripts are executed at init.

Can't say I know much about FreeBSD init mechanism, but I trust your judgement:

Not that I know a lot myself, I just followed the advice at

https://www.freebsd.org/doc/en/articles/rc-scripting/article.html#rcng-confdummy

Maybe we should add this url ref to the commit itself?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#11 lore raw

Re: [PATCH 4/4] init/FreeBSD: add rc control variables

Quoted 10 lines · Roger Pau Monne
Quoted 9 lines · Wei Liu
Quoted 3 lines · Roger Pau Monne

Those are used in order to decide which scripts are executed at init.

Can't say I know much about FreeBSD init mechanism, but I trust your judgement:

Quoted 7 lines
Quoted 1 line

Not that I know a lot myself, I just followed the advice at

https://www.freebsd.org/doc/en/articles/rc-scripting/article.html#rcng-confdummy

Maybe we should add this url ref to the commit itself?

I've edited the commit message here and fixed the error in the other commit and pushed this series to staging.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel