summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lava-slave/Dockerfile5
-rw-r--r--lava-slave/lavapdu.conf19
-rwxr-xr-xlava-slave/scripts/start.sh11
3 files changed, 35 insertions, 0 deletions
diff --git a/lava-slave/Dockerfile b/lava-slave/Dockerfile
index e87ac63..5e0f3cb 100644
--- a/lava-slave/Dockerfile
+++ b/lava-slave/Dockerfile
@@ -55,6 +55,11 @@ COPY configs/tftpd-hpa /etc/default/tftpd-hpa
COPY scripts/cu-loop /usr/local/bin/
COPY conmux/* /etc/conmux/
+#install pdudaemon
+RUN DEBIAN_FRONTEND=noninteractive apt-get -y install postgresql
+RUN service postgresql start && DEBIAN_FRONTEND=noninteractive apt-get -y install lavapdu-daemon lavapdu-client && service postgresql stop
+COPY lavapdu.conf /etc/lavapdu/
+
#TODO made this customizable, 1000 ports by default is too much
RUN sed -i 's,XNBD_PORT_RANGE_MIN.*,XNBD_PORT_RANGE_MIN=55950,' /usr/lib/python2.7/dist-packages/lava_dispatcher/pipeline/utils/constants.py
diff --git a/lava-slave/lavapdu.conf b/lava-slave/lavapdu.conf
new file mode 100644
index 0000000..720c22b
--- /dev/null
+++ b/lava-slave/lavapdu.conf
@@ -0,0 +1,19 @@
+{
+ "daemon": {
+ "hostname": "0.0.0.0",
+ "port": 16421,
+ "dbhost": "127.0.0.1",
+ "dbuser": "pdudaemon",
+ "dbpass": "pdudaemon",
+ "dbname": "lavapdu",
+ "retries": 5,
+ "logging_level": "INFO"
+ },
+ "pdus": {
+ "acme-0": {
+ "driver": "localcmdline",
+ "cmd_on": "/usr/local/bin/acme-cli -s 192.168.66.2 switch_on %d",
+ "cmd_off": "/usr/local/bin/acme-cli -s 192.168.66.2 switch_off %d"
+ }
+ }
+}
diff --git a/lava-slave/scripts/start.sh b/lava-slave/scripts/start.sh
index dcbbcd7..c9645b3 100755
--- a/lava-slave/scripts/start.sh
+++ b/lava-slave/scripts/start.sh
@@ -10,6 +10,17 @@ service tftpd-hpa start || exit 4
rm -f /var/run/lava-slave.pid
service lava-slave start || exit 5
+if [ -e /etc/lavapdu ];then
+ /etc/init.d/postgresql start || exit 6
+
+ echo "== Start lavapdu listen =="
+ /etc/init.d/lavapdu-listen start || exit 7
+ # lava listen create the database, let it some time
+ sleep 5
+ echo "== Start lavapdu runner =="
+ /etc/init.d/lavapdu-runner start || exit 8
+fi
+
touch /var/run/conmux-registry
/usr/sbin/conmux-registry 63000 /var/run/conmux-registry&
sleep 2