轉換 KVM 使用 Spice

  1. 安裝 Spice
    [root@dywmsi ~]# yum install spice-server spice-client spice-protocol
    
  2. 關閉 VM ,改變設定,再開啟 VM,才會生效,所以先關閉 VM kvm8。
    [root@dywmsi ~]# virsh destroy kvm8
    Domain kvm8 destroyed
    
  3. 圖形界面開啟應用程式:
    Virtual Machine Manager
    選點要修改的 VM
    Show virtual machine detail
    Display --> Spice
    
  4. 比較修改前後的 xml:
    [root@dywmsi ~]# diff -uN kvm8.xml.bak /etc/libvirt/qemu/kvm8.xml 
    --- kvm8.xml.bak	2019-10-28 17:43:25.686329429 +0800
    +++ /etc/libvirt/qemu/kvm8.xml	2019-10-28 17:39:43.535750740 +0800
    @@ -56,6 +56,9 @@
         <controller type='ide' index='0'>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
         </controller>
    +    <controller type='virtio-serial' index='0'>
    +      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    +    </controller>
         <interface type='network'>
           <mac address='52:54:00:06:dc:3e'/>
           <source network='net1'/>
    @@ -68,9 +71,15 @@
         <console type='pty'>
           <target type='serial' port='0'/>
         </console>
    +    <channel type='spicevmc'>
    +      <target type='virtio' name='com.redhat.spice.0'/>
    +      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    +    </channel>
         <input type='tablet' bus='usb'/>
         <input type='mouse' bus='ps2'/>
    -    <graphics type='vnc' port='-1' autoport='yes'/>
    +    <graphics type='spice' autoport='yes' listen='127.0.0.1'>
    +      <listen type='address' address='127.0.0.1'/>
    +    </graphics>
         <sound model='ich6'>
           <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
         </sound>