[Ovirt-devel] [PATCH node] Added a script that runs during first boot for the node.

Darryl L. Pierce dpierce at redhat.com
Fri Nov 7 16:15:38 UTC 2008


Each configuration function is stubbed out. The functions are:

 * configure logging
 * configure networking
 * configure password
 * configure storage

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 Makefile.am                     |   34 ++++++++++++++---------
 ovirt-node.spec.in              |   15 +++++++++-
 scripts/ovirt-config-logging    |    2 +
 scripts/ovirt-config-networking |    2 +
 scripts/ovirt-config-password   |    2 +
 scripts/ovirt-config-setup      |   23 ++++++++++++++++
 scripts/ovirt-config-storage    |    2 +
 scripts/ovirt-firstboot         |   56 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 121 insertions(+), 15 deletions(-)
 create mode 100644 scripts/ovirt-config-logging
 create mode 100644 scripts/ovirt-config-networking
 create mode 100644 scripts/ovirt-config-password
 create mode 100755 scripts/ovirt-config-setup
 create mode 100644 scripts/ovirt-config-storage
 create mode 100755 scripts/ovirt-firstboot

diff --git a/Makefile.am b/Makefile.am
index 4ba0bca..fc0dbb5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,20 +18,26 @@
 OVIRT_CACHE_DIR	?= $(HOME)/ovirt-cache
 SUBDIRS = ovirt-identify-node ovirt-listen-awake
 
-EXTRA_DIST =			\
-  .gitignore			\
-  ovirt-node.spec		\
-  ovirt-node.spec.in		\
-  ovirt-node-selinux.te		\
-  scripts/collectd		\
-  scripts/collectd.conf.in	\
-  scripts/ovirt			\
-  scripts/ovirt-awake		\
-  scripts/ovirt-early		\
-  scripts/ovirt-functions	\
-  scripts/ovirt-post		\
-  scripts/ovirt-process-config  \
-  logrotate/ovirt-logrotate	\
+EXTRA_DIST =			  \
+  .gitignore			  \
+  ovirt-node.spec		  \
+  ovirt-node.spec.in		  \
+  ovirt-node-selinux.te		  \
+  scripts/collectd		  \
+  scripts/collectd.conf.in	  \
+  scripts/ovirt			  \
+  scripts/ovirt-awake		  \
+  scripts/ovirt-config-logging    \
+  scripts/ovirt-config-networking \
+  scripts/ovirt-config-password   \
+  scripts/ovirt-config-setup      \
+  scripts/ovirt-config-storage    \
+  scripts/ovirt-early		  \
+  scripts/ovirt-firstboot         \
+  scripts/ovirt-functions	  \
+  scripts/ovirt-post		  \
+  scripts/ovirt-process-config    \
+  logrotate/ovirt-logrotate	  \
   logrotate/ovirt-logrotate.conf
 
 DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index d029c57..2a01b7c 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -87,6 +87,11 @@ cd -
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d
 
 %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-setup %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-storage %{buildroot}%{_sbindir}
 %{__install} -p -m0755 scripts/ovirt-process-config %{buildroot}%{_sbindir}
 %{__install} -p -m0755 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir}
 %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir}
@@ -94,9 +99,9 @@ cd -
 %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-install-node %{buildroot}%{_sbindir}
 %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-uninstall-node %{buildroot}%{_sbindir}
 
-
 %{__install} -p -m0644 scripts/ovirt-functions %{buildroot}%{_initrddir}
 %{__install} -p -m0755 scripts/ovirt-early %{buildroot}%{_initrddir}
+%{__install} -p -m0755 scripts/ovirt-firstboot %{buildroot}%{_initrddir}
 %{__install} -p -m0755 scripts/ovirt %{buildroot}%{_initrddir}
 %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir}
 
@@ -123,6 +128,7 @@ cd -
 
 %post
 /sbin/chkconfig --add ovirt-early
+/sbin/chkconfig --add ovirt-firstboot
 /sbin/chkconfig --add ovirt
 /sbin/chkconfig --add ovirt-post
 # this is ugly; we need collectd to start *after* libvirtd, so we own the
