4. Powered by OpenStack
•Guest OS
–CentOS 7 install
•端末モードでは意味がないのでgnome環境等のインストールが必要
–Windows 2008 server
•conoHaで提供しているwindows osを使用した
•http://www.spice-space.org/download/windows/spice-guest-tools/spice-guest-tools-0.74.exe
これをインストールすればよい
•Spice client (windows)
–http://virt-manager.org/download/sources/virt-viewer/virt-viewer-x64-1.0.msi
これを使用した
2014/10/2
Y. Kawada
4
# yum install spice-vdagent
# cd /etc/systemd/system
# cp ./spice-vdagentd.target.wants/spice-vdagentd.service ./graphical.target.wants
# systemctl enable spice-vdagentd.service
5. Powered by OpenStack
2014/10/2
Y. Kawada
5
horizon -> CentOS 7
Spice client -> window 2008 server
サンプル
6. Powered by OpenStack
•nova
–nova-api server にwebproxy も置く
2014/10/2
Y. Kawada
6
[root@ih-api-p1]# cat /usr/bin/nova-spicehtml5proxy
#!/usr/bin/python
# PBR Generated from u'console_scripts'
import sys
from nova.cmd.spicehtml5proxy import main
if __name__ == "__main__":
sys.exit(main())
[root@ih-api-p1 ]# cd /usr/share/
[root@ih-api-p1 ]# git clone git://anongit.freedesktop.org/spice/spice-html5 ./spice-html5
[root@ih-api-p1 ]# cat /etc/httpd/conf.d/spice.conf
#
# spice-html5 is a Javascript SPICE client
#
Alias /spice /usr/share/spice-html5
<Directory /usr/share/spice-html5>
# This page is broadly available, tune here to make it more restricted.
Require all granted
DirectoryIndex spice.html
</Directory>
[root@ih-api-p1 ]# cat /usr/lib/systemd/system/openstack-nova-spicehtml5proxy.service
[Unit]
Description=OpenStack Nova Spice HTML5 Proxy Server
After=syslog.target network.target
[Service]
Type=simple
User=nova
ExecStart=/usr/bin/nova-spicehtml5proxy
[Install]
WantedBy=multi-user.target
[root@ih-api-p1 ]# systemctl start openstack-nova-spicehtml5proxy.service
7. Powered by OpenStack
•nova (api)
–/etc/nova/nova.conf
Spice に関係のある箇所だけ
2014/10/2
Y. Kawada
7
# # Options defined in nova.cmd.spicehtml5proxy # # Host on which to listen for incoming requests (string value) spicehtml5proxy_host=0.0.0.0 # Port on which to listen for incoming requests (integer # value) spicehtml5proxy_port=6082 [spice] # # Options defined in nova.spice # html5proxy_base_url=http://xxx.xxx.xxx.xxx:6082/spice_auto.html # nova-api(proxy) のアドレス # IP address on which instance spice server should listen # (string value) server_listen=0.0.0.0 # Enable spice related features (boolean value) enabled=True # Enable spice guest agent support (boolean value) agent_enabled=true
8. Powered by OpenStack
•nova (cnode)
–/etc/nova/nova.conf
Spice に関係のある箇所だけ
2014/10/2
Y. Kawada
8
[DEFAULT] # Enable VNC related features (boolean value) vnc_enabled=False [spice] # # Options defined in nova.spice # html5proxy_base_url=http://xxx.xxx.xxx.xxx:6082/spice_auto.html # nova-api(proxy) のアドレス # IP address on which instance spice server should listen # (string value) server_listen=0.0.0.0 # The address to which proxy clients (like nova- # spicehtml5proxy) should connect (string value) server_proxyclient_address=10.0.0.22 # cnode (host)のアドレス # Enable spice related features (boolean value) enabled=True # Enable spice guest agent support (boolean value) agent_enabled=true
9. Powered by OpenStack
2014/10/2
Y. Kawada
9
diff --git a/virt/libvirt/config.py b/virt/libvirt/config.py
index a931b57..e2ac9ea 100644
--- a/virt/libvirt/config.py
+++ b/virt/libvirt/config.py
@@ -950,6 +950,23 @@ class LibvirtConfigGuestVideo(LibvirtConfigGuestDevice):
return dev
+class LibvirtConfigGuestSound(LibvirtConfigGuestDevice): # Y.Kawada
+
+ def __init__(self, **kwargs):
+ super(LibvirtConfigGuestSound, self).__init__(root_name="sound",
+ **kwargs)
+ # pcspk PC speaker
+ # hda Intel HD Audio
+ # ac97 Intel 82801AA AC97 Audio
+ self.type = "ich6" # for windows 2008
+ # self.type = "ac97" # for Centos7
+
+ def format_dom(self):
+ dev = super(LibvirtConfigGuestSound, self).format_dom()
+ dev.set("model", self.type)
+
+ return dev
+
class LibvirtConfigGuestController(LibvirtConfigGuestDevice):
@@ -1053,6 +1070,27 @@ class LibvirtConfigGuestCharBase(LibvirtConfigGuestDevice):
return dev
+class LibvirtConfigGuestCharSpiceBase(LibvirtConfigGuestDevice): # Y.Kawada
+
+ def __init__(self, **kwargs):
+ super(LibvirtConfigGuestCharSpiceBase, self).__init__(**kwargs)
+
+ self.type = "spicevmc"
+ self.source_path = None
+
+ def format_dom(self):
+ dev = super(LibvirtConfigGuestCharSpiceBase, self).format_dom()
+
+ dev.set("type", self.type)
+ if self.type == "file":
+ dev.append(etree.Element("source", path=self.source_path))
+ elif self.type == "unix":
+ dev.append(etree.Element("source", mode="bind",
+ path=self.source_path))
+
+ return dev
+
+
class LibvirtConfigGuestChar(LibvirtConfigGuestCharBase):
def __init__(self, **kwargs):
@@ -1083,7 +1121,7 @@ class LibvirtConfigGuestConsole(LibvirtConfigGuestChar):
**kwargs)
-class LibvirtConfigGuestChannel(LibvirtConfigGuestCharBase):
+class LibvirtConfigGuestChannel(LibvirtConfigGuestCharSpiceBase): # Y.Kawada
def __init__(self, **kwargs):
super(LibvirtConfigGuestChannel, self).__init__(root_name="channel",
nova (cnode) source 修正1
10. Powered by OpenStack
2014/10/2
Y. Kawada
10
diff --git a/virt/libvirt/driver.py b/virt/libvirt/driver.py
index 1e14892..c7f0e03 100644
--- a/virt/libvirt/driver.py
+++ b/virt/libvirt/driver.py
@@ -3385,6 +3385,11 @@ class LibvirtDriver(driver.ComputeDriver):
video.vram = video_ram
guest.add_device(video)
+ # Y.Kawada
+ # VALID_SOUND_DEVICES = ("ac97", "hda", "pcspk", "ich6")
+ sound = vconfig.LibvirtConfigGuestSound()
+ guest.add_device(sound)
+
# Qemu guest agent only support 'qemu' and 'kvm' hypervisor
if CONF.libvirt.virt_type in ('qemu', 'kvm'):
qga_enabled = False
nova (cnode) source 修正2
以上、御参考まで。