[Ovirt-devel] [PATCH]v2 Add ovirt-early vendor hooks

Ryan Harper ryanh at us.ibm.com
Thu Nov 19 18:44:02 UTC 2009


Create /etc/ovirt-early.d and add a kernel parameter, ovirt_early
which can specify one or more strings which reference scripts
that will be embedded into the ovirt-node image.  ovirt-early pre-*
are called after processing command line parameters but before mount
the config partition in ovirt-early start(), and post-* are called
at the very end of the start() function.

Update ovirt-node specfile to create /etc/ovirt-early.d

Signed-off-by: Ryan Harper <ryanh at us.ibm.com>
---
 ovirt-node.spec.in  |    3 +++
 scripts/ovirt-early |   19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 2a6b7b6..07ba742 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -272,6 +272,8 @@ ln -s ovirt-release %{buildroot}/etc/system-release
 %{__ln_s} ../..%{_sbindir}/ovirt-config-boot-wrapper %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"98_Local install and reboot"
 %{__ln_s} ../..%{_sbindir}/ovirt-config-uninstall %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"99_Uninstall node"
 
+# ovirt-early vendor hook dir
+%{__install} -d -m0755 %{buildroot}%{_sysconfdir}/ovirt-early.d
 
 %clean
 %{__rm} -rf %{buildroot}
@@ -357,6 +359,7 @@ fi
 %config %{_sysconfdir}/cron.d/ovirt-logrotate
 %{_sysconfdir}/ovirt-config-boot.d
 %{_sysconfdir}/ovirt-config-setup.d
+%{_sysconfdir}/ovirt-early.d
 
 %files stateful
 %defattr(-,root,root,0755)
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index cdd4afd..b688014 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -12,6 +12,7 @@
 
 BONDING_MODCONF_FILE=/etc/modprobe.d/bonding
 AUGTOOL_CONFIG=/var/tmp/augtool-config
+EARLY_DIR=/etc/ovirt-early.d
 
 get_mac_addresses() {
     local DEVICE=$1
@@ -369,9 +370,20 @@ start() {
             console=*)
             bootparams="$bootparams $i"
             ;;
+            ovirt_early=*)
+            i=${i#ovirt_early=}
+            ovirt_early=$(echo $i|tr ",:;" " ")
+            ;;
         esac
     done
 
+    for hook in $ovirt_early; do
+        pre="$EARLY_DIR/pre-$hook"
+        if [ -e "$pre" ]; then
+            . "$pre"
+        fi
+    done
+
     if [ -z "$ip_netmask" ]; then
         ip_netmask=$netmask
     fi
@@ -434,6 +446,13 @@ start() {
         fi
     fi
 
+    for hook in $ovirt_early; do
+        post="$EARLY_DIR/post-$hook"
+        if [ -e "$post" ]; then
+            . "$post"
+        fi
+    done
+
     return 0
 }
 
-- 
1.6.2.5


-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
ryanh at us.ibm.com




More information about the ovirt-devel mailing list