From aa21546b027f95d1117e9b22ea3ed26b661d338d Mon Sep 17 00:00:00 2001 From: "Jose A. Lopes" Date: Tue, 8 Apr 2014 14:55:07 +0200 Subject: [PATCH] Add 'xen-ifup-os' NIC script * Generalize 'kvm-ifup-os' to be also usable by Xen * Include a target to build the 'xen-ifup-os' NIC script from the KVM one, given that they are very similar. Signed-off-by: Jose A. Lopes Reviewed-by: Hrvoje Ribicic --- .gitignore | 1 + Makefile.am | 15 +++++++++++---- tools/{kvm-ifup-os.in => ifup-os.in} | 18 +++++++++--------- 3 files changed, 21 insertions(+), 13 deletions(-) rename tools/{kvm-ifup-os.in => ifup-os.in} (93%) diff --git a/.gitignore b/.gitignore index 8a6d1acaa..65fae8fe3 100644 --- a/.gitignore +++ b/.gitignore @@ -114,6 +114,7 @@ # tools /tools/kvm-ifup /tools/kvm-ifup-os +/tools/xen-ifup-os /tools/burnin /tools/ensure-dirs /tools/users-setup diff --git a/Makefile.am b/Makefile.am index 5be9d1cf4..58c031057 100644 --- a/Makefile.am +++ b/Makefile.am @@ -278,6 +278,7 @@ CLEANFILES = \ $(manhtml) \ tools/kvm-ifup \ tools/kvm-ifup-os \ + tools/xen-ifup-os \ tools/vif-ganeti \ tools/net-common \ tools/users-setup \ @@ -340,7 +341,8 @@ BUILT_EXAMPLES = \ doc/examples/hooks/ipsec dist_ifup_SCRIPTS = \ - tools/kvm-ifup-os + tools/kvm-ifup-os \ + tools/xen-ifup-os nodist_pkgpython_PYTHON = \ $(built_python_base_sources) \ @@ -1214,6 +1216,7 @@ myexeclib_SCRIPTS = \ daemons/daemon-util \ tools/kvm-ifup \ tools/kvm-ifup-os \ + tools/xen-ifup-os \ tools/vif-ganeti \ tools/net-common \ $(HS_MYEXECLIB_PROGS) @@ -1252,7 +1255,7 @@ EXTRA_DIST = \ devel/upload \ devel/webserver \ tools/kvm-ifup.in \ - tools/kvm-ifup-os.in \ + tools/ifup-os.in \ tools/vif-ganeti.in \ tools/net-common.in \ tools/vcluster-setup.in \ @@ -1743,8 +1746,12 @@ tools/kvm-ifup: tools/kvm-ifup.in $(REPLACE_VARS_SED) sed -f $(REPLACE_VARS_SED) < $< > $@ chmod +x $@ -tools/kvm-ifup-os: tools/kvm-ifup-os.in $(REPLACE_VARS_SED) - sed -f $(REPLACE_VARS_SED) < $< > $@ +tools/kvm-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED) + sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/kvm-ifup-os:/" < $< > $@ + chmod +x $@ + +tools/xen-ifup-os: tools/ifup-os.in $(REPLACE_VARS_SED) + sed -f $(REPLACE_VARS_SED) -e "s/ifup-os:/xen-ifup-os:/" < $< > $@ chmod +x $@ tools/vif-ganeti: tools/vif-ganeti.in $(REPLACE_VARS_SED) diff --git a/tools/kvm-ifup-os.in b/tools/ifup-os.in similarity index 93% rename from tools/kvm-ifup-os.in rename to tools/ifup-os.in index b696da6fd..c1d9927ca 100644 --- a/tools/kvm-ifup-os.in +++ b/tools/ifup-os.in @@ -121,9 +121,9 @@ function restart_dnsmasq { # but... :) if [ -z "$INTERFACE" ] then - echo kvm-vif-bridge: Failed to configure communication mechanism \ + echo ifup-os: Failed to configure communication mechanism \ interface because the \'INTERFACE\' environment variable was \ - not specified to the \'kvm-vif-bridge\' script + not specified to the script exit 1 fi @@ -132,9 +132,9 @@ fi # See comment about environment variable 'INTERFACE'. if [ -z "$MODE" ] then - echo kvm-vif-bridge: Failed to configure communication mechanism \ + echo ifup-os: Failed to configure communication mechanism \ interface because the \'MODE\' environment variable was \ - not specified to the \'kvm-vif-bridge\' script + not specified to the script exit 1 fi @@ -147,9 +147,9 @@ if ! is_instance_communication_tap; then exit 0; fi # See comment about environment variable 'INTERFACE'. if [ -z "$MAC" ] then - echo kvm-vif-bridge: Failed to configure communication mechanism \ + echo ifup-os: Failed to configure communication mechanism \ interface because the \'MAC\' environment variable was \ - not specified to the \'kvm-vif-bridge\' script + not specified to the script exit 1 fi @@ -158,9 +158,9 @@ fi # See comment about environment variable 'INTERFACE'. if [ -z "$IP" ] then - echo kvm-vif-bridge: Failed to configure communication mechanism \ + echo ifup-os: Failed to configure communication mechanism \ interface because the \'IP\' environment variable was \ - not specified to the \'kvm-vif-bridge\' script + not specified to the script exit 1 fi @@ -224,7 +224,7 @@ then if [ -z "$BIND_DYNAMIC" ] then - echo kvm-vif-bridge: dnsmasq mode \"bind-dynamic\" is not supported + echo ifup-os: dnsmasq mode \"bind-dynamic\" is not supported exit 1 fi -- GitLab