Browse code

XenServer hypervisor plugin

Convert XenServer hypervisor configuration in Nova to the new plugin setup.

Change-Id: I8916560ca3f2dae8b8d8bcb60b7aa2eb5984cbcb

Dean Troyer authored on 2013/09/24 03:44:38
Showing 3 changed files
... ...
@@ -76,15 +76,7 @@ SPICE_DIR=$DEST/spice-html5
76 76
 # --------------------------
77 77
 
78 78
 # Set defaults according to the virt driver
79
-if [ "$VIRT_DRIVER" = 'xenserver' ]; then
80
-    PUBLIC_INTERFACE_DEFAULT=eth2
81
-    GUEST_INTERFACE_DEFAULT=eth1
82
-    # Allow ``build_domU.sh`` to specify the flat network bridge via kernel args
83
-    FLAT_NETWORK_BRIDGE_DEFAULT=$(sed -e 's/.* flat_network_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline)
84
-    if is_service_enabled neutron; then
85
-        XEN_INTEGRATION_BRIDGE=$(sed -e 's/.* xen_integration_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline)
86
-    fi
87
-elif [ "$VIRT_DRIVER" = 'baremetal' ]; then
79
+if [ "$VIRT_DRIVER" = 'baremetal' ]; then
88 80
     NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager}
89 81
     PUBLIC_INTERFACE_DEFAULT=eth0
90 82
     FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
... ...
@@ -537,16 +529,12 @@ function create_nova_conf() {
537 537
         SPICEHTML5PROXY_URL=${SPICEHTML5PROXY_URL:-"http://$SERVICE_HOST:6082/spice_auto.html"}
538 538
         iniset $NOVA_CONF spice html5proxy_base_url "$SPICEHTML5PROXY_URL"
539 539
     fi
540
-    if [ "$VIRT_DRIVER" = 'xenserver' ]; then
541
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=169.254.0.1}
542
-    else
543
-        VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
544
-    fi
545 540
 
546 541
     if is_service_enabled n-novnc || is_service_enabled n-xvnc; then
547 542
       # Address on which instance vncservers will listen on compute hosts.
548 543
       # For multi-host, this should be the management ip of the compute host.
549 544
       VNCSERVER_LISTEN=${VNCSERVER_LISTEN=127.0.0.1}
545
+      VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=127.0.0.1}
550 546
       iniset $NOVA_CONF DEFAULT vnc_enabled true
551 547
       iniset $NOVA_CONF DEFAULT vncserver_listen "$VNCSERVER_LISTEN"
552 548
       iniset $NOVA_CONF DEFAULT vncserver_proxyclient_address "$VNCSERVER_PROXYCLIENT_ADDRESS"
