ifdown: Add example kvm-ifdown script
authorDimitris Aragiorgis <dimara@grnet.gr>
Fri, 24 Jan 2014 16:45:02 +0000 (18:45 +0200)
committerDimitris Aragiorgis <dimara@grnet.gr>
Thu, 27 Mar 2014 08:01:11 +0000 (10:01 +0200)
This script currently does nothing more that calling user the
user provided one if it exists.

User provided script should be placed under /etc/ganeti/
and named `ganeti-kvm-ifdown`.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>

.gitignore
Makefile.am
lib/pathutils.py
tools/kvm-ifdown.in [new file with mode: 0644]

index fdd50d7..e5c2e27 100644 (file)
 
 # tools
 /tools/kvm-ifup
+/tools/kvm-ifdown
 /tools/burnin
 /tools/ensure-dirs
 /tools/users-setup
index 253b958..a2e8202 100644 (file)
@@ -196,6 +196,7 @@ CLEANFILES = \
        $(man_MANS) \
        $(manhtml) \
        tools/kvm-ifup \
+       tools/kvm-ifdown \
        tools/vif-ganeti \
        tools/net-common \
        tools/users-setup \
@@ -941,6 +942,7 @@ nodist_pkglib_python_scripts = \
 myexeclib_SCRIPTS = \
        daemons/daemon-util \
        tools/kvm-ifup \
+       tools/kvm-ifdown \
        tools/vif-ganeti \
        tools/net-common \
        $(pkglib_python_scripts) \
@@ -978,6 +980,7 @@ EXTRA_DIST = \
        devel/upload \
        devel/webserver \
        tools/kvm-ifup.in \
+       tools/kvm-ifdown.in \
        tools/vif-ganeti.in \
        tools/net-common.in \
        tools/vcluster-setup.in \
@@ -1391,6 +1394,10 @@ tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED)
        sed -f $(REPLACE_VARS_SED) < $< > $@
        chmod +x $@
 
+tools/kvm-ifdown: tools/kvm-ifdown.in $(REPLACE_VARS_SED)
+       sed -f $(REPLACE_VARS_SED) < $< > $@
+       chmod +x $@
+
 tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED)
        sed -f $(REPLACE_VARS_SED) < $< > $@
        chmod +x $@
index 341d1ba..f6697f3 100644 (file)
@@ -52,6 +52,7 @@ DAEMON_UTIL = _autoconf.PKGLIBDIR + "/daemon-util"
 IMPORT_EXPORT_DAEMON = _autoconf.PKGLIBDIR + "/import-export"
 KVM_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/kvm-console-wrapper"
 KVM_IFUP = _autoconf.PKGLIBDIR + "/kvm-ifup"
+KVM_IFDOWN = _autoconf.PKGLIBDIR + "/kvm-ifdown"
 PREPARE_NODE_JOIN = _autoconf.PKGLIBDIR + "/prepare-node-join"
 NODE_DAEMON_SETUP = _autoconf.PKGLIBDIR + "/node-daemon-setup"
 XEN_CONSOLE_WRAPPER = _autoconf.PKGLIBDIR + "/tools/xen-console-wrapper"
diff --git a/tools/kvm-ifdown.in b/tools/kvm-ifdown.in
new file mode 100644 (file)
index 0000000..685338b
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+
+# Copyright (C) 2011, 2012 Google Inc.
+#
+# 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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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.
+
+source @PKGLIBDIR@/net-common
+
+# Execute the user-supplied network script, if applicable
+if [ -x "$CONF_DIR/ganeti-kvm-ifdown" ]; then
+  exec $CONF_DIR/ganeti-kvm-ifdown
+fi
+
+exit 0