安装软件包
yum install spice-server spice-protocol openstack-nova-spicehtml5proxy spice-html5
spice-html5 在epel源里,需要配置epel源
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
修改配置文件,注释掉原vnc相关配置,添加以下配置信息。
这里需要明确指定vnc_enabled=false,否则即使配置了spice,系统也仍然使用vnc(参考官方文档说明)
vim /etc/nova/nova.conf
[default]
vnc_enabled=false
[spice]
html5proxy_host=10.1.81.193
html5proxy_port=6082
keymap=en-us
停止novncproxy并取消自启动
systemctl stop openstack-nova-novncproxy.service
systemctl disable openstack-nova-novncproxy.service
启用spicehtml5proxy开机自启动并启动它
systemctl enable openstack-nova-spicehtml5proxy.service
systemctl start openstack-nova-spicehtml5proxy.service
开放6082端口
firewall-cmd --add-port=6082/tcp –permanent
firewall-cmd --reload
修改计算节点
安装软件包
yum install spice-server spice-protocol spice-html5
修改配置文件,注释掉原vnc相关配置,添加以下配置信息
vim /etc/nova/nova.conf
[default]
vnc_enabled=false
[spice]
html5proxy_base_url=http://10.1.81.193:6082/spice_auto.html
server_listen=0.0.0.0
server_proxyclient_address=10.1.81.192
enabled=true
keymap=en-us
重启启动nova-compute
systemctl restart openstack-nova-compute.service
安装virt-viewer
ps aux|grep kvm
root 1946 2.1 28.3 4734496 2291064 ? Sl 9月09 67:46 /usr/libexec/qemu-kvm -name instance-0000001f -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -cpu Nehalem,+rdtscp,+avx,+osxsave,+xsave,+tsc-deadline,+pcid,+pdcm,+xtpr,+tm2,+est,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 2048 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 5413e4ed-48cb-4b7f-88a5-c2e48a51467e -smbios type=1,manufacturer=Fedora Project,product=OpenStack Nova,version=2015.1.0-3.el7,serial=c9f7de17-15af-402a-8bfb-a52cc836791b,uuid=5413e4ed-48cb-4b7f-88a5-c2e48a51467e -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-0000001f.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-hpet -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x4 -drive file=/var/lib/nova/instances/5413e4ed-48cb-4b7f-88a5-c2e48a51467e/disk,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=23,id=hostnet0,vhost=on,vhostfd=25 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=fa:16:3e:5b:fe:08,bus=pci.0,addr=0x3 -chardev file,id=charserial0,path=/var/lib/nova/instances/5413e4ed-48cb-4b7f-88a5-c2e48a51467e/console.log -device isa-serial,chardev=charserial0,id=serial0 -chardev pty,id=charserial1 -device isa-serial,chardev=charserial1,id=serial1 -chardev pty,id=charchannel0 -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5901,addr=0.0.0.0,disable-ticketing,seamless-migration=on -k en-us -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -global qxl-vga.vgamem_mb=16 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on
看到name=com.redhat.spice.0 -spice port=5901,addr=0.0.0.0
可见可以使用spice://10.1.81.214:5901即可
remote-viewer spice://10.1.81.214:5901 即可