]> xenbits.xensource.com Git - people/sstabellini/raisin.git/commitdiff
Configure support in Fedora
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 19 Mar 2015 15:44:48 +0000 (15:44 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 19 Mar 2015 15:44:48 +0000 (15:44 +0000)
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
common-functions.sh
grub.sh
ifcfg-xenbr0 [new file with mode: 0644]
libvirt.sh
xen.sh

index 0243f02f6295d10c3e9cef7b8dcf1759d3081de4..de838bd44bd97f0cf1eaad4318d6780e945e48d6 100644 (file)
@@ -105,17 +105,26 @@ function install_dependencies() {
 }
 
 function start_initscripts() {
-    case $DISTRO in
-        "Debian" )
-        while test $# -ge 1
-        do
-            $SUDO update-rc.d $1
+    while test $# -ge 1
+    do
+        if test ! -f $1
+        then
             shift 1
-        done
-        ;;
-        * )
-        echo "I don't know how to start initscripts on $DISTRO"
-        ;;
-    esac
+            continue
+        fi
+        case $DISTRO in
+            "Debian" )
+            $SUDO update-rc.d $1 defaults
+            ;;
+            "Fedora" )
+            $SUDO chkconfig --add $1
+            ;;
+            * )
+            echo "I don't know how to start initscripts on $DISTRO"
+            return 1
+            ;;
+        esac
+        shift 1
+    done
 }
 
diff --git a/grub.sh b/grub.sh
index 0d176736c07c94ec188c1447fa03cac2fca34325..80117f6692e04065ea6351b9b059d094999796dd 100644 (file)
--- a/grub.sh
+++ b/grub.sh
@@ -59,5 +59,5 @@ function grub_clean() {
 }
 
 function grub_configure() {
-    echo "Nothing to configure for Grub"
+    echo "Grub: nothing to configure"
 }
diff --git a/ifcfg-xenbr0 b/ifcfg-xenbr0
new file mode 100644 (file)
index 0000000..fe183d5
--- /dev/null
@@ -0,0 +1,5 @@
+DEVICE=xenbr0
+TYPE=Bridge
+BOOTPROTO=dhcp
+ONBOOT=yes
+DELAY=0
index 83172c9cf8fea2211632399e8b23147d7f23b86d..8006cdc2d85f093502fef4c7ce13cde87dea4150 100644 (file)
@@ -60,10 +60,5 @@ function libvirt_clean() {
 }
 
 function libvirt_configure() {
-    if test "$DISTRO" != "Debian"
-    then
-        echo "I don't know how to configure Libvirt on $DISTRO"
-        return 1
-    fi
-    start_initscripts libvirtd
+    start_initscripts libvirtd libvirt-guests virtlockd
 }
diff --git a/xen.sh b/xen.sh
index c17e24e997e9e350da43a6aa93dd321bd11813a2..3d97eb9e281a0e76d505dc0194ae2b718190934c 100644 (file)
--- a/xen.sh
+++ b/xen.sh
@@ -69,12 +69,39 @@ function xen_create_bridge_Debian() {
     rm $TMPFILE
 }
 
-function xen_configure() {
-    if test "$DISTRO" != "Debian"
+function xen_create_bridge_Fedora() {
+    BRIDGE="xenbr0"
+
+    if test "`grep $BRIDGE /etc/sysconfig/network-scripts/*`"
+    then
+        return 0
+    fi
+
+    IFACE=`grep 'BOOTPROTO="dhcp"' /etc/sysconfig/network-scripts/* | head -1 | cut -d : -f 1`
+    if test -z "$IFACE"
     then
-        echo "I don't know how to configure Xen on $DISTRO"
         return 1
     fi
+
+    $SUDO chkconfig NetworkManager off
+    $SUDO chkconfig network on
+    $SUDO service NetworkManager stop
+
+    TMPFILE=`mktemp`
+    cat $IFACE | grep -v dhcp | grep -v DHCLIENT > $TMPFILE
+    echo "BRIDGE=$BRIDGE" >> $TMPFILE
+    $SUDO mv -f $TMPFILE $IFACE
+
+    $SUDO cp ifcfg-xenbr0 /etc/sysconfig/network-scripts
+
+    $SUDO iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
+    $SUDO service iptables save
+    $SUDO service iptables restart
+
+    $SUDO service network start
+}
+
+function xen_configure() {
     xen_create_bridge_$DISTRO
     start_initscripts xencommons xendomains xen-watchdog
 }