[Ovirt-devel] [PATCH ovirt-node] Creates a standalone mode entry point script.

Alan Pevec apevec at redhat.com
Fri Nov 7 01:27:43 UTC 2008


From: Darryl L. Pierce <dpierce at redhat.com>

[REPOST] split into separate patch per -config component, ws cleanup

This patch includes booting to firstboot/standalone mode

The script will execute only when the node is booted without the support of
a server suite. If it determines that the node is running in standalone
mode,
it will then kick over to a node setup script.

This iteration defines the general flow for the standalone mode's firstboot
use case. When the node boots and determines it's in standalone mode, it
goes through the following steps:

1. Prompt for an administrator password
2. Prompt the user to configure disk storage
3. Prompt the user to configure networking
4. Prompt the user to configure logging

The node then continues to boot normally.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 Makefile.am                     |    6 ++++
 ovirt-node.spec.in              |   15 ++++++++++-
 scripts/ovirt-config-logging    |    1 +
 scripts/ovirt-config-networking |    1 +
 scripts/ovirt-config-password   |    1 +
 scripts/ovirt-config-setup      |   23 ++++++++++++++++
 scripts/ovirt-config-storage    |    1 +
 scripts/ovirt-functions         |    5 +++
 scripts/ovirt-standalone-mode   |   55 +++++++++++++++++++++++++++++++++++++++
 9 files changed, 107 insertions(+), 1 deletions(-)
 create mode 100755 scripts/ovirt-config-logging
 create mode 100755 scripts/ovirt-config-networking
 create mode 100755 scripts/ovirt-config-password
 create mode 100755 scripts/ovirt-config-setup
 create mode 100755 scripts/ovirt-config-storage
 create mode 100755 scripts/ovirt-standalone-mode

diff --git a/Makefile.am b/Makefile.am
index 4ba0bca..0005ac9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,10 +27,16 @@ EXTRA_DIST =			\
   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-functions	\
   scripts/ovirt-post		\
   scripts/ovirt-process-config  \
+  scripts/ovirt-standalone-mode	\
   logrotate/ovirt-logrotate	\
   logrotate/ovirt-logrotate.conf
 
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index d029c57..10a544b 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -88,17 +88,22 @@ cd -
 
 %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir}
 %{__install} -p -m0755 scripts/ovirt-process-config %{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 ovirt-identify-node/ovirt-identify-node %{buildroot}%{_sbindir}
 %{__install} -p -m0755 ovirt-listen-awake/ovirt-listen-awake %{buildroot}%{_sbindir}
 %{__install} -Dp -m0755 ovirt-listen-awake/ovirt-listen-awake.init %{buildroot}%{_initrddir}/ovirt-listen-awake
 %{__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 %{buildroot}%{_initrddir}
 %{__install} -p -m0755 scripts/ovirt-post %{buildroot}%{_initrddir}
+%{__install} -p -m0755 scripts/ovirt-standalone-mode %{buildroot}%{_initrddir}
 
 %{__install} -p -m0644 scripts/collectd %{buildroot}%{_sysconfdir}/chkconfig.d
 %{__install} -p -m0644 scripts/collectd.conf.in %{buildroot}%{_sysconfdir}
@@ -125,6 +130,7 @@ cd -
 /sbin/chkconfig --add ovirt-early
 /sbin/chkconfig --add ovirt
 /sbin/chkconfig --add ovirt-post
+/sbin/chkconfig --add ovirt-standalone-mode
 # this is ugly; we need collectd to start *after* libvirtd, so we own the
 # /etc/chkconfig.d/collectd file, and then have to re-define collectd here
 /sbin/chkconfig --add collectd
@@ -136,6 +142,7 @@ if [ "$1" = 0 ] ; then
   /sbin/chkconfig --del ovirt
   /sbin/chkconfig --del ovirt-post
   /sbin/chkconfig --del ovirt-listen-awake
+  /sbin/chkconfig --del ovirt-standalone-mode
 fi
 
 %post selinux
@@ -159,6 +166,11 @@ 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
@@ -168,6 +180,7 @@ fi
 %{_initrddir}/ovirt
 %{_initrddir}/ovirt-post
 %{_initrddir}/ovirt-listen-awake
+%{_initrddir}/ovirt-standalone-mode
 %config %{_sysconfdir}/logrotate.d/ovirt-logrotate.conf
 %config %{_sysconfdir}/cron.hourly/ovirt-logrotate
 %defattr(-,root,root,0644)
diff --git a/scripts/ovirt-config-logging b/scripts/ovirt-config-logging
new file mode 100755
index 0000000..8b13789
--- /dev/null
+++ b/scripts/ovirt-config-logging
@@ -0,0 +1 @@
+
diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
new file mode 100755
index 0000000..8b13789
--- /dev/null
+++ b/scripts/ovirt-config-networking
@@ -0,0 +1 @@
+
diff --git a/scripts/ovirt-config-password b/scripts/ovirt-config-password
new file mode 100755
index 0000000..8b13789
--- /dev/null
+++ b/scripts/ovirt-config-password
@@ -0,0 +1 @@
+
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 100755
index 0000000..8b13789
--- /dev/null
+++ b/scripts/ovirt-config-storage
@@ -0,0 +1 @@
+
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index e251eac..53e9f62 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -7,6 +7,11 @@ OVIRT_LABEL=OVIRT
 
 OVIRT_BACKUP_DIR=/var/lib/ovirt-backup
 
+is_standalone()
+{
+    return 0
+}
+
 find_srv()
 {
     local dnsreply
diff --git a/scripts/ovirt-standalone-mode b/scripts/ovirt-standalone-mode
new file mode 100755
index 0000000..fed697a
--- /dev/null
+++ b/scripts/ovirt-standalone-mode
@@ -0,0 +1,55 @@
+#!/bin/bash
+#
+# ovirt-standalone-mode Starts the node in standalone 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_standalone
+        #if [ $? -ne 0 ]; then
+        #    exit 0
+        #fi
+
+        printf "Starting ovirt-standalone-mode: "
+
+        {
+            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