Make vnc_enabled, use_usb_tablet, cpu_mode configurable

Change-Id: I2fe55f277686901258f9e414a39c36fd5b1e12a9
Closes-Bug: 1467838
This commit is contained in:
Chen Zhiwei 2015-06-23 17:35:40 +08:00
parent 01678f7513
commit 8bd3223e60
3 changed files with 27 additions and 5 deletions

View File

@ -345,6 +345,13 @@ default['openstack']['compute']['libvirt']['live_migration_flag'] = 'VIR_MIGRATE
default['openstack']['compute']['libvirt']['block_migration_flag'] = 'VIR_MIGRATE_UNDEFINE_SOURCE, VIR_MIGRATE_PEER2PEER, VIR_MIGRATE_NON_SHARED_INC'
default['openstack']['compute']['libvirt']['live_migration_uri'] = 'qemu+tcp://%s/system'
# Explicitly set the cpu_mode option under libvirt section
# When this option is set, it will override all other logics related to cpu_mode
default['openstack']['compute']['libvirt']['cpu_mode'] = nil
# Sync virtual and real mouse cursors in Windows VMs (boolean value)
default['openstack']['compute']['config']['use_usb_tablet'] = 'true'
default['openstack']['compute']['config']['availability_zone'] = 'nova'
default['openstack']['compute']['config']['default_schedule_zone'] = 'nova'
default['openstack']['compute']['config']['force_raw_images'] = false
@ -582,6 +589,9 @@ when 'debian'
}
end
# Enable VNC related features (boolean value)
default['openstack']['compute']['vnc']['enabled'] = 'true'
# VNC keymap
default['openstack']['compute']['vnc']['keymap'] = 'en-us'

View File

@ -542,6 +542,7 @@ describe 'openstack-compute::nova-common' do
[/^vncserver_listen=127.0.1.1$/,
/^vncserver_proxyclient_address=127.0.1.1$/,
/^vnc_enabled=true$/,
/^vnc_keymap=en-us$/].each do |line|
expect(chef_run).to render_file(file.name).with_content(line)
end
@ -602,6 +603,11 @@ describe 'openstack-compute::nova-common' do
.with_section_content('libvirt', /^disk_cachemodes=disk:writethrough$/)
end
it 'has use_usb_tablet setting' do
expect(chef_run).to render_config_file(file.name)\
.with_section_content('libvirt', /^use_usb_tablet=true$/)
end
it 'has keymgr api_class attribute default set' do
expect(chef_run).to render_config_file(file.name).with_section_content('keymgr', /^api_class=nova.keymgr.conf_key_mgr.ConfKeyManager$/)
end
@ -885,13 +891,15 @@ describe 'openstack-compute::nova-common' do
node.set['openstack']['compute']['libvirt']['images_type'] = 'lvm'
node.set['openstack']['compute']['libvirt']['volume_group'] = 'instances'
node.set['openstack']['compute']['libvirt']['sparse_logical_volumes'] = true
node.set['openstack']['compute']['libvirt']['cpu_mode'] = 'none'
end
it 'sets the overridden lvm options correctly' do
[
/^images_type=lvm$/,
/^images_volume_group=instances$/,
/^sparse_logical_volumes=true$/
/^sparse_logical_volumes=true$/,
/^cpu_mode=none$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('libvirt', line)

View File

@ -155,6 +155,9 @@ novncproxy_port=<%= @novncproxy_bind_port %>
vncserver_listen=<%= @vncserver_listen %>
vncserver_proxyclient_address=<%= @vncserver_proxyclient_address %>
# Enable VNC related features (boolean value)
vnc_enabled=<%= node['openstack']['compute']['vnc']['enabled'] %>
vnc_keymap=<%= node['openstack']['compute']['vnc']['keymap'] %>
# store consoleauth tokens in memcached
@ -574,9 +577,8 @@ inject_key=<%= node["openstack"]["compute"]["libvirt"]["libvirt_inject_key"] %>
# Deprecated group/name - [DEFAULT]/libvirt_inject_partition
inject_partition=<%= node["openstack"]["compute"]["libvirt"]["libvirt_inject_partition"] %>
# Sync virtual and real mouse cursors in Windows VMs (boolean
# value)
#use_usb_tablet=true
# Sync virtual and real mouse cursors in Windows VMs (boolean value)
use_usb_tablet=<%= node["openstack"]["compute"]["config"]["use_usb_tablet"] %>
# Migration target URI (any included "%s" is replaced with the
# migration target hostname) (string value)
@ -624,7 +626,9 @@ vif_driver=<%= node["openstack"]["compute"]["network"]["neutron"]["libvirt_vif_d
# "host-model", otherwise it will default to "none" (string
# value)
# Deprecated group/name - [DEFAULT]/libvirt_cpu_mode
<% if node["openstack"]["compute"]["libvirt"]["virt_type"] == "qemu" -%>
<% if node["openstack"]["compute"]["libvirt"]["cpu_mode"] -%>
cpu_mode=<%= node["openstack"]["compute"]["libvirt"]["cpu_mode"] %>
<% elsif node["openstack"]["compute"]["libvirt"]["virt_type"] == "qemu" -%>
cpu_mode=none
<% end -%>