XenServer patch

As OpenStack + XenServer deployment is not that common as KVM. This
patch contains class parameters update and all parameters to
allow configure OpenStack with XenServer more easily. It covers
parameters needed for non-DHCP network deployment with flat network
config injection (same as Rackspace).

Deployment guides for OpenStack + XenServer can be found here:

https://www.citrix.com/blogs/2015/11/30/integrating-xenserver-rdo-and-neutron/
http://openstack-xenserver.readthedocs.io/en/latest/

Change-Id: Ib8185f6dcd6153473e820973049f234f7f7d3cfd
This commit is contained in:
vanditboy 2016-07-05 23:14:16 +01:00 committed by Michal Adamczyk
parent bfeff3257c
commit dbe5dbdfc4
3 changed files with 446 additions and 18 deletions

View File

@ -4,29 +4,295 @@
#
# === Parameters:
#
# [*xenapi_connection_url*]
# [*connection_url*]
# (required) URL for connection to XenServer/Xen Cloud Platform.
#
# [*xenapi_connection_username*]
# [*connection_username*]
# (required) Username for connection to XenServer/Xen Cloud Platform
#
# [*xenapi_connection_password*]
# [*connection_password*]
# (required) Password for connection to XenServer/Xen Cloud Platform
#
# [*compute_driver*]
# (optional) Compute driver.
# Defaults to 'xenapi.XenAPIDriver'
#
# [*ovs_integration_bridge*]
# (optional) Name of Integration Bridge used by Open vSwitch (string value)
# Defaults to $::os_service_default
#
# [*agent_timeout*]
# (optional) Number of seconds to wait for agent reply (integer value)
# Defaults to $::os_service_default
#
# [*agent_version_timeout*]
# (optional) Number of seconds to wait for agent to be fully operational (integer value)
# Defaults to $::os_service_default
#
# [*agent_resetnetwork_timeout*]
# (optional) Number of seconds to wait for agent reply to resetnetwork request (integer value)
# Defaults to $::os_service_default
#
# [*agent_path*]
# (optional) Specifies the path in which the XenAPI guest agent should be located. If the
# agent is present, network configuration is not injected into the image. Used
# if compute_driver=xenapi.XenAPIDriver and flat_injected=True (string value)
# Defaults to $::os_service_default
#
# [*disable_agent*]
# (optional) Disables the use of the XenAPI agent in any image regardless of what image
# properties are present (boolean value).
# Defaults to $::os_service_default
#
# [*use_agent_default*]
# (optional) Determines if the XenAPI agent should be used when the image used does not
# contain a hint to declare if the agent is present or not. The hint is a
# glance property "xenapi_use_agent" that has the value "True" or "False". Note
# that waiting for the agent when it is not present will significantly increase
# server boot times. (boolean value)
# Defaults to $::os_service_default
#
# [*login_timeout*]
# (optional) Timeout in seconds for XenAPI login. (integer value)
# Defaults to $::os_service_default
#
# [*connection_concurrent*]
# {optional} Maximum number of concurrent XenAPI connections.
# Defaults to $::os_service_default
#
# [*vhd_coalesce_poll_interval*]
# (optional) The interval used for polling of coalescing vhds. (floating point value)
# Defaults to $::os_service_default
#
# [*check_host*]
# (optional) Ensure compute service is running on host XenAPI connects to. (boolean value)
# Defaults to $::os_service_default
#
# [*vhd_coalesce_max_attempts*]
# (optional) Max number of times to poll for VHD to coalesce.
# Defaults to $::os_service_default
#
# [*sr_base_path*]
# (optional) Base path to the storage repository (string value)
# Defaults to $::os_service_default
#
# [*target_host*]
# (optional) The iSCSI Target Host (string value)
# Defaults to $::os_service_default
#
# [*target_port*]
# (optional) The iSCSI Target Port, default is port 3260 (string value)
# Defaults to $::os_service_default
#
# [*iqn_prefix*]
# (optional) IQN Prefix (string value)
# Defaults to $::os_service_default
#
# [*remap_vbd_dev*]
# (optional) Used to enable the remapping of VBD dev (Works around an issue in Ubuntu
# Maverick) (boolean value)
# Defaults to $::os_service_default
#
# [*remap_vbd_dev_prefix*]
# (optional) Specify prefix to remap VBD dev to (ex. /dev/xvdb -> /dev/sdb) (string value)
# Defaults to $::os_service_default
#
# [*torrent_base_url*]
# (optional) Base URL for torrent files; must contain a slash character (see RFC 1808,
# step 6) (string value)
# Defaults to $::os_service_default
#
# [*torrent_seed_chance*]
# (optional) Probability that peer will become a seeder. (1.0 = 100%) (floating poin value)
# Defaults to $::os_service_default
#
# [*torrent_seed_duration*]
# (optional) Number of seconds after downloading an image via BitTorrent that it should be
# seeded for other peers. (integer value)
# Defaults to $::os_service_default
#
# [*torrent_max_last_accessed*]
# (optional) Cached torrent files not accessed within this number of seconds can be reaped
# (integer value)
# Defaults to $::os_service_default
#
# [*torrent_listen_port_start*]
# (optional) Beginning of port range to listen on (integer value)
# Minimum value: 1
# Maximum value: 65535
# Defaults to $::os_service_default
#
# [*torrent_listen_port_end*]
# (optional) End of port range to listen on (integer value)
# Minimum value: 1
# Maximum value: 65535
# Defaults to $::os_service_default
#
# [*torrent_download_stall_cutoff*]
# (optional) Number of seconds a download can remain at the same progress percentage w/o
# being considered a stall (integer value)
# Defaults to $::os_service_default
#
# [*torrent_max_seeder_processes_per_host*]
# (optional) Maximum number of seeder processes to run concurrently within a given dom0.
# (-1 = no limit) (integer value)
# Defaults to $::os_service_default
#
# [*use_join_force*]
# (optional) To use for hosts with different CPUs (boolean value)
# Defaults to $::os_service_default
#
# [*cache_images*]
# (optional) Cache glance images locally. `all` will cache all images, `some` will only
# cache images that have the image_property `cache_in_nova=True`, and `none`
# turns off caching entirely (string value)
# Allowed values: all, some, none
# Defaults to $::os_service_default
#
# [*image_compression_level*]
# (optional) Compression level for images, e.g., 9 for gzip -9. Range is 1-9, 9 being most
# compressed but most CPU intensive on dom0. (integer value)
# Minimum value: 1
# Maximum value: 9
# Defaults to $::os_service_default
#
# [*default_os_type*]
# (optional) Default OS type (string value)
# Defaults to $::os_service_default
#
# [*block_device_creation_timeout*]
# (optional) Time to wait for a block device to be created (integer value)
# Defaults to $::os_service_default
#
# [*max_kernel_ramdisk_size*]
# (optional) Maximum size in bytes of kernel or ramdisk images (integer value)
# Defaults to $::os_service_default
#
# [*sr_matching_filter*]
# (optional) Filter for finding the SR to be used to install guest instances on. To use
# the Local Storage in default XenServer/XCP installations set this flag to
# other-config:i18n-key=local-storage. To select an SR with a different
# matching criteria, you could set it to other-config:my_favorite_sr=true. On
# the other hand, to fall back on the Default SR, as displayed by XenCenter,
# set this flag to: default-sr:true (string value)
# Defaults to $::os_service_default
#
# [*sparse_copy*]
# (optional) Whether to use sparse_copy for copying data on a resize down (False will use
# standard dd). This speeds up resizes down considerably since large runs of
# zeros won't have to be rsynced (boolean value)
# Defaults to $::os_service_default
#
# [*num_vbd_unplug_retries*]
# (optional) Maximum number of retries to unplug VBD. if <=0, should try once and no retry
# (integer value)
# Defaults to $::os_service_default
#
# [*torrent_images*]
# (optional) Whether or not to download images via Bit Torrent. (string value)
# Allowed values: all, some, none
# Defaults to $::os_service_default
#
# [*ipxe_network_name*]
# (optional) Name of network to use for booting iPXE ISOs (string value)
# Defaults to $::os_service_default
#
# [*ipxe_boot_menu_url*]
# (optional) URL to the iPXE boot menu (string value)
# Defaults to $::os_service_default
#
# [*ipxe_mkisofs_cmd*]
# (optional) Name and optionally path of the tool used for ISO image creation (string
# value)
# Defaults to $::os_service_default
#
# [*running_timeout*]
# (optional) Number of seconds to wait for instance to go to running state (integer value)
# Defaults to $::os_service_default
#
# [*vif_driver*]
# (optional) The XenAPI VIF driver using XenServer Network APIs. (string value)
# Defaults to $::os_service_default
#
# [*image_upload_handler*]
# (optional) Dom0 plugin driver used to handle image uploads. (string value)
# Defaults to $::os_service_default
#
# [*introduce_vdi_retry_wait*]
# (optional) Number of seconds to wait for an SR to settle if the VDI does not exist when
# first introduced (integer value)
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS
#
# [*xenapi_inject_image*]
# (optional) DEPRECATED: This parameter does nothing.
#
# [*xenapi_connection_url*]
# (optional) DEPRECATED: URL for connection to XenServer/Xen Cloud Platform.
# Please use connection_url parameter.
#
# [*xenapi_connection_username*]
# (optional) DEPRECATED: Username for connection to XenServer/Xen Cloud Platform
# Please use connection_username parameter.
#
# [*xenapi_connection_password*]
# (optional) DEPRECATED: Password for connection to XenServer/Xen Cloud Platform.
# Please use connection_password parameter.
#
class nova::compute::xenserver(
$xenapi_connection_url,
$xenapi_connection_username,
$xenapi_connection_password,
$compute_driver = 'xenapi.XenAPIDriver',
$connection_url,
$connection_username,
$connection_password,
$compute_driver = 'xenapi.XenAPIDriver',
$ovs_integration_bridge = $::os_service_default,
$agent_timeout = $::os_service_default,
$agent_version_timeout = $::os_service_default,
$agent_resetnetwork_timeout = $::os_service_default,
$agent_path = $::os_service_default,
$disable_agent = $::os_service_default,
$use_agent_default = $::os_service_default,
$login_timeout = $::os_service_default,
$connection_concurrent = $::os_service_default,
$vhd_coalesce_poll_interval = $::os_service_default,
$check_host = $::os_service_default,
$vhd_coalesce_max_attempts = $::os_service_default,
$sr_base_path = $::os_service_default,
$target_host = $::os_service_default,
$target_port = $::os_service_default,
$iqn_prefix = $::os_service_default,
$remap_vbd_dev = $::os_service_default,
$remap_vbd_dev_prefix = $::os_service_default,
$torrent_base_url = $::os_service_default,
$torrent_seed_chance = $::os_service_default,
$torrent_seed_duration = $::os_service_default,
$torrent_max_last_accessed = $::os_service_default,
$torrent_listen_port_start = $::os_service_default,
$torrent_listen_port_end = $::os_service_default,
$torrent_download_stall_cutoff = $::os_service_default,
$torrent_max_seeder_processes_per_host = $::os_service_default,
$use_join_force = $::os_service_default,
$cache_images = $::os_service_default,
$image_compression_level = $::os_service_default,
$default_os_type = $::os_service_default,
$block_device_creation_timeout = $::os_service_default,
$max_kernel_ramdisk_size = $::os_service_default,
$sr_matching_filter = $::os_service_default,
$sparse_copy = $::os_service_default,
$num_vbd_unplug_retries = $::os_service_default,
$torrent_images = $::os_service_default,
$ipxe_network_name = $::os_service_default,
$ipxe_boot_menu_url = $::os_service_default,
$ipxe_mkisofs_cmd = $::os_service_default,
$running_timeout = $::os_service_default,
$vif_driver = 'nova.virt.xenapi.vif.XenAPIOpenVswitchDriver',
$image_upload_handler = $::os_service_default,
$introduce_vdi_retry_wait = $::os_service_default,
# DEPRECATED PARAMETERS
$xenapi_inject_image = undef,
$xenapi_inject_image = undef,
$xenapi_connection_url = undef,
$xenapi_connection_username = undef,
$xenapi_connection_password = undef,
) {
include ::nova::deps
@ -35,11 +301,67 @@ class nova::compute::xenserver(
warning('The xenapi_inject_image parameter is deprecated and has no effect.')
}
if $xenapi_connection_url {
warning('The xenapi_connection_url parameter is deprecated and has no effect, please use connection_url.')
}
if $xenapi_connection_username {
warning('The xenapi_connection_username parameter is deprecated and has no effect, please use connection_username.')
}
if $xenapi_connection_password {
warning('The xenapi_connection_password parameter is deprecated and has no effect, please use connection_password.')
}
nova_config {
'DEFAULT/compute_driver': value => $compute_driver;
'DEFAULT/xenapi_connection_url': value => $xenapi_connection_url;
'DEFAULT/xenapi_connection_username': value => $xenapi_connection_username;
'DEFAULT/xenapi_connection_password': value => $xenapi_connection_password;
'DEFAULT/compute_driver': value => $compute_driver;
'xenserver/connection_url': value => $connection_url;
'xenserver/connection_username': value => $connection_username;
'xenserver/connection_password': value => $connection_password;
'xenserver/ovs_integration_bridge': value => $ovs_integration_bridge;
'xenserver/agent_timeout': value => $agent_timeout;
'xenserver/agent_version_timeout': value => $agent_version_timeout;
'xenserver/agent_resetnetwork_timeout': value => $agent_resetnetwork_timeout;
'xenserver/agent_path': value => $agent_path;
'xenserver/disable_agent': value => $disable_agent;
'xenserver/use_agent_default': value => $use_agent_default;
'xenserver/login_timeout': value => $login_timeout;
'xenserver/connection_concurrent': value => $connection_concurrent;
'xenserver/vhd_coalesce_poll_interval': value => $vhd_coalesce_poll_interval;
'xenserver/check_host': value => $check_host;
'xenserver/vhd_coalesce_max_attempts': value => $vhd_coalesce_max_attempts;
'xenserver/sr_base_path': value => $sr_base_path;
'xenserver/target_host': value => $target_host;
'xenserver/target_port': value => $target_port;
'xenserver/iqn_prefix': value => $iqn_prefix;
'xenserver/remap_vbd_dev': value => $remap_vbd_dev;
'xenserver/remap_vbd_dev_prefix': value => $remap_vbd_dev_prefix;
'xenserver/torrent_base_url': value => $torrent_base_url;
'xenserver/torrent_seed_chance': value => $torrent_seed_chance;
'xenserver/torrent_seed_duration': value => $torrent_seed_duration;
'xenserver/torrent_max_last_accessed': value => $torrent_max_last_accessed;
'xenserver/torrent_listen_port_start': value => $torrent_listen_port_start;
'xenserver/torrent_listen_port_end': value => $torrent_listen_port_end;
'xenserver/torrent_download_stall_cutoff': value => $torrent_download_stall_cutoff;
'xenserver/torrent_max_seeder_processes_per_host': value => $torrent_max_seeder_processes_per_host;
'xenserver/use_join_force': value => $use_join_force;
'xenserver/cache_images': value => $cache_images;
'xenserver/image_compression_level': value => $image_compression_level;
'xenserver/default_os_type': value => $default_os_type;
'xenserver/block_device_creation_timeout': value => $block_device_creation_timeout;
'xenserver/max_kernel_ramdisk_size': value => $max_kernel_ramdisk_size;
'xenserver/sr_matching_filter': value => $sr_matching_filter;
'xenserver/sparse_copy': value => $sparse_copy;
'xenserver/num_vbd_unplug_retries': value => $num_vbd_unplug_retries;
'xenserver/torrent_images': value => $torrent_images;
'xenserver/ipxe_network_name': value => $ipxe_network_name;
'xenserver/ipxe_boot_menu_url': value => $ipxe_boot_menu_url;
'xenserver/ipxe_mkisofs_cmd': value => $ipxe_mkisofs_cmd;
'xenserver/running_timeout': value => $running_timeout;
'xenserver/vif_driver': value => $vif_driver;
'xenserver/image_upload_handler': value => $image_upload_handler;
'xenserver/introduce_vdi_retry_wait': value => $introduce_vdi_retry_wait;
}
ensure_packages(['python-pip'])

View File

@ -0,0 +1,8 @@
---
features:
- All parameters from xenserver config have been
added to class definition.
deprecations:
- Following parameters gets deprecated
xenapi_connection_url, xenapi_connection_username,
xenapi_connection_password.

View File

@ -3,18 +3,64 @@ require 'spec_helper'
describe 'nova::compute::xenserver' do
let :params do
{ :xenapi_connection_url => 'https://127.0.0.1',
:xenapi_connection_username => 'root',
:xenapi_connection_password => 'passw0rd' }
{ :connection_url => 'https://127.0.0.1',
:connection_username => 'root',
:connection_password => 'passw0rd' }
end
let :optional_params do
{ :ovs_integration_bridge => 'xapi1',
:agent_timeout => '30',
:agent_version_timeout => '300',
:agent_resetnetwork_timeout => '60',
:agent_path => '/usr/sbin/xe-update-guest-attrs',
:disable_agent => 'false',
:use_agent_default => 'false',
:login_timeout => '10',
:connection_concurrent => '5',
:vhd_coalesce_poll_interval => '5.0',
:check_host => 'true',
:vhd_coalesce_max_attempts => '20',
:sr_base_path => '/var/run/sr-mount',
:target_host => '127.0.0.1',
:target_port => '3260',
:iqn_prefix => 'iqn.2010-10.org.openstack',
:remap_vbd_dev => 'false',
:remap_vbd_dev_prefix => 'sd',
:torrent_base_url => 'http://127.0.0.1/',
:torrent_seed_chance => '1.0',
:torrent_seed_duration => '3600',
:torrent_max_last_accessed => '86400',
:torrent_listen_port_start => '6881',
:torrent_listen_port_end => '6891',
:torrent_download_stall_cutoff => '600',
:torrent_max_seeder_processes_per_host => '1',
:use_join_force => 'true',
:cache_images => 'all',
:image_compression_level => '1',
:default_os_type => 'linux',
:block_device_creation_timeout => '10',
:max_kernel_ramdisk_size => '16777216',
:sr_matching_filter => 'default-sr:true',
:sparse_copy => 'true',
:num_vbd_unplug_retries => '10',
:torrent_images => 'none',
:ipxe_network_name => 'public',
:ipxe_boot_menu_url => 'http://127.0.0.1/',
:ipxe_mkisofs_cmd => 'mkisofs',
:running_timeout => '10',
:vif_driver => 'nova.virt.xenapi.vif.XenAPIBridgeDriver',
:image_upload_handler => 'nova.virt.xenapi.image.glance.GlanceStore',
:introduce_vdi_retry_wait => '20' }
end
context 'with required parameters' do
it 'configures xenapi in nova.conf' do
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('xenapi.XenAPIDriver')
is_expected.to contain_nova_config('DEFAULT/xenapi_connection_url').with_value(params[:xenapi_connection_url])
is_expected.to contain_nova_config('DEFAULT/xenapi_connection_username').with_value(params[:xenapi_connection_username])
is_expected.to contain_nova_config('DEFAULT/xenapi_connection_password').with_value(params[:xenapi_connection_password])
is_expected.to contain_nova_config('xenserver/connection_url').with_value(params[:connection_url])
is_expected.to contain_nova_config('xenserver/connection_username').with_value(params[:connection_username])
is_expected.to contain_nova_config('xenserver/connection_password').with_value(params[:connection_password])
end
it 'installs xenapi with pip' do
@ -34,4 +80,56 @@ describe 'nova::compute::xenserver' do
is_expected.to contain_nova_config('DEFAULT/compute_driver').with_value('xenapi.FoobarDriver')
end
end
context 'with optional parameters' do
before :each do
params.merge!(optional_params)
end
it 'configures xenapi in nova.conf' do
is_expected.to contain_nova_config('xenserver/ovs_integration_bridge').with_value(params[:ovs_integration_bridge])
is_expected.to contain_nova_config('xenserver/agent_timeout').with_value(params[:agent_timeout])
is_expected.to contain_nova_config('xenserver/agent_version_timeout').with_value(params[:agent_version_timeout])
is_expected.to contain_nova_config('xenserver/agent_resetnetwork_timeout').with_value(params[:agent_resetnetwork_timeout])
is_expected.to contain_nova_config('xenserver/agent_path').with_value(params[:agent_path])
is_expected.to contain_nova_config('xenserver/disable_agent').with_value(params[:disable_agent])
is_expected.to contain_nova_config('xenserver/use_agent_default').with_value(params[:use_agent_default])
is_expected.to contain_nova_config('xenserver/login_timeout').with_value(params[:login_timeout])
is_expected.to contain_nova_config('xenserver/connection_concurrent').with_value(params[:connection_concurrent])
is_expected.to contain_nova_config('xenserver/vhd_coalesce_poll_interval').with_value(params[:vhd_coalesce_poll_interval])
is_expected.to contain_nova_config('xenserver/check_host').with_value(params[:check_host])
is_expected.to contain_nova_config('xenserver/vhd_coalesce_max_attempts').with_value(params[:vhd_coalesce_max_attempts])
is_expected.to contain_nova_config('xenserver/sr_base_path').with_value(params[:sr_base_path])
is_expected.to contain_nova_config('xenserver/target_host').with_value(params[:target_host])
is_expected.to contain_nova_config('xenserver/target_port').with_value(params[:target_port])
is_expected.to contain_nova_config('xenserver/iqn_prefix').with_value(params[:iqn_prefix])
is_expected.to contain_nova_config('xenserver/remap_vbd_dev').with_value(params[:remap_vbd_dev])
is_expected.to contain_nova_config('xenserver/remap_vbd_dev_prefix').with_value(params[:remap_vbd_dev_prefix])
is_expected.to contain_nova_config('xenserver/torrent_base_url').with_value(params[:torrent_base_url])
is_expected.to contain_nova_config('xenserver/torrent_seed_chance').with_value(params[:torrent_seed_chance])
is_expected.to contain_nova_config('xenserver/torrent_seed_duration').with_value(params[:torrent_seed_duration])
is_expected.to contain_nova_config('xenserver/torrent_max_last_accessed').with_value(params[:torrent_max_last_accessed])
is_expected.to contain_nova_config('xenserver/torrent_listen_port_start').with_value(params[:torrent_listen_port_start])
is_expected.to contain_nova_config('xenserver/torrent_listen_port_end').with_value(params[:torrent_listen_port_end])
is_expected.to contain_nova_config('xenserver/torrent_download_stall_cutoff').with_value(params[:torrent_download_stall_cutoff])
is_expected.to contain_nova_config('xenserver/torrent_max_seeder_processes_per_host').with_value(params[:torrent_max_seeder_processes_per_host])
is_expected.to contain_nova_config('xenserver/use_join_force').with_value(params[:use_join_force])
is_expected.to contain_nova_config('xenserver/cache_images').with_value(params[:cache_images])
is_expected.to contain_nova_config('xenserver/image_compression_level').with_value(params[:image_compression_level])
is_expected.to contain_nova_config('xenserver/default_os_type').with_value(params[:default_os_type])
is_expected.to contain_nova_config('xenserver/block_device_creation_timeout').with_value(params[:block_device_creation_timeout])
is_expected.to contain_nova_config('xenserver/max_kernel_ramdisk_size').with_value(params[:max_kernel_ramdisk_size])
is_expected.to contain_nova_config('xenserver/sr_matching_filter').with_value(params[:sr_matching_filter])
is_expected.to contain_nova_config('xenserver/sparse_copy').with_value(params[:sparse_copy])
is_expected.to contain_nova_config('xenserver/num_vbd_unplug_retries').with_value(params[:num_vbd_unplug_retries])
is_expected.to contain_nova_config('xenserver/torrent_images').with_value(params[:torrent_images])
is_expected.to contain_nova_config('xenserver/ipxe_network_name').with_value(params[:ipxe_network_name])
is_expected.to contain_nova_config('xenserver/ipxe_boot_menu_url').with_value(params[:ipxe_boot_menu_url])
is_expected.to contain_nova_config('xenserver/ipxe_mkisofs_cmd').with_value(params[:ipxe_mkisofs_cmd])
is_expected.to contain_nova_config('xenserver/running_timeout').with_value(params[:running_timeout])
is_expected.to contain_nova_config('xenserver/vif_driver').with_value(params[:vif_driver])
is_expected.to contain_nova_config('xenserver/image_upload_handler').with_value(params[:image_upload_handler])
is_expected.to contain_nova_config('xenserver/introduce_vdi_retry_wait').with_value(params[:introduce_vdi_retry_wait])
end
end
end