553 549
new file mode 100644
... ...
@@ -0,0 +1,85 @@
0
+# lib/nova_plugins/hypervisor-xenserver
1
+# Configure the XenServer hypervisor
2
+
3
+# Enable with:
4
+# VIRT_DRIVER=xenserver
5
+
6
+# Dependencies:
7
+# ``functions`` file
8
+# ``nova`` configuration
9
+
10
+# install_nova_hypervisor - install any external requirements
11
+# configure_nova_hypervisor - make configuration changes, including those to other services
12
+# start_nova_hypervisor - start any external services
13
+# stop_nova_hypervisor - stop any external services
14
+# cleanup_nova_hypervisor - remove transient data and cache
15
+
16
+# Save trace setting
17
+MY_XTRACE=$(set +o | grep xtrace)
18
+set +o xtrace
19
+
20
+
21
+# Defaults
22
+# --------
23
+
24
+PUBLIC_INTERFACE_DEFAULT=eth2
25
+GUEST_INTERFACE_DEFAULT=eth1
26
+# Allow ``build_domU.sh`` to specify the flat network bridge via kernel args
27
+FLAT_NETWORK_BRIDGE_DEFAULT=$(sed -e 's/.* flat_network_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline)
28
+if is_service_enabled neutron; then
29
+    XEN_INTEGRATION_BRIDGE=$(sed -e 's/.* xen_integration_bridge=\([[:alnum:]]*\).*$/\1/g' /proc/cmdline)
30
+fi
31
+
32
+VNCSERVER_PROXYCLIENT_ADDRESS=${VNCSERVER_PROXYCLIENT_ADDRESS=169.254.0.1}
33
+
34
+
35
+# Entry Points
36
+# ------------
37
+
38
+# clean_nova_hypervisor - Clean up an installation
39
+function cleanup_nova_hypervisor() {
40
+    # This function intentionally left blank
41
+    :
42
+}
43
+
44
+# configure_nova_hypervisor - Set config files, create data dirs, etc
45
+function configure_nova_hypervisor() {
46
+    if [ -z "$XENAPI_CONNECTION_URL" ]; then
47
+        die $LINENO "XENAPI_CONNECTION_URL is not specified"
48
+    fi
49
+    read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
50
+    iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver"
51
+    iniset $NOVA_CONF DEFAULT xenapi_connection_url "$XENAPI_CONNECTION_URL"
52
+    iniset $NOVA_CONF DEFAULT xenapi_connection_username "$XENAPI_USER"
53
+    iniset $NOVA_CONF DEFAULT xenapi_connection_password "$XENAPI_PASSWORD"
54
+    iniset $NOVA_CONF DEFAULT flat_injected "False"
55
+    # Need to avoid crash due to new firewall support
56
+    XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
57
+    iniset $NOVA_CONF DEFAULT firewall_driver "$XEN_FIREWALL_DRIVER"
58
+}
59
+
60
+# install_nova_hypervisor() - Install external components
61
+function install_nova_hypervisor() {
62
+    # This function intentionally left blank
63
+    :
64
+}
65
+
66
+# start_nova_hypervisor - Start any required external services
67
+function start_nova_hypervisor() {
68
+    # This function intentionally left blank
69
+    :
70
+}
71
+
72
+# stop_nova_hypervisor - Stop any external services
73
+function stop_nova_hypervisor() {
74
+    # This function intentionally left blank
75
+    :
76
+}
77
+
78
+
79
+# Restore xtrace
80
+$MY_XTRACE
81
+
82
+# Local variables:
83
+# mode: shell-script
84
+# End:
... ...
@@ -1011,25 +1011,6 @@ if is_service_enabled nova; then
1011 1011
         configure_nova_hypervisor
1012 1012
 
1013 1013
 
1014
-    # XenServer
1015
-    # ---------
1016
-
1017
-    elif [ "$VIRT_DRIVER" = 'xenserver' ]; then
1018
-        echo_summary "Using XenServer virtualization driver"
1019
-        if [ -z "$XENAPI_CONNECTION_URL" ]; then
1020
-            die $LINENO "XENAPI_CONNECTION_URL is not specified"
1021
-        fi
1022
-        read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
1023
-        iniset $NOVA_CONF DEFAULT compute_driver "xenapi.XenAPIDriver"
1024
-        iniset $NOVA_CONF DEFAULT xenapi_connection_url "$XENAPI_CONNECTION_URL"
1025
-        iniset $NOVA_CONF DEFAULT xenapi_connection_username "$XENAPI_USER"
1026
-        iniset $NOVA_CONF DEFAULT xenapi_connection_password "$XENAPI_PASSWORD"
1027
-        iniset $NOVA_CONF DEFAULT flat_injected "False"
1028
-        # Need to avoid crash due to new firewall support
1029
-        XEN_FIREWALL_DRIVER=${XEN_FIREWALL_DRIVER:-"nova.virt.firewall.IptablesFirewallDriver"}
1030
-        iniset $NOVA_CONF DEFAULT firewall_driver "$XEN_FIREWALL_DRIVER"
1031
-
1032
-
1033 1014
     # OpenVZ
1034 1015
     # ------
1035 1016