我正在使用virt-install (见下文)来创建一个来宾。一切似乎都好到了抱怨自动分配SPICE TLS端口的程度。
下面是我正在运行的内容和完整的输出:
# sudo virt-install --name vmname --ram 1024 --os-type=linux --os-variant=ubuntutrusty --disk path=/data/vm/vmname_sda.qcow2,bus=virtio,size=10,sparse=false --noautoconsole --console pty,target_type=virtio --accelerate --hvm --network=network:default --graphics spice,port=20001,listen=127.0.0.1
Starting install...
Retrieving file MANIFEST... | 2.1 kB 00:00 ...
Retrieving file MANIFEST... | 2.1 kB 00:00 ...
Retrieving file linux... | 11 MB 00:00 ...
Retrieving file initrd.gz... | 41 MB 00:00 ...
ERROR unsupported configuration: Auto allocation of spice TLS port requested but spice TLS is disabled in qemu.conf
Domain installation does not appear to have been successful.
If it was, you can restart your domain by running:
virsh --connect qemu:///system start vmname
otherwise, please restart your installation.错误是:
不支持的配置错误:请求spice TLS端口的自动分配,但spice TLS在qemu.conf中被禁用
事实上,在我的/etc/libvirt/qemu.conf中,我有:
spice_tls = 0(并有意如此)。
那么,如何使用SPICE协议为图形创建KVM客户,但禁用TLS呢?
我怀疑它是否相关,但我想禁用TLS的原因是我已经通过SSH隧道连接到SPICE了。不需要额外的加密层。
主机系统为Ubuntu14.04.1。包版本如下:
(就apt-get而言,所有这些都是最新的)
发布于 2014-08-06 19:11:35
好吧,我自己解决的。在备选案文中:
--graphics spice,port=20001,listen=127.0.0.1删除port参数,使其成为:
--graphics spice,listen=127.0.0.1然后,您需要在这个元素配置文件中配置libvirt。我对virt-install的调用给了我这样的印象:
<graphics type='spice' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>有一个警告。我完成了安装,而SPICE仍然连接到默认的自动连接端口(在我的例子中是5900)。如果您在完成安装之前关闭了客户,则virt-install启动的整个过程将被中断。
为了更改它,应该关闭客户,并使用virsh edit vmname (其中vmname应该用您的名字替换)将XML编辑成如下内容:
<graphics type='spice' autoport='no' port='20001' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>解决“使用中的端口”冲突的可能方法。使用127.0.0.0/24中的127.0.0.1以外的任何本地净地址,例如127.0.0.2等来收听。
注意:如果有人能想出一个更好的(即实际的)解决方案,我会接受另一个答案。这篇文章主要是给其他可能遇到同样问题的人写的。
发布于 2017-06-04 22:05:37
解决方案是告诉kvm/virt将不安全的连接用作默认连接。
<graphics type='spice' autoport='yes' listen='0.0.0.0' defaultMode='insecure'>
<listen type='address' address='0.0.0.0'/>
</graphics>将defaultMode设置为insecure,您甚至可以使用autoport='yes',一切都很好。
一个提示是,在搜索端口时,必须使用domdisplay:
[root@kvm repo]# virsh domdisplay --domain openshift1
spice://localhost:5900我不知道这是错误还是正确的行为,但是virsh domdisplay --domain openshift1的输出显示的是localhost而不是0.0.0.0。但是您可以通过服务器-ip/dns从外部连接到您的客户vm。请确保防火墙允许您连接到这些端口,甚至kvm/virt也会像上面所示的那样监听0.0.0.0。
发布于 2020-11-21 20:57:30
当virt-install的方便参数失败时,可以使用XPath语法手动创建xml。
用这五个参数对替换--graphics "spice,port=20001,defaultMode=insecure,autoport=no"对对我来说是一个成功的解决办法:
--xml 'xpath.delete=./devices/graphics' \
--xml './devices/graphics/@defaultMode=insecure' \
--xml './devices/graphics/@autoport=no' \
--xml './devices/graphics/@type=spice' \
--xml "./devices/graphics/@port=20001"我们中那些对生成的xml感兴趣的人可以添加--print-xml选项。
https://unix.stackexchange.com/questions/148794
复制相似问题