VNC是OpenStack的Nova默认的连接协议,面对一些简单的管理工作表现也不错,但是如果用户经常使用Windows桌面,VNC就显得能力不足。一般情况下,使用Spice协议来代替VNC。
VNC (Virtual Network Computing)是虚拟网络计算机的缩写。VNC 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的。VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和 Windows 和 MAC 中的任何远程控制软件媲美。 在 Linux 中,VNC 包括以下四个命令:vncserver,vncviewer,vncpasswd,和 vncconnect。大多数情况下我只需要其中的两个命令:vncserver 和 vncviewer。
当前支持功能:
• 图形界面 - processes and transmits 2D graphic commands
• 视频流 - heuristically identifies video streams and transmits M-JPEG video streams
• 图片压缩 - offers verios compression algorithm that were built specifically for Spice, including QUIC (based on SFALIC), LZ, GLZ (history-based global dictionary), and auto (heuristic compression choice per image)
• 硬件鼠标- processes and transmits cursor-specific commands
• 图像,颜色,鼠标缓存 - manages client caches to reduce bandwidth requirements
• 在线切换 - supports clients while migrating Spice servers to new hosts, thus avoiding interruptions
• Windows 驱动 - Windows drivers for QXL display device and VDI-port
• 多监视器
• 客户端支持linux和windows - can be easily ported to additional platforms.
• 立体声音频 - supports audio playback and captures; audio data stream is optionally compressed using CELT
• 加密 - using OpenSSL
• 两种鼠标模式- provides client (more user-friendly) and server (increased accuracy and fully synchronized) modes
• 音频视频同步 - synchronizes video streams with audio clocks
• Spice 代理 - running on the guest and performs tasks for the client
• 剪切板共享 - allows copy paste between clients and the virtual machine
未来将支持的新功能:
• 网络隧道 (in progress) - using virtual network interface to enable sharing of network resources. Currently the focus is on printer sharing but is not limited to that.
• Off-screen surfaces (in progress) - supports off-screen surfaces as infrastructure for future DirectDraw, video acceleration and 3D acceleration. GDI and X11 will also benefit from this feature. It will also lay foundation for multi-head support
• 共享usb (in progress) - allows clients to share their USB devices with Spice servers
• Direct Draw
• 客户端GUI - Enables user-friendly configuration
• 屏幕管理 - add support for enabling selection of the screen used by the client
• 配置文件 - enables persistent user and administrative settings
• 共享光驱 - share your CD with Spice server
• 视频加速
• 3D加速
• 支持Aero
• Linux features parity
• OSX client
• Simultaneous clients connection
测试环境:Ubuntu14.04 icehouse
控制节点
1、安装软件
apt-get install nova-spiceproxy spice-html5 spice-vdagent
2、修改控制节点的Nova.conf
注释掉所有跟vnc相关的内容,然后添加如下内容
vnc_enabled = false
novnc_enabled=false
[spice]
enabled=true
html5proxy_base_url=http://192.168.12.1:6082/spice_auto.html
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=192.168.12.1
agent_enabled=false
参考我的nova.conf文件
root@controller:~# sudo cat /etc/nova/nova.conf
[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
force_dhcp_release=True
iscsi_helper=tgtadm
libvirt_use_virtio_for_bridges=True
connection_type=libvirt
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
verbose=True
ec2_private_dns_show_ip=True
api_paste_config=/etc/nova/api-paste.ini
volumes_path=/var/lib/nova/volumes
enabled_apis=ec2,osapi_compute,metadata
rpc_backend = rabbit
rabbit_host = 192.168.12.1
rabbit_userid = guest
rabbit_password = mq4smtest
rabbit_port = 5672
my_ip = 192.168.12.1
auth_strategy = keystone
network_api_class = nova.network.neutronv2.api.API
neutron_url = http://192.168.12.1:9696
neutron_auth_strategy = keystone
neutron_admin_tenant_name = service
neutron_admin_username = neutron
neutron_admin_password = neutron4smtest
neutron_admin_auth_url = http://192.168.12.1:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = neutron
service_neutron_metadata_proxy = true
neutron_metadata_proxy_shared_secret = neutron4smtest
#vncserver_listen = 192.168.12.1
#vncserver_proxyclient_address = 192.168.12.1
vnc_enabled = false
novnc_enabled=false
[spice]
enabled=true
html5proxy_base_url=http://192.168.12.1:6082/spice_auto.html
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=192.168.12.1
agent_enabled=false
[keystone_authtoken]
auth_uri = http://192.168.12.1:5000
auth_host = 192.168.12.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = nova4smtest
[database]
connection = mysql://novadbadmin:[email protected]/nova
3、重启控制节点的nova服务
重启服务需要注意两点:
a:由于我们不再使用vnc,所有需要停止vnc的服务
root@controller:~# sudo service nova-novncproxy stop
nova-novncproxy stop/waiting
b:我们需要启动Spice协议服务,我参考了网上的例子,都是centOS的,里面需要启动nova-spicehtml5proxy,但是ubuntu并没有这个服务,查了半天资料才看到,对ubuntu来说,对应的服务为nova-spiceproxy。
所以,重启相关服务
root@controller:~# sudo service nova-api restart
nova-api stop/waiting
nova-api start/running, process 5394
root@controller:~# sudo service nova-cert restart
nova-cert stop/waiting
nova-cert start/running, process 5412
root@controller:~# sudo service nova-consoleauth restart
nova-consoleauth stop/waiting
nova-consoleauth start/running, process 5430
root@controller:~# sudo service nova-scheduler restart
nova-scheduler stop/waiting
nova-scheduler start/running, process 5450
root@controller:~# sudo service nova-conductor restart
nova-conductor stop/waiting
nova-conductor start/running, process 5507
root@controller:~# sudo service nova-spiceproxy restart
nova-spiceproxy stop/waiting
nova-spiceproxy start/running, process 5561
计算节点
1、安装软件
2、修改nova.conf
添加如下内容
vnc_enabled=false
novnc_enabled=false
[spice]
agent_enabled=false
enabled=true
html5proxy_base_url=http://192.168.12.1:6082/spice_auto.html
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=192.168.12.3
agent_enabled=false
参考我的nova.conf
root@compute:~# sudo cat /etc/nova/nova.conf
[DEFAULT]
dhcpbridge_flagfile=/etc/nova/nova.conf
dhcpbridge=/usr/bin/nova-dhcpbridge
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
force_dhcp_release=True
iscsi_helper=tgtadm
libvirt_use_virtio_for_bridges=True
connection_type=libvirt
root_helper=sudo nova-rootwrap /etc/nova/rootwrap.conf
verbose=True
ec2_private_dns_show_ip=True
api_paste_config=/etc/nova/api-paste.ini
volumes_path=/var/lib/nova/volumes
enabled_apis=ec2,osapi_compute,metadata
rpc_backend = rabbit
rabbit_host = 192.168.12.1
rabbit_userid = guest
rabbit_password = mq4smtest
rabbit_port = 5672
my_ip = 192.168.12.3
glance_host = 192.168.12.1
auth_strategy = keystone
vif_plugging_timeout = 10
vif_plugging_is_fatal = False
network_api_class = nova.network.neutronv2.api.API
neutron_url = http://192.168.12.1:9696
neutron_auth_strategy = keystone
neutron_admin_tenant_name = service
neutron_admin_username = neutron
neutron_admin_password = neutron4smtest
neutron_admin_auth_url = http://192.168.12.1:35357/v2.0
linuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriver
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api = neutron
#vncserver_listen = 0.0.0.0
#vncserver_proxyclient_address = 192.168.12.3
#vnc_enabled = True
#novncproxy_base_url = http://192.168.12.1:6080/vnc_auto.html
vnc_enabled=false
novnc_enabled=false
[spice]
agent_enabled=false
enabled=true
html5proxy_base_url=http://192.168.12.1:6082/spice_auto.html
keymap=en-us
server_listen=0.0.0.0
server_proxyclient_address=192.168.12.3
agent_enabled=false
[database]
connection = mysql://novadbadmin:[email protected]/nova
[keystone_authtoken]
auth_uri = http://192.168.12.1:5000
auth_host = 192.168.12.1
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = nova
admin_password = nova4smtest
3、重启服务
root@compute:~# sudo service nova-compute restart
nova-compute stop/waiting
nova-compute start/running, process 1951