Add support for plm to run under uml.
---
 src/plm/config/openhpi.conf                        | 18 ++++
 tools/cluster_sim_uml/archive/scripts/40opensaf.rc | 30 +++++++
 tools/cluster_sim_uml/build_uml                    | 95 ++++++++++++++++++++--
 3 files changed, 138 insertions(+), 5 deletions(-)
 create mode 100644 src/plm/config/openhpi.conf

diff --git a/src/plm/config/openhpi.conf b/src/plm/config/openhpi.conf
new file mode 100644
index 000000000..b811de134
--- /dev/null
+++ b/src/plm/config/openhpi.conf
@@ -0,0 +1,18 @@
+OPENHPI_AUTOINSERT_TIMEOUT = 5000000000
+OPENHPI_AUTOINSERT_TIMEOUT_READONLY = "NO"
+
+# Section for dynamic_simulator plugin
+handler libdyn_simulator {
+        entity_root = "{ADVANCEDTCA_CHASSIS,2}"
+# Location of the simulation data file
+# Normally an example file is installed in the same directory as openhpi.conf.
+# Please change the following entry if you have configured another install
+# directory or will use your own simulation.data.
+        file = "/etc/openhpi/opensaf-plm-sim.txt"
+        # infos goes to logfile and stdout
+        # the logfile are log00.log, log01.log ...
+#        logflags = "file stdout"
+#        logfile = "dynsim"
+        # if #logfile_max reached replace the oldest one
+#        logfile_max = "5"
+}
diff --git a/tools/cluster_sim_uml/archive/scripts/40opensaf.rc 
b/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
index 7df4cfee6..9057d680b 100644
--- a/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
+++ b/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
@@ -76,4 +76,34 @@ echo "$node_name" > /etc/opensaf/node_name
 echo "/tmp/core_%t_%e_%p" > /proc/sys/kernel/core_pattern
 ulimit -c unlimited
 
+if test -e /etc/plmcd.conf; then
+    sc_1_ip=$(grep "SC-1" /etc/hosts | cut -d' ' -f 1)
+    sc_2_ip=$(grep "SC-2" /etc/hosts | cut -d' ' -f 1)
+    if [ "$node_name" == "SC-1" ]; then
+      ee="Linux_os_hosting_clm_node,safHE=f120_slot_1"
+      path="my_entity = 
\"{ADVANCEDTCA_CHASSIS,2}{PHYSICAL_SLOT,1}{SWITCH_BLADE,0}\""
+    elif [ "$node_name" == "SC-2" ]; then
+      ee="Linux_os_hosting_clm_node,safHE=f120_slot_16"
+      path="my_entity = 
\"{ADVANCEDTCA_CHASSIS,2}{PHYSICAL_SLOT,16}{SWITCH_BLADE,0}\""
+    else
+      ee="$node_name"
+    fi
+    sed -i -e "s/10.105.1.3/$sc_1_ip/" \
+        -e "s/10.105.1.6/$sc_2_ip/" \
+        -e "s/0020f/safEE=$ee,safDomain=domain_1/" \
+        -e "s/1;os;Fedora;2.6.31/1;os;SUSE;2.6/" \
+        -e "/^\/etc\/init.d/s/^/#/" \
+        /etc/plmcd.conf
+    cp /etc/openhpi/openhpi.conf /var/opt
+    chmod go-rwx /var/opt/openhpi.conf
+    echo "$path" > /etc/openhpi/openhpiclient.conf
+
+    /usr/sbin/openhpid -c /var/opt/openhpi.conf
+
+    # wait for hpi to read in hardware info
+    sleep 10
+
+    /usr/local/sbin/plmcd&
+fi
+
 /etc/init.d/opensafd start&
diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml
index 16d49d03e..e54e45753 100755
--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -121,6 +121,73 @@ cmd_install_testprog() {
     cmd_mkcpio
 }
 
