| ... | ... |
@@ -71,23 +71,24 @@ QEMU_CONF=/etc/libvirt/qemu.conf |
| 71 | 71 |
NOVNC_DIR=$DEST/noVNC |
| 72 | 72 |
SPICE_DIR=$DEST/spice-html5 |
| 73 | 73 |
|
| 74 |
+# Set default defaults here as some hypervisor drivers override these |
|
| 75 |
+PUBLIC_INTERFACE_DEFAULT=br100 |
|
| 76 |
+GUEST_INTERFACE_DEFAULT=eth0 |
|
| 77 |
+FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
|
| 78 |
+ |
|
| 79 |
+# Get hypervisor configuration |
|
| 80 |
+# ---------------------------- |
|
| 81 |
+ |
|
| 82 |
+NOVA_PLUGINS=$TOP_DIR/lib/nova_plugins |
|
| 83 |
+if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 84 |
+ # Load plugin |
|
| 85 |
+ source $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER |
|
| 86 |
+fi |
|
| 87 |
+ |
|
| 74 | 88 |
|
| 75 | 89 |
# Nova Network Configuration |
| 76 | 90 |
# -------------------------- |
| 77 | 91 |
|
| 78 |
-# Set defaults according to the virt driver |
|
| 79 |
-if [ "$VIRT_DRIVER" = 'baremetal' ]; then |
|
| 80 |
- NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager}
|
|
| 81 |
- PUBLIC_INTERFACE_DEFAULT=eth0 |
|
| 82 |
- FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
|
|
| 83 |
- FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
|
| 84 |
- STUB_NETWORK=${STUB_NETWORK:-False}
|
|
| 85 |
-else |
|
| 86 |
- PUBLIC_INTERFACE_DEFAULT=br100 |
|
| 87 |
- GUEST_INTERFACE_DEFAULT=eth0 |
|
| 88 |
- FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
|
| 89 |
-fi |
|
| 90 |
- |
|
| 91 | 92 |
NETWORK_MANAGER=${NETWORK_MANAGER:-${NET_MAN:-FlatDHCPManager}}
|
| 92 | 93 |
PUBLIC_INTERFACE=${PUBLIC_INTERFACE:-$PUBLIC_INTERFACE_DEFAULT}
|
| 93 | 94 |
VLAN_INTERFACE=${VLAN_INTERFACE:-$GUEST_INTERFACE_DEFAULT}
|
| ... | ... |
@@ -274,83 +275,6 @@ function configure_nova() {
|
| 274 | 274 |
fi |
| 275 | 275 |
fi |
| 276 | 276 |
|
| 277 |
- # Prepare directories and packages for baremetal driver |
|
| 278 |
- if is_baremetal; then |
|
| 279 |
- configure_baremetal_nova_dirs |
|
| 280 |
- fi |
|
| 281 |
- |
|
| 282 |
- if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then |
|
| 283 |
- if is_service_enabled neutron && is_neutron_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then |
|
| 284 |
- # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces |
|
| 285 |
- cat <<EOF | sudo tee -a $QEMU_CONF |
|
| 286 |
-cgroup_device_acl = [ |
|
| 287 |
- "/dev/null", "/dev/full", "/dev/zero", |
|
| 288 |
- "/dev/random", "/dev/urandom", |
|
| 289 |
- "/dev/ptmx", "/dev/kvm", "/dev/kqemu", |
|
| 290 |
- "/dev/rtc", "/dev/hpet","/dev/net/tun", |
|
| 291 |
-] |
|
| 292 |
-EOF |
|
| 293 |
- fi |
|
| 294 |
- |
|
| 295 |
- if is_ubuntu; then |
|
| 296 |
- LIBVIRT_DAEMON=libvirt-bin |
|
| 297 |
- else |
|
| 298 |
- LIBVIRT_DAEMON=libvirtd |
|
| 299 |
- fi |
|
| 300 |
- |
|
| 301 |
- if is_fedora || is_suse; then |
|
| 302 |
- if is_fedora && [[ $DISTRO =~ (rhel6) || "$os_RELEASE" -le "17" ]]; then |
|
| 303 |
- sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla |
|
| 304 |
-[libvirt Management Access] |
|
| 305 |
-Identity=unix-group:$LIBVIRT_GROUP |
|
| 306 |
-Action=org.libvirt.unix.manage |
|
| 307 |
-ResultAny=yes |
|
| 308 |
-ResultInactive=yes |
|
| 309 |
-ResultActive=yes |
|
| 310 |
-EOF" |
|
| 311 |
- elif is_suse && [[ $os_RELEASE = 12.2 || "$os_VENDOR" = "SUSE LINUX" ]]; then |
|
| 312 |
- # openSUSE < 12.3 or SLE |
|
| 313 |
- # Work around the fact that polkit-default-privs overrules pklas |
|
| 314 |
- # with 'unix-group:$group'. |
|
| 315 |
- sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla |
|
| 316 |
-[libvirt Management Access] |
|
| 317 |
-Identity=unix-user:$USER |
|
| 318 |
-Action=org.libvirt.unix.manage |
|
| 319 |
-ResultAny=yes |
|
| 320 |
-ResultInactive=yes |
|
| 321 |
-ResultActive=yes |
|
| 322 |
-EOF" |
|
| 323 |
- else |
|
| 324 |
- # Starting with fedora 18 and opensuse-12.3 enable stack-user to |
|
| 325 |
- # virsh -c qemu:///system by creating a policy-kit rule for |
|
| 326 |
- # stack-user using the new Javascript syntax |
|
| 327 |
- rules_dir=/etc/polkit-1/rules.d |
|
| 328 |
- sudo mkdir -p $rules_dir |
|
| 329 |
- sudo bash -c "cat <<EOF > $rules_dir/50-libvirt-$STACK_USER.rules |
|
| 330 |
-polkit.addRule(function(action, subject) {
|
|
| 331 |
- if (action.id == 'org.libvirt.unix.manage' && |
|
| 332 |
- subject.user == '"$STACK_USER"') {
|
|
| 333 |
- return polkit.Result.YES; |
|
| 334 |
- } |
|
| 335 |
-}); |
|
| 336 |
-EOF" |
|
| 337 |
- unset rules_dir |
|
| 338 |
- fi |
|
| 339 |
- fi |
|
| 340 |
- |
|
| 341 |
- # The user that nova runs as needs to be member of **libvirtd** group otherwise |
|
| 342 |
- # nova-compute will be unable to use libvirt. |
|
| 343 |
- if ! getent group $LIBVIRT_GROUP >/dev/null; then |
|
| 344 |
- sudo groupadd $LIBVIRT_GROUP |
|
| 345 |
- fi |
|
| 346 |
- add_user_to_group $STACK_USER $LIBVIRT_GROUP |
|
| 347 |
- |
|
| 348 |
- # libvirt detects various settings on startup, as we potentially changed |
|
| 349 |
- # the system configuration (modules, filesystems), we need to restart |
|
| 350 |
- # libvirt to detect those changes. |
|
| 351 |
- restart_service $LIBVIRT_DAEMON |
|
| 352 |
- fi |
|
| 353 |
- |
|
| 354 | 277 |
# Instance Storage |
| 355 | 278 |
# ---------------- |
| 356 | 279 |
|
| ... | ... |
@@ -368,6 +292,14 @@ EOF" |
| 368 | 368 |
fi |
| 369 | 369 |
fi |
| 370 | 370 |
fi |
| 371 |
+ |
|
| 372 |
+ # Rebuild the config file from scratch |
|
| 373 |
+ create_nova_conf |
|
| 374 |
+ |
|
| 375 |
+ if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 376 |
+ # Configure hypervisor plugin |
|
| 377 |
+ configure_nova_hypervisor |
|
| 378 |
+ fi |
|
| 371 | 379 |
} |
| 372 | 380 |
|
| 373 | 381 |
# create_nova_accounts() - Set up common required nova accounts |
| ... | ... |
@@ -447,14 +379,6 @@ function create_nova_conf() {
|
| 447 | 447 |
iniset $NOVA_CONF DEFAULT ec2_workers "4" |
| 448 | 448 |
iniset $NOVA_CONF DEFAULT metadata_workers "4" |
| 449 | 449 |
iniset $NOVA_CONF DEFAULT sql_connection `database_connection_url nova` |
| 450 |
- if is_baremetal; then |
|
| 451 |
- iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm` |
|
| 452 |
- fi |
|
| 453 |
- if [[ "$VIRT_DRIVER" = 'libvirt' ]]; then |
|
| 454 |
- iniset $NOVA_CONF DEFAULT libvirt_type "$LIBVIRT_TYPE" |
|
| 455 |
- iniset $NOVA_CONF DEFAULT libvirt_cpu_mode "none" |
|
| 456 |
- iniset $NOVA_CONF DEFAULT use_usb_tablet "False" |
|
| 457 |
- fi |
|
| 458 | 450 |
iniset $NOVA_CONF DEFAULT instance_name_template "${INSTANCE_NAME_PREFIX}%08x"
|
| 459 | 451 |
iniset $NOVA_CONF osapi_v3 enabled "True" |
| 460 | 452 |
|
| ... | ... |
@@ -646,37 +570,8 @@ function install_novaclient() {
|
| 646 | 646 |
|
| 647 | 647 |
# install_nova() - Collect source and prepare |
| 648 | 648 |
function install_nova() {
|
| 649 |
- if is_service_enabled n-cpu; then |
|
| 650 |
- if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 651 |
- install_nova_hypervisor |
|
| 652 |
- elif [[ "$VIRT_DRIVER" = 'libvirt' ]]; then |
|
| 653 |
- if is_ubuntu; then |
|
| 654 |
- install_package kvm |
|
| 655 |
- install_package libvirt-bin |
|
| 656 |
- install_package python-libvirt |
|
| 657 |
- elif is_fedora || is_suse; then |
|
| 658 |
- install_package kvm |
|
| 659 |
- install_package libvirt |
|
| 660 |
- install_package libvirt-python |
|
| 661 |
- else |
|
| 662 |
- exit_distro_not_supported "libvirt installation" |
|
| 663 |
- fi |
|
| 664 |
- |
|
| 665 |
- # Install and configure **LXC** if specified. LXC is another approach to |
|
| 666 |
- # splitting a system into many smaller parts. LXC uses cgroups and chroot |
|
| 667 |
- # to simulate multiple systems. |
|
| 668 |
- if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
|
| 669 |
- if is_ubuntu; then |
|
| 670 |
- if [[ "$DISTRO" > natty ]]; then |
|
| 671 |
- install_package cgroup-lite |
|
| 672 |
- fi |
|
| 673 |
- else |
|
| 674 |
- ### FIXME(dtroyer): figure this out |
|
| 675 |
- echo "RPM-based cgroup not implemented yet" |
|
| 676 |
- yum_install libcgroup-tools |
|
| 677 |
- fi |
|
| 678 |
- fi |
|
| 679 |
- fi |
|
| 649 |
+ if is_service_enabled n-cpu && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 650 |
+ install_nova_hypervisor |
|
| 680 | 651 |
fi |
| 681 | 652 |
|
| 682 | 653 |
git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH |
| 683 | 654 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,93 @@ |
| 0 |
+# lib/nova_plugins/hypervisor-baremetal |
|
| 1 |
+# Configure the baremetal hypervisor |
|
| 2 |
+ |
|
| 3 |
+# Enable with: |
|
| 4 |
+# VIRT_DRIVER=baremetal |
|
| 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 |
+NETWORK_MANAGER=${NETWORK_MANAGER:-FlatManager}
|
|
| 25 |
+PUBLIC_INTERFACE_DEFAULT=eth0 |
|
| 26 |
+FLAT_INTERFACE=${FLAT_INTERFACE:-eth0}
|
|
| 27 |
+FLAT_NETWORK_BRIDGE_DEFAULT=br100 |
|
| 28 |
+STUB_NETWORK=${STUB_NETWORK:-False}
|
|
| 29 |
+ |
|
| 30 |
+ |
|
| 31 |
+# Entry Points |
|
| 32 |
+# ------------ |
|
| 33 |
+ |
|
| 34 |
+# clean_nova_hypervisor - Clean up an installation |
|
| 35 |
+function cleanup_nova_hypervisor() {
|
|
| 36 |
+ # This function intentionally left blank |
|
| 37 |
+ : |
|
| 38 |
+} |
|
| 39 |
+ |
|
| 40 |
+# configure_nova_hypervisor - Set config files, create data dirs, etc |
|
| 41 |
+function configure_nova_hypervisor() {
|
|
| 42 |
+ configure_baremetal_nova_dirs |
|
| 43 |
+ |
|
| 44 |
+ iniset $NOVA_CONF baremetal sql_connection `database_connection_url nova_bm` |
|
| 45 |
+ LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
|
|
| 46 |
+ iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver |
|
| 47 |
+ iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER |
|
| 48 |
+ iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager |
|
| 49 |
+ iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0 |
|
| 50 |
+ iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0 |
|
| 51 |
+ iniset $NOVA_CONF baremetal instance_type_extra_specs cpu_arch:$BM_CPU_ARCH |
|
| 52 |
+ iniset $NOVA_CONF baremetal driver $BM_DRIVER |
|
| 53 |
+ iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER |
|
| 54 |
+ iniset $NOVA_CONF baremetal tftp_root /tftpboot |
|
| 55 |
+ if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then |
|
| 56 |
+ BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf |
|
| 57 |
+ sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF" |
|
| 58 |
+ iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF" |
|
| 59 |
+ fi |
|
| 60 |
+ |
|
| 61 |
+ # Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``. |
|
| 62 |
+ for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do
|
|
| 63 |
+ # Attempt to convert flags to options |
|
| 64 |
+ iniset $NOVA_CONF baremetal ${I/=/ }
|
|
| 65 |
+ done |
|
| 66 |
+} |
|
| 67 |
+ |
|
| 68 |
+# install_nova_hypervisor() - Install external components |
|
| 69 |
+function install_nova_hypervisor() {
|
|
| 70 |
+ # This function intentionally left blank |
|
| 71 |
+ : |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+# start_nova_hypervisor - Start any required external services |
|
| 75 |
+function start_nova_hypervisor() {
|
|
| 76 |
+ # This function intentionally left blank |
|
| 77 |
+ : |
|
| 78 |
+} |
|
| 79 |
+ |
|
| 80 |
+# stop_nova_hypervisor - Stop any external services |
|
| 81 |
+function stop_nova_hypervisor() {
|
|
| 82 |
+ # This function intentionally left blank |
|
| 83 |
+ : |
|
| 84 |
+} |
|
| 85 |
+ |
|
| 86 |
+ |
|
| 87 |
+# Restore xtrace |
|
| 88 |
+$MY_XTRACE |
|
| 89 |
+ |
|
| 90 |
+# Local variables: |
|
| 91 |
+# mode: shell-script |
|
| 92 |
+# End: |
| 0 | 93 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,165 @@ |
| 0 |
+# lib/nova_plugins/hypervisor-libvirt |
|
| 1 |
+# Configure the libvirt hypervisor |
|
| 2 |
+ |
|
| 3 |
+# Enable with: |
|
| 4 |
+# VIRT_DRIVER=libvirt |
|
| 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 |
+ |
|
| 25 |
+# Entry Points |
|
| 26 |
+# ------------ |
|
| 27 |
+ |
|
| 28 |
+# clean_nova_hypervisor - Clean up an installation |
|
| 29 |
+function cleanup_nova_hypervisor() {
|
|
| 30 |
+ # This function intentionally left blank |
|
| 31 |
+ : |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+# configure_nova_hypervisor - Set config files, create data dirs, etc |
|
| 35 |
+function configure_nova_hypervisor() {
|
|
| 36 |
+ if is_service_enabled neutron && is_neutron_ovs_base_plugin && ! sudo grep -q '^cgroup_device_acl' $QEMU_CONF; then |
|
| 37 |
+ # Add /dev/net/tun to cgroup_device_acls, needed for type=ethernet interfaces |
|
| 38 |
+ cat <<EOF | sudo tee -a $QEMU_CONF |
|
| 39 |
+cgroup_device_acl = [ |
|
| 40 |
+ "/dev/null", "/dev/full", "/dev/zero", |
|
| 41 |
+ "/dev/random", "/dev/urandom", |
|
| 42 |
+ "/dev/ptmx", "/dev/kvm", "/dev/kqemu", |
|
| 43 |
+ "/dev/rtc", "/dev/hpet","/dev/net/tun", |
|
| 44 |
+] |
|
| 45 |
+EOF |
|
| 46 |
+ fi |
|
| 47 |
+ |
|
| 48 |
+ if is_ubuntu; then |
|
| 49 |
+ LIBVIRT_DAEMON=libvirt-bin |
|
| 50 |
+ else |
|
| 51 |
+ LIBVIRT_DAEMON=libvirtd |
|
| 52 |
+ fi |
|
| 53 |
+ |
|
| 54 |
+ if is_fedora || is_suse; then |
|
| 55 |
+ if is_fedora && [[ $DISTRO =~ (rhel6) || "$os_RELEASE" -le "17" ]]; then |
|
| 56 |
+ sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla |
|
| 57 |
+[libvirt Management Access] |
|
| 58 |
+Identity=unix-group:$LIBVIRT_GROUP |
|
| 59 |
+Action=org.libvirt.unix.manage |
|
| 60 |
+ResultAny=yes |
|
| 61 |
+ResultInactive=yes |
|
| 62 |
+ResultActive=yes |
|
| 63 |
+EOF" |
|
| 64 |
+ elif is_suse && [[ $os_RELEASE = 12.2 || "$os_VENDOR" = "SUSE LINUX" ]]; then |
|
| 65 |
+ # openSUSE < 12.3 or SLE |
|
| 66 |
+ # Work around the fact that polkit-default-privs overrules pklas |
|
| 67 |
+ # with 'unix-group:$group'. |
|
| 68 |
+ sudo bash -c "cat <<EOF >/etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla |
|
| 69 |
+[libvirt Management Access] |
|
| 70 |
+Identity=unix-user:$USER |
|
| 71 |
+Action=org.libvirt.unix.manage |
|
| 72 |
+ResultAny=yes |
|
| 73 |
+ResultInactive=yes |
|
| 74 |
+ResultActive=yes |
|
| 75 |
+EOF" |
|
| 76 |
+ else |
|
| 77 |
+ # Starting with fedora 18 and opensuse-12.3 enable stack-user to |
|
| 78 |
+ # virsh -c qemu:///system by creating a policy-kit rule for |
|
| 79 |
+ # stack-user using the new Javascript syntax |
|
| 80 |
+ rules_dir=/etc/polkit-1/rules.d |
|
| 81 |
+ sudo mkdir -p $rules_dir |
|
| 82 |
+ sudo bash -c "cat <<EOF > $rules_dir/50-libvirt-$STACK_USER.rules |
|
| 83 |
+polkit.addRule(function(action, subject) {
|
|
| 84 |
+ if (action.id == 'org.libvirt.unix.manage' && |
|
| 85 |
+ subject.user == '"$STACK_USER"') {
|
|
| 86 |
+ return polkit.Result.YES; |
|
| 87 |
+ } |
|
| 88 |
+}); |
|
| 89 |
+EOF" |
|
| 90 |
+ unset rules_dir |
|
| 91 |
+ fi |
|
| 92 |
+ fi |
|
| 93 |
+ |
|
| 94 |
+ # The user that nova runs as needs to be member of **libvirtd** group otherwise |
|
| 95 |
+ # nova-compute will be unable to use libvirt. |
|
| 96 |
+ if ! getent group $LIBVIRT_GROUP >/dev/null; then |
|
| 97 |
+ sudo groupadd $LIBVIRT_GROUP |
|
| 98 |
+ fi |
|
| 99 |
+ add_user_to_group $STACK_USER $LIBVIRT_GROUP |
|
| 100 |
+ |
|
| 101 |
+ # libvirt detects various settings on startup, as we potentially changed |
|
| 102 |
+ # the system configuration (modules, filesystems), we need to restart |
|
| 103 |
+ # libvirt to detect those changes. |
|
| 104 |
+ restart_service $LIBVIRT_DAEMON |
|
| 105 |
+ |
|
| 106 |
+ iniset $NOVA_CONF DEFAULT libvirt_type "$LIBVIRT_TYPE" |
|
| 107 |
+ iniset $NOVA_CONF DEFAULT libvirt_cpu_mode "none" |
|
| 108 |
+ iniset $NOVA_CONF DEFAULT use_usb_tablet "False" |
|
| 109 |
+ iniset $NOVA_CONF DEFAULT compute_driver "libvirt.LibvirtDriver" |
|
| 110 |
+ LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
|
|
| 111 |
+ iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
|
| 112 |
+ # Power architecture currently does not support graphical consoles. |
|
| 113 |
+ if is_arch "ppc64"; then |
|
| 114 |
+ iniset $NOVA_CONF DEFAULT vnc_enabled "false" |
|
| 115 |
+ fi |
|
| 116 |
+} |
|
| 117 |
+ |
|
| 118 |
+# install_nova_hypervisor() - Install external components |
|
| 119 |
+function install_nova_hypervisor() {
|
|
| 120 |
+ if is_ubuntu; then |
|
| 121 |
+ install_package kvm |
|
| 122 |
+ install_package libvirt-bin |
|
| 123 |
+ install_package python-libvirt |
|
| 124 |
+ elif is_fedora || is_suse; then |
|
| 125 |
+ install_package kvm |
|
| 126 |
+ install_package libvirt |
|
| 127 |
+ install_package libvirt-python |
|
| 128 |
+ fi |
|
| 129 |
+ |
|
| 130 |
+ # Install and configure **LXC** if specified. LXC is another approach to |
|
| 131 |
+ # splitting a system into many smaller parts. LXC uses cgroups and chroot |
|
| 132 |
+ # to simulate multiple systems. |
|
| 133 |
+ if [[ "$LIBVIRT_TYPE" == "lxc" ]]; then |
|
| 134 |
+ if is_ubuntu; then |
|
| 135 |
+ if [[ "$DISTRO" > natty ]]; then |
|
| 136 |
+ install_package cgroup-lite |
|
| 137 |
+ fi |
|
| 138 |
+ else |
|
| 139 |
+ ### FIXME(dtroyer): figure this out |
|
| 140 |
+ echo "RPM-based cgroup not implemented yet" |
|
| 141 |
+ yum_install libcgroup-tools |
|
| 142 |
+ fi |
|
| 143 |
+ fi |
|
| 144 |
+} |
|
| 145 |
+ |
|
| 146 |
+# start_nova_hypervisor - Start any required external services |
|
| 147 |
+function start_nova_hypervisor() {
|
|
| 148 |
+ # This function intentionally left blank |
|
| 149 |
+ : |
|
| 150 |
+} |
|
| 151 |
+ |
|
| 152 |
+# stop_nova_hypervisor - Stop any external services |
|
| 153 |
+function stop_nova_hypervisor() {
|
|
| 154 |
+ # This function intentionally left blank |
|
| 155 |
+ : |
|
| 156 |
+} |
|
| 157 |
+ |
|
| 158 |
+ |
|
| 159 |
+# Restore xtrace |
|
| 160 |
+$MY_XTRACE |
|
| 161 |
+ |
|
| 162 |
+# Local variables: |
|
| 163 |
+# mode: shell-script |
|
| 164 |
+# End: |
| 0 | 165 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,67 @@ |
| 0 |
+# lib/nova_plugins/hypervisor-openvz |
|
| 1 |
+# Configure the openvz hypervisor |
|
| 2 |
+ |
|
| 3 |
+# Enable with: |
|
| 4 |
+# VIRT_DRIVER=openvz |
|
| 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 |
+ |
|
| 25 |
+# Entry Points |
|
| 26 |
+# ------------ |
|
| 27 |
+ |
|
| 28 |
+# clean_nova_hypervisor - Clean up an installation |
|
| 29 |
+function cleanup_nova_hypervisor() {
|
|
| 30 |
+ # This function intentionally left blank |
|
| 31 |
+ : |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+# configure_nova_hypervisor - Set config files, create data dirs, etc |
|
| 35 |
+function configure_nova_hypervisor() {
|
|
| 36 |
+ iniset $NOVA_CONF DEFAULT compute_driver "openvz.OpenVzDriver" |
|
| 37 |
+ iniset $NOVA_CONF DEFAULT connection_type "openvz" |
|
| 38 |
+ LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
|
|
| 39 |
+ iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
|
| 40 |
+} |
|
| 41 |
+ |
|
| 42 |
+# install_nova_hypervisor() - Install external components |
|
| 43 |
+function install_nova_hypervisor() {
|
|
| 44 |
+ # This function intentionally left blank |
|
| 45 |
+ : |
|
| 46 |
+} |
|
| 47 |
+ |
|
| 48 |
+# start_nova_hypervisor - Start any required external services |
|
| 49 |
+function start_nova_hypervisor() {
|
|
| 50 |
+ # This function intentionally left blank |
|
| 51 |
+ : |
|
| 52 |
+} |
|
| 53 |
+ |
|
| 54 |
+# stop_nova_hypervisor - Stop any external services |
|
| 55 |
+function stop_nova_hypervisor() {
|
|
| 56 |
+ # This function intentionally left blank |
|
| 57 |
+ : |
|
| 58 |
+} |
|
| 59 |
+ |
|
| 60 |
+ |
|
| 61 |
+# Restore xtrace |
|
| 62 |
+$MY_XTRACE |
|
| 63 |
+ |
|
| 64 |
+# Local variables: |
|
| 65 |
+# mode: shell-script |
|
| 66 |
+# End: |
| 0 | 67 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,76 @@ |
| 0 |
+# lib/nova_plugins/hypervisor-powervm |
|
| 1 |
+# Configure the PowerVM hypervisor |
|
| 2 |
+ |
|
| 3 |
+# Enable with: |
|
| 4 |
+# VIRT_DRIVER=powervm |
|
| 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 |
+ |
|
| 25 |
+# Entry Points |
|
| 26 |
+# ------------ |
|
| 27 |
+ |
|
| 28 |
+# clean_nova_hypervisor - Clean up an installation |
|
| 29 |
+function cleanup_nova_hypervisor() {
|
|
| 30 |
+ # This function intentionally left blank |
|
| 31 |
+ : |
|
| 32 |
+} |
|
| 33 |
+ |
|
| 34 |
+# configure_nova_hypervisor - Set config files, create data dirs, etc |
|
| 35 |
+function configure_nova_hypervisor() {
|
|
| 36 |
+ POWERVM_MGR_TYPE=${POWERVM_MGR_TYPE:-"ivm"}
|
|
| 37 |
+ POWERVM_MGR_HOST=${POWERVM_MGR_HOST:-"powervm.host"}
|
|
| 38 |
+ POWERVM_MGR_USER=${POWERVM_MGR_USER:-"padmin"}
|
|
| 39 |
+ POWERVM_MGR_PASSWD=${POWERVM_MGR_PASSWD:-"password"}
|
|
| 40 |
+ POWERVM_IMG_REMOTE_PATH=${POWERVM_IMG_REMOTE_PATH:-"/tmp"}
|
|
| 41 |
+ POWERVM_IMG_LOCAL_PATH=${POWERVM_IMG_LOCAL_PATH:-"/tmp"}
|
|
| 42 |
+ iniset $NOVA_CONF DEFAULT compute_driver nova.virt.powervm.PowerVMDriver |
|
| 43 |
+ iniset $NOVA_CONF DEFAULT powervm_mgr_type $POWERVM_MGR_TYPE |
|
| 44 |
+ iniset $NOVA_CONF DEFAULT powervm_mgr $POWERVM_MGR_HOST |
|
| 45 |
+ iniset $NOVA_CONF DEFAULT powervm_mgr_user $POWERVM_MGR_USER |
|
| 46 |
+ iniset $NOVA_CONF DEFAULT powervm_mgr_passwd $POWERVM_MGR_PASSWD |
|
| 47 |
+ iniset $NOVA_CONF DEFAULT powervm_img_remote_path $POWERVM_IMG_REMOTE_PATH |
|
| 48 |
+ iniset $NOVA_CONF DEFAULT powervm_img_local_path $POWERVM_IMG_LOCAL_PATH |
|
| 49 |
+} |
|
| 50 |
+ |
|
| 51 |
+# install_nova_hypervisor() - Install external components |
|
| 52 |
+function install_nova_hypervisor() {
|
|
| 53 |
+ # This function intentionally left blank |
|
| 54 |
+ : |
|
| 55 |
+} |
|
| 56 |
+ |
|
| 57 |
+# start_nova_hypervisor - Start any required external services |
|
| 58 |
+function start_nova_hypervisor() {
|
|
| 59 |
+ # This function intentionally left blank |
|
| 60 |
+ : |
|
| 61 |
+} |
|
| 62 |
+ |
|
| 63 |
+# stop_nova_hypervisor - Stop any external services |
|
| 64 |
+function stop_nova_hypervisor() {
|
|
| 65 |
+ # This function intentionally left blank |
|
| 66 |
+ : |
|
| 67 |
+} |
|
| 68 |
+ |
|
| 69 |
+ |
|
| 70 |
+# Restore xtrace |
|
| 71 |
+$MY_XTRACE |
|
| 72 |
+ |
|
| 73 |
+# Local variables: |
|
| 74 |
+# mode: shell-script |
|
| 75 |
+# End: |
| ... | ... |
@@ -313,13 +313,6 @@ source $TOP_DIR/lib/ldap |
| 313 | 313 |
source $TOP_DIR/lib/ironic |
| 314 | 314 |
source $TOP_DIR/lib/trove |
| 315 | 315 |
|
| 316 |
-# Look for Nova hypervisor plugin |
|
| 317 |
-NOVA_PLUGINS=$TOP_DIR/lib/nova_plugins |
|
| 318 |
-if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 319 |
- # Load plugin |
|
| 320 |
- source $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER |
|
| 321 |
-fi |
|
| 322 |
- |
|
| 323 | 316 |
# Set the destination directories for other OpenStack projects |
| 324 | 317 |
OPENSTACKCLIENT_DIR=$DEST/python-openstackclient |
| 325 | 318 |
|
| ... | ... |
@@ -907,6 +900,7 @@ if is_service_enabled g-reg; then |
| 907 | 907 |
init_glance |
| 908 | 908 |
fi |
| 909 | 909 |
|
| 910 |
+ |
|
| 910 | 911 |
# Ironic |
| 911 | 912 |
# ------ |
| 912 | 913 |
|
| ... | ... |
@@ -916,7 +910,6 @@ if is_service_enabled ir-api ir-cond; then |
| 916 | 916 |
fi |
| 917 | 917 |
|
| 918 | 918 |
|
| 919 |
- |
|
| 920 | 919 |
# Neutron |
| 921 | 920 |
# ------- |
| 922 | 921 |
|
| ... | ... |
@@ -942,11 +935,6 @@ fi |
| 942 | 942 |
# Nova |
| 943 | 943 |
# ---- |
| 944 | 944 |
|
| 945 |
-if is_service_enabled nova; then |
|
| 946 |
- echo_summary "Configuring Nova" |
|
| 947 |
- configure_nova |
|
| 948 |
-fi |
|
| 949 |
- |
|
| 950 | 945 |
if is_service_enabled n-net q-dhcp; then |
| 951 | 946 |
# Delete traces of nova networks from prior runs |
| 952 | 947 |
# Do not kill any dnsmasq instance spawned by NetworkManager |
| ... | ... |
@@ -989,8 +977,6 @@ fi |
| 989 | 989 |
|
| 990 | 990 |
if is_service_enabled nova; then |
| 991 | 991 |
echo_summary "Configuring Nova" |
| 992 |
- # Rebuild the config file from scratch |
|
| 993 |
- create_nova_conf |
|
| 994 | 992 |
init_nova |
| 995 | 993 |
|
| 996 | 994 |
# Additional Nova configuration that is dependent on other services |
| ... | ... |
@@ -1000,85 +986,6 @@ if is_service_enabled nova; then |
| 1000 | 1000 |
create_nova_conf_nova_network |
| 1001 | 1001 |
fi |
| 1002 | 1002 |
|
| 1003 |
- |
|
| 1004 |
- if [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then |
|
| 1005 |
- # Configure hypervisor plugin |
|
| 1006 |
- configure_nova_hypervisor |
|
| 1007 |
- |
|
| 1008 |
- |
|
| 1009 |
- # OpenVZ |
|
| 1010 |
- # ------ |
|
| 1011 |
- |
|
| 1012 |
- elif [ "$VIRT_DRIVER" = 'openvz' ]; then |
|
| 1013 |
- echo_summary "Using OpenVZ virtualization driver" |
|
| 1014 |
- iniset $NOVA_CONF DEFAULT compute_driver "openvz.OpenVzDriver" |
|
| 1015 |
- iniset $NOVA_CONF DEFAULT connection_type "openvz" |
|
| 1016 |
- LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
|
|
| 1017 |
- iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
|
| 1018 |
- |
|
| 1019 |
- |
|
| 1020 |
- # Bare Metal |
|
| 1021 |
- # ---------- |
|
| 1022 |
- |
|
| 1023 |
- elif [ "$VIRT_DRIVER" = 'baremetal' ]; then |
|
| 1024 |
- echo_summary "Using BareMetal driver" |
|
| 1025 |
- LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.firewall.NoopFirewallDriver"}
|
|
| 1026 |
- iniset $NOVA_CONF DEFAULT compute_driver nova.virt.baremetal.driver.BareMetalDriver |
|
| 1027 |
- iniset $NOVA_CONF DEFAULT firewall_driver $LIBVIRT_FIREWALL_DRIVER |
|
| 1028 |
- iniset $NOVA_CONF DEFAULT scheduler_host_manager nova.scheduler.baremetal_host_manager.BaremetalHostManager |
|
| 1029 |
- iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0 |
|
| 1030 |
- iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 0 |
|
| 1031 |
- iniset $NOVA_CONF baremetal instance_type_extra_specs cpu_arch:$BM_CPU_ARCH |
|
| 1032 |
- iniset $NOVA_CONF baremetal driver $BM_DRIVER |
|
| 1033 |
- iniset $NOVA_CONF baremetal power_manager $BM_POWER_MANAGER |
|
| 1034 |
- iniset $NOVA_CONF baremetal tftp_root /tftpboot |
|
| 1035 |
- if [[ "$BM_DNSMASQ_FROM_NOVA_NETWORK" = "True" ]]; then |
|
| 1036 |
- BM_DNSMASQ_CONF=$NOVA_CONF_DIR/dnsmasq-for-baremetal-from-nova-network.conf |
|
| 1037 |
- sudo cp "$FILES/dnsmasq-for-baremetal-from-nova-network.conf" "$BM_DNSMASQ_CONF" |
|
| 1038 |
- iniset $NOVA_CONF DEFAULT dnsmasq_config_file "$BM_DNSMASQ_CONF" |
|
| 1039 |
- fi |
|
| 1040 |
- |
|
| 1041 |
- # Define extra baremetal nova conf flags by defining the array ``EXTRA_BAREMETAL_OPTS``. |
|
| 1042 |
- for I in "${EXTRA_BAREMETAL_OPTS[@]}"; do
|
|
| 1043 |
- # Attempt to convert flags to options |
|
| 1044 |
- iniset $NOVA_CONF baremetal ${I/=/ }
|
|
| 1045 |
- done |
|
| 1046 |
- |
|
| 1047 |
- |
|
| 1048 |
- # PowerVM |
|
| 1049 |
- # ------- |
|
| 1050 |
- |
|
| 1051 |
- elif [ "$VIRT_DRIVER" = 'powervm' ]; then |
|
| 1052 |
- echo_summary "Using PowerVM driver" |
|
| 1053 |
- POWERVM_MGR_TYPE=${POWERVM_MGR_TYPE:-"ivm"}
|
|
| 1054 |
- POWERVM_MGR_HOST=${POWERVM_MGR_HOST:-"powervm.host"}
|
|
| 1055 |
- POWERVM_MGR_USER=${POWERVM_MGR_USER:-"padmin"}
|
|
| 1056 |
- POWERVM_MGR_PASSWD=${POWERVM_MGR_PASSWD:-"password"}
|
|
| 1057 |
- POWERVM_IMG_REMOTE_PATH=${POWERVM_IMG_REMOTE_PATH:-"/tmp"}
|
|
| 1058 |
- POWERVM_IMG_LOCAL_PATH=${POWERVM_IMG_LOCAL_PATH:-"/tmp"}
|
|
| 1059 |
- iniset $NOVA_CONF DEFAULT compute_driver nova.virt.powervm.PowerVMDriver |
|
| 1060 |
- iniset $NOVA_CONF DEFAULT powervm_mgr_type $POWERVM_MGR_TYPE |
|
| 1061 |
- iniset $NOVA_CONF DEFAULT powervm_mgr $POWERVM_MGR_HOST |
|
| 1062 |
- iniset $NOVA_CONF DEFAULT powervm_mgr_user $POWERVM_MGR_USER |
|
| 1063 |
- iniset $NOVA_CONF DEFAULT powervm_mgr_passwd $POWERVM_MGR_PASSWD |
|
| 1064 |
- iniset $NOVA_CONF DEFAULT powervm_img_remote_path $POWERVM_IMG_REMOTE_PATH |
|
| 1065 |
- iniset $NOVA_CONF DEFAULT powervm_img_local_path $POWERVM_IMG_LOCAL_PATH |
|
| 1066 |
- |
|
| 1067 |
- |
|
| 1068 |
- # Default libvirt |
|
| 1069 |
- # --------------- |
|
| 1070 |
- |
|
| 1071 |
- else |
|
| 1072 |
- echo_summary "Using libvirt virtualization driver" |
|
| 1073 |
- iniset $NOVA_CONF DEFAULT compute_driver "libvirt.LibvirtDriver" |
|
| 1074 |
- LIBVIRT_FIREWALL_DRIVER=${LIBVIRT_FIREWALL_DRIVER:-"nova.virt.libvirt.firewall.IptablesFirewallDriver"}
|
|
| 1075 |
- iniset $NOVA_CONF DEFAULT firewall_driver "$LIBVIRT_FIREWALL_DRIVER" |
|
| 1076 |
- # Power architecture currently does not support graphical consoles. |
|
| 1077 |
- if is_arch "ppc64"; then |
|
| 1078 |
- iniset $NOVA_CONF DEFAULT vnc_enabled "false" |
|
| 1079 |
- fi |
|
| 1080 |
- fi |
|
| 1081 |
- |
|
| 1082 | 1003 |
init_nova_cells |
| 1083 | 1004 |
fi |
| 1084 | 1005 |
|