[Ovirt-devel] [PATCH appliance] Add -f flag to create-ovirt-network
Perry Myers
pmyers at redhat.com
Tue Nov 18 21:43:10 UTC 2008
-f indicates that:
1. Don't abort if NetworkManager is installed (Note: with NetworkManager
enabled, -e parameter will not work properly since some interfaces
are controlled via NetworkManager and some would need to be controlled
via standard network init script. Without -e parameter, the libvirt
controlled ovirtbr0 works fine)
2. Don't prompt for overwriting interface specified with -e parameter
So use -f at your own risk!
Signed-off-by: Perry Myers <pmyers at redhat.com>
---
create-ovirt-network | 8 +++++---
ovirt-appliance-functions | 13 +++++++++++--
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/create-ovirt-network b/create-ovirt-network
index 00b56ba..b7a4526 100755
--- a/create-ovirt-network
+++ b/create-ovirt-network
@@ -5,17 +5,19 @@
usage() {
case $# in 1) warn "$1"; try_h; exit 1;; esac
cat <<EOF
-Usage: $ME [-e eth]
+Usage: $ME [-e eth] [-f]
-e: ethernet device to use as bridge (i.e. eth1)
+ -f: force install of networking
-h: display this help and exit
EOF
}
err=0 help=0
bridge=
-while getopts :e:h c; do
+while getopts :e:fh c; do
case $c in
e) bridge=$OPTARG;;
+ f) force=1;;
h) help=1;;
'?') err=1; warn "invalid option: \`-$OPTARG'";;
:) err=1; warn "missing argument to \`-$OPTARG' option";;
@@ -46,7 +48,7 @@ if [ -n "$bridge" ]; then
&& die "$bridge already attached to other bridge $attached_bridge"
# Check to make sure that the system is not already using the interface
- if test -f $NET_SCRIPTS/ifcfg-$bridge ; then
+ if [[ $force != 1 && -f $NET_SCRIPTS/ifcfg-$bridge ]]; then
echo "$NET_SCRIPTS/ifcfg-$bridge is present, are you sure you wish to"
echo "overwrite this file? [y/N]? "
read yesno
diff --git a/ovirt-appliance-functions b/ovirt-appliance-functions
index a81660e..9c7dc1f 100644
--- a/ovirt-appliance-functions
+++ b/ovirt-appliance-functions
@@ -44,6 +44,8 @@ NODE_DISK_SIZE=128M
imgdir=$IMGDIR_DEFAULT
name=$NAME_DEFAULT
+force=0
+
do_checks() {
# first, check to see we are root
if [ $( id -u ) -ne 0 ]; then
@@ -71,8 +73,15 @@ do_checks() {
die "Must have the $PACKAGES packages installed"
fi
- service NetworkManager status > /dev/null 2>&1 \
- && die "NetworkManager is running, disable and use standard network scripts before proceeding"
+ service NetworkManager status > /dev/null 2>&1 ; netman_status=$?
+ if [ $netman_status -eq 0 ]; then
+ if [ $force -ne 1 ]; then
+ die "NetworkManager is running, disable and use standard network scripts before proceeding"
+ elif [ -n "$bridge" ]; then
+ echo "WARNING! NetworkManager running and bridge ($bridge) specified"
+ echo "WARNING! This combination will most likely not work."
+ fi
+ fi
service iptables status > /dev/null 2>&1 \
|| service iptables start > /dev/null 2>&1
--
1.6.0.3
More information about the ovirt-devel
mailing list