+cmd_build_container_testprog() {
+    src=$opensaf_home/samples/amf/container
+    libd=$root/usr/local/$lib_dir
+    installd=$root/opt/amf_demo
+
+    mkdir -p "$installd"
+    cp $src/amf_container_script $installd
+    gcc -g -O2 -Wall -fPIC -I$opensaf_home/src/amf/saf \
+       -I$opensaf_home/src/ais/include \
+       -DSA_EXTENDED_NAME_SOURCE \
+       -o $installd/amf_container_demo $src/amf_container_demo.c \
+       -Wl,--as-needed "-Wl,-rpath-link,$libd:$libd/opensaf" "-L$libd" -lSaAmf 
-lopensaf_core
+
+    echo "Creating [$root/root.cpio] ..."
+    cmd_mkcpio
+}
+
+##   install_container_testprog
+##     Build and install the AMF container demo program.
+##
+cmd_install_container_testprog() {
+    src=$opensaf_home/samples/amf/container
+    libd=$root/usr/local/$lib_dir
+    installd=$root/opt/amf_demo
+    immxml=$root/etc/opensaf/imm.xml
+    containedXml=$src/AppConfig-contained-2N.xml
+    containerXml=$src/AppConfig-container.xml
+
+    mkdir -p $installd
+    cp $src/amf_container_script $installd
+    gcc -g -O2 -Wall -fPIC -I$opensaf_home/src/amf/saf \
+       -I$opensaf_home/src/ais/include \
+       -DSA_EXTENDED_NAME_SOURCE \
+       -o $installd/amf_container_demo $src/amf_container_demo.c \
+       -Wl,--as-needed "-Wl,-rpath-link,$libd:$libd/opensaf" "-L$libd" -lSaAmf
+
+    test -r $immxml.orig || cp $immxml $immxml.orig
+    $opensaf_home/src/imm/tools/immxml-merge \
+       $immxml.orig $containedXml $containerXml > $immxml
+    $opensaf_home/src/imm/tools/immxml-validate $immxml
+    echo "Creating [$root/root.cpio] ..."
+    cmd_mkcpio
+}
+
+##   install_plmtests
+##     Install the PLM tests
+##
+cmd_install_plm_tests() {
+    src=$opensaf_home/src/plm/config
+    immxml=$root/etc/opensaf/imm.xml
+    plmXml=$src/plm-sim-imm.xml
+
+    test -r $immxml.orig || cp $immxml $immxml.orig
+    $opensaf_home/src/imm/tools/immxml-merge \
+       $immxml.orig $plmXml > $immxml
+    $opensaf_home/src/imm/tools/immxml-validate $immxml
+    mkdir -p $root/etc/openhpi
+    cp $src/openhpi.conf $root/etc/openhpi
+    #chmod 0600 $root/etc/openhpi
+    cp $src/opensaf-plm-sim.txt $root/etc/openhpi
+
+    # enable HPI in the configuration
+    sed -i '/isHpiSupported.*/ {N; 
s/isHpiSupported.*<value>0<\/value>/isHpiSupported<\/name>\n\t\t\t<value>1<\/value>/g}'
 $immxml
+    echo "Creating [$root/root.cpio] ..."
+    cmd_mkcpio
+}
+
 ##   create_rootfs
 ##     Create a (shadow) rootfs with OpenSAF and other required programs.
 ##
@@ -175,6 +242,7 @@ cmd_create_rootfs()
     test -e /usr/bin/strace && install /usr/bin/strace usr/bin
     test -e /usr/bin/lsof && install /usr/bin/lsof usr/bin
     test -e /bin/pidof && install /bin/pidof usr/bin
+    test -e /bin/prlimit && install /bin/prlimit usr/bin
     test -e /usr/sbin/tcpdump && install /usr/sbin/tcpdump usr/sbin
     test -e /usr/bin/addr2line && install /usr/bin/addr2line usr/bin
     if test -e /usr/bin/gdb; then
@@ -288,11 +356,22 @@ EOF
         cmd_mkcpio
     fi
 
-    # Remove line for starting plms
-    sed '/PLMD/d' < $root/etc/opensaf/nodeinit.conf.controller > \
-        $root/etc/opensaf/nodeinit.conf.controller.tmp
-    mv $root/etc/opensaf/nodeinit.conf.controller.tmp \
-        $root/etc/opensaf/nodeinit.conf.controller
+    if test -n "$ENABLE_PLM"; then
+        # install OpenHPI
+        if test -e /usr/sbin/openhpid; then
+          cp -a /usr/sbin/openhpid $root/usr/sbin
+          cp -a /usr/bin/hpiinv $root/usr/bin
+          cp -a /usr/bin/hpi_shell $root/usr/bin
+         mkdir -p $root/usr/lib64/openhpi
+         cp -a /usr/lib64/openhpi/libdyn_simulator.so* $root/usr/lib64/openhpi
+        fi
+    else
+        # Remove line for starting plms
+        sed '/PLMD/d' < $root/etc/opensaf/nodeinit.conf.controller > \
+            $root/etc/opensaf/nodeinit.conf.controller.tmp
+        mv $root/etc/opensaf/nodeinit.conf.controller.tmp \
+            $root/etc/opensaf/nodeinit.conf.controller
+    fi
 }
 
 ##   installibs
@@ -322,6 +401,12 @@ cmd_installibs() {
        fi
     done
 
+    if test -n "$ENABLE_PLM"; then
+        cmd_getlibs $(find . -name osafplmd -or -name libplms_hpi.so) 
/usr/sbin/openhpid |\
+            grep -v -e 'libSa\|libimmsv\|libsaf' \
+           -e "^/$lib_dir/ld-\|^/$lib_dir/libc.so" >> $deplib
+    fi
+
     for n in $(cat $deplib | sort | uniq); do
         # Skip OpenSAF libraries installed on the host
         if echo $n | grep opensaf; then
-- 
2.14.4



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to