From 6df648920c0d15c1b79f8592bb99b98282005794 Mon Sep 17 00:00:00 2001 From: Mate Lakat Date: Fri, 17 Oct 2014 13:09:49 +0200 Subject: [PATCH] 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 --- lib/neutron | 18 ++++++++++++++++++ tools/xen/install_os_domU.sh | 26 ++++++-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/lib/neutron b/lib/neutron index ca9b16cd8c..43167d8206 100644 --- a/lib/neutron +++ b/lib/neutron @@ -595,6 +595,24 @@ function init_neutron { function install_neutron { git_clone $NEUTRON_REPO $NEUTRON_DIR $NEUTRON_BRANCH setup_develop $NEUTRON_DIR + + if [ "$VIRT_DRIVER" == 'xenserver' ]; then + local dom0_ip + dom0_ip=$(echo "$XENAPI_CONNECTION_URL" | cut -d "/" -f 3-) + + local ssh_dom0 + ssh_dom0="sudo -u $DOMZERO_USER ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@$dom0_ip" + + # Find where the plugins should go in dom0 + local xen_functions + xen_functions=$(cat $TOP_DIR/tools/xen/functions) + local plugin_dir + plugin_dir=$($ssh_dom0 "$xen_functions; set -eux; xapi_plugin_location") + + # install neutron plugins to dom0 + tar -czf - -C $NEUTRON_DIR/neutron/plugins/openvswitch/agent/xenapi/etc/xapi.d/plugins/ ./ | + $ssh_dom0 "tar -xzf - -C $plugin_dir && chmod a+x $plugin_dir/*" + fi } # install_neutronclient() - Collect source and prepare diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh index 439db68120..ff7e6fbc88 100755 --- a/tools/xen/install_os_domU.sh +++ b/tools/xen/install_os_domU.sh @@ -65,16 +65,6 @@ EOF exit 1 fi -# Install plugins - -## Install the netwrap xapi plugin to support agent control of dom0 networking -if [[ "$ENABLED_SERVICES" =~ "q-agt" && "$Q_PLUGIN" = "openvswitch" ]]; then - NEUTRON_ZIPBALL_URL=${NEUTRON_ZIPBALL_URL:-$(zip_snapshot_location $NEUTRON_REPO $NEUTRON_BRANCH)} - EXTRACTED_NEUTRON=$(extract_remote_zipball "$NEUTRON_ZIPBALL_URL") - install_xapi_plugins_from "$EXTRACTED_NEUTRON" - rm -rf "$EXTRACTED_NEUTRON" -fi - # # Configure Networking # @@ -88,9 +78,7 @@ setup_network "$PUB_BRIDGE_OR_NET_NAME" # With neutron, one more network is required, which is internal to the # hypervisor, and used by the VMs -if is_service_enabled neutron; then - setup_network "$XEN_INT_BRIDGE_OR_NET_NAME" -fi +setup_network "$XEN_INT_BRIDGE_OR_NET_NAME" if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then 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" # Attach a network interface for the integration network (so that the bridge # is created by XenServer). This is required for Neutron. Also pass that as a # kernel parameter for DomU -if is_service_enabled neutron; then - attach_network "$XEN_INT_BRIDGE_OR_NET_NAME" +attach_network "$XEN_INT_BRIDGE_OR_NET_NAME" - XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME") - append_kernel_cmdline \ - "$GUEST_NAME" \ - "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}" -fi +XEN_INTEGRATION_BRIDGE=$(bridge_for "$XEN_INT_BRIDGE_OR_NET_NAME") +append_kernel_cmdline \ + "$GUEST_NAME" \ + "xen_integration_bridge=${XEN_INTEGRATION_BRIDGE}" FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}" append_kernel_cmdline "$GUEST_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"