@@ -133,6 +139,7 @@ cd -
 %preun
 if [ "$1" = 0 ] ; then
   /sbin/chkconfig --del ovirt-early
+  /sbin/chkconfig --del ovirt-firstboot
   /sbin/chkconfig --del ovirt
   /sbin/chkconfig --del ovirt-post
   /sbin/chkconfig --del ovirt-listen-awake
@@ -159,12 +166,18 @@ fi
 %files
 %defattr(-,root,root,0755)
 %{_sbindir}/ovirt-awake
+%{_sbindir}/ovirt-config-logging
+%{_sbindir}/ovirt-config-networking
+%{_sbindir}/ovirt-config-password
+%{_sbindir}/ovirt-config-setup
+%{_sbindir}/ovirt-config-storage
 %{_sbindir}/ovirt-process-config
 %{_sbindir}/ovirt-identify-node
 %{_sbindir}/ovirt-listen-awake
 %{_sbindir}/ovirt-install-node
 %{_sbindir}/ovirt-uninstall-node
 %{_initrddir}/ovirt-early
+%{_initrddir}/ovirt-firstboot
 %{_initrddir}/ovirt
 %{_initrddir}/ovirt-post
 %{_initrddir}/ovirt-listen-awake
diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging
new file mode 100644
index 0000000..c856ef1
--- /dev/null
+++ b/scripts/ovirt-config-logging
@@ -0,0 +1,2 @@
+#!/bin/bash
+#
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
new file mode 100644
index 0000000..c856ef1
--- /dev/null
+++ b/scripts/ovirt-config-networking
@@ -0,0 +1,2 @@
+#!/bin/bash
+#
diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password
new file mode 100644
index 0000000..c856ef1
--- /dev/null
+++ b/scripts/ovirt-config-password
@@ -0,0 +1,2 @@
+#!/bin/bash
+#
diff --git a/scripts/ovirt-config-setup b/scripts/ovirt-config-setup
new file mode 100755
index 0000000..8408d14
--- /dev/null
+++ b/scripts/ovirt-config-setup
@@ -0,0 +1,23 @@
+#!/bin/bash
+#
+# Entry point for configuring an oVirt node when running in standalone mode.
+
+while true; do
+    PS3="Please select an option: "
+    # TODO should we make this optional, based on whether the password was already set?
+    PASSWORD_OPTION="Password"
+    OPTIONS="Networking Storage Logging ${PASSWORD_OPTION} Quit"
+
+    select OPTION in $OPTIONS
+    do
+        printf "\n"
+
+        case "$OPTION" in
+            "Networking") ovirt-config-networking ; break ;;
+            "Storage")    ovirt-config-storage    ; break ;;
+            "Logging")    ovirt-config-logging    ; break ;;
+            "Password")   ovirt-config-password   ; break ;;
+            "Quit")       exit 0 ;;
+        esac
+    done
+done
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
new file mode 100644
index 0000000..c856ef1
--- /dev/null
+++ b/scripts/ovirt-config-storage
@@ -0,0 +1,2 @@
+#!/bin/bash
+#
diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot
new file mode 100755
index 0000000..fef25ff
--- /dev/null
+++ b/scripts/ovirt-firstboot
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# ovirt-firstboot Puts the node into configuration mode.
+#
+# chkconfig: 2345 99 01
+# description: ovirt-early services
+#
+# Copyright (C) 2008 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+## Source functions library
+. /etc/init.d/functions
+. /etc/init.d/ovirt-functions
+
+start ()
+{
+    ovirt-config-setup
+}
+
+case "$1" in
+    start)
+        #is_firstboot
+        #if [ $? -ne 0 ]; then
+        #    exit 0
+        #fi
+
+        printf "Starting ovirt-firstboot: "
+
+        {
+            start
+        }
+
+        test $? == 0 && success || failure
+        echo
+        ;;
+
+    *)
+        echo "Usage: ovirt-early {start}"
+        exit 2
+esac
+
-- 
1.5.6.5




More information about the ovirt-devel mailing list