tags: kvm

Remote desktop trial using SPICE protocol via mobile broadband connection

This post is continued story from these posts ( 1, 2, 3 ).

Previously I tried SPICE protocol as alternative of Microsoft’s RDP, but at that time SPICE protocol was very early development so I could not satisfy my needs to use in daily use. But situation has changed. RHEL 6 has included SPICE protocol for VDI, so I’ve tried once again.

1. Environment

  • Physical Host: Scientific Linux 6

  • kernel: 2.6.32-71.el6.x86_64

  • qemu-kvm-0.12.1.2-2.160.el6_1.2.x86_64

  • spice-server-0.8.0-1.el6.x86_64

  • Virtual Desktop: Fedora 15(i686)

  • kernel: 2.6.38.8-35.fc15.i686.PAE

  • xorg-x11-drv-qxl-0.0.21-3.fc15.i686

I’ve also used DNS, ddclient, and some router for this trial.(not written in this post)

2. Create Physical host

First, I’ve created normal kvm host. After the installation, I’ve also installed spice-server via yum.

3. Create Virtual Desktop

This procedure is just a little bit complex. First, I’ve created virtual machine using virt-manager and installed Fedora 15. But virt-manager only treat with VNC connection, so I’ve changed the configuration of virtual machine to work with SPICE.

4. Modify configuration to work with SPICE

After the installation, I’ve dumped configuration of virtual machine to XML file.

1
2
3
4
5
(at Guest OS)
# halt -p
(at Host OS)
# virsh dumpxml <virtual machine name> > <XML filename>
# virsh undefine <virtual machine name>

and edit XML file. Red charactor shows changes from original XML file.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<domain type='kvm'>
  <name>f15</name>
  <uuid>4845a1da-cf61-62dc-783c-d0bff899b68e</uuid>
  <memory>786432</memory>
  <currentMemory>786432</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='i686' machine='rhel6.1.0'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/storage/cdimg/fedora/Fedora-15-i386-netinst.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/vm/f15.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:c1:29:97'/>
      <source bridge='br0'/>
      <target dev='vnet4'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target port='0'/>
    </console>
    <input type='tablet' bus='usb'/>
    <input type='mouse' bus='ps2'/>
    <graphics type='spice' port='5930' autoport='no' listen='0.0.0.0'/>
    <sound model='ac97'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' vram='32768' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
</domain>

After the edit I defined virtual machine again.

1
# virsh define /home/vm/f15.xml

After definition, I cannot see console in virt-manager anymore. The reason is that virt-manager doesn’t support SPICE. So I issued virsh command to boot virtual machine.

1
# virsh start f15

5. Connect virtual machine from Windows client

Windows client bianry can be downloded from spice-space.org. I’ve downloaded spice-client-win32-0.6.3.zip and spice_libs_win32_063_and_earlier.zip.

After download, I unzipped both package and moved spicec.exe to libs directory for spicec.exe works with some libraries.

6. User Experience

I’ve tried. See movie.

7. Conclusion

SPICE protocol works good with mobile broadband and LAN connection, but you will feel some stress about some multimedia experience. SPICE connection via mobile broadband will consume about 800kbps bandwidth from my experience.

Enjoy.

今日はkvmの仮想マシンのバックアップ方法を確認した

先週kvmマシンのHDDがクラッシュし、OS+3つのVMを再インストールするはめになった。毎回やるのもダルいので、せめてVMは一発復旧させたいなあといろいろ調べて、なんか確立したっぽいので以下にメモ。 一応我が家はこれで動いているようですがat your own riskでお願いします。復元できなかったりなんか不具合あっても責任取れません ### バックアップ方法

VMを静止した状態で、設定ファイル、メモリイメージ、仮想ディスクをコピーしておけばいい。ディスクイメージの種類はrawでも、qcow2でもいい。具体的なコマンドにすると以下のような感じ

virsh dumpxml > # virsh save # cp ### リストア方法

OSインストール後以下のような感じにする

cp # virsh define # virsh restore いろいろ調べたけど、kvmの場合Live Backupはできないみたいなんだよね・・・。もちろんVMの中でバックアップ動かすのはありだけど。なんかダルいし。花粉症だし。

今日でkvm環境への移行が完了した

いままでOpenSolaris+VirtualBox環境でやってたけど、2個以上VM立てると時計が進まなくなったりしてたので、ストレージはOpenIndiana、いろんなサーバはCentOS,KVMでやってみることにして、今日ほぼ元の状態まで戻した。KVM超いい。3つほどVM立ててもメモリぜんぜん食わないし時計はちゃんと進むし.iSCSIでやってみたかったけどなんかよくわかんないので今後の課題かな・・・。あとはOpenIndianaでSambaがちゃんと動けばパフォーマンスもいいのでちょっと動向をウォッチしつつとりあえず放置かなあ・・・。