Browse code

XenAPI: move Neutron plugin install to domU

Use the same mechanism as used for nova plugin installation, thus
avoiding the need for variables in dom0. This change will also help to
move XenServer CI to neutron in the future, as the dom0 part of the
script is not executed there.

With this change, the neutron related network will always be created and
attached even if the user wants to use nova-network.

Change-Id: I8669c94e9f0aacce2990469dbabde1ff702a2769

Mate Lakat authored on 2014/10/17 20:09:49
Showing 2 changed files
... ...
@@ -595,6 +595,24 @@ function init_neutron {
595 595
 function install_neutron {
596 596
     git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH
597 597
     setup_develop $NEUTRON_DIR
598
+
599
+    if [ "$VIRT_DRIVER" == 'xenserver' ]; then
600
+        local dom0_ip
601
+        dom0_ip=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3-)
602
+
603
+        local ssh_dom0
604
+        ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip"
605
+
606
+        # Find where the plugins should go in dom0
607
+        local xen_functions
608
+        xen_functions=$(cat $TOP_DIR/tools/xen/functions)
609
+        local plugin_dir
610
+        plugin_dir=$($ssh_dom0 "$xen_functions; set -eux; xapi_plugin_location")
611
+
612
+        # install neutron plugins to dom0
613
+        tar -czf - -C $NEUTRON_DIR/neutron/plugins/openvswitch/agent/xenapi/etc/xapi.d/plugins/ ./ |
614
+            $ssh_dom0 "tar -xzf - -C $plugin_dir && chmod a+x $plugin_dir/*"
615
+    fi
598 616
 }
599 617
 
600 618
 # install_neutronclient() - Collect source and prepare
... ...
@@ -65,16 +65,6 @@ EOF
65 65
     exit 1
66 66
 fi
67 67
 
68
-# Install plugins
69
-
70
-## Install the netwrap xapi plugin to support agent control of dom0 networking
71
-if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then
72
-    NEUTRON_ZIPBALL_URL=${NEUTRON_ZIPBALL_URL:-$(zip_snapshot_location $NEUTRON_REPO $NEUTRON_BRANCH)}
73
-    EXTRACTED_NEUTRON=$(extract_remote_zipball "$NEUTRON_ZIPBALL_URL")
74
-    install_xapi_plugins_from "$EXTRACTED_NEUTRON"
75
-    rm -rf "$EXTRACTED_NEUTRON"
76
-fi
77
-
78 68
 #
79 69
 # Configure Networking
80 70
 #
... ...
@@ -88,9 +78,7 @@ setup_network "$PUB_BRIDGE_OR_NET_NAME"
88 88
 
89 89
 # With neutron, one more network is required, which is internal to the
90 90
 # hypervisor, and used by the VMs
91
-if is_service_enabled neutron; then
92
-    setup_network "$XEN_INT_BRIDGE_OR_NET_NAME"
93
-fi
91
+setup_network "$XEN_INT_BRIDGE_OR_NET_NAME"
94 92
 
95 93
 if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then
96 94
     if [ "$(bridge_for "$VM_BRIDGE_OR_NET_NAME")" != "$(bridge_for "$FLAT_NETWORK_BRIDGE")" ]; then
... ...
@@ -292,14 +280,12 @@ $THIS_DIR/build_xva.sh "$GUEST_NAME"
292 292
 # Attach a network interface for the integration network (so that the bridge
293 293
 # is created by XenServer). This is required for Neutron. Also pass that as a
294 294
 # kernel parameter for DomU
295
-if is_service_enabled neutron; then
296
-    attach_network "$XEN_INT_BRIDGE_OR_NET_NAME"
295
+attach_network "$XEN_INT_BRIDGE_OR_NET_NAME"
297 296
 
298
-    XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
299
-    append_kernel_cmdline \
300
-        "$GUEST_NAME" \
301
-        "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
302
-fi
297
+XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME")
298
+append_kernel_cmdline \
299
+    "$GUEST_NAME" \
300
+    "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}"
303 301
 
304 302
 FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}"
305 303
 append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"