mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-07 14:43:01 -06:00
guest: convert_to_vnc: optionally add qemu-vdagent
Disabled by default, but maybe we turn it on in the future when qemu-vdagent supports migration. Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
d58299ee6b
commit
f7988a94e6
@ -8,6 +8,9 @@
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<devices>
|
||||
<channel type="qemu-vdagent">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<graphics type="vnc" port="-1"/>
|
||||
<video>
|
||||
<model type="vga"/>
|
||||
|
@ -13,7 +13,7 @@
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<devices>
|
||||
<channel type="spicevmc">
|
||||
<channel type="qemu-vdagent">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
|
@ -13,6 +13,9 @@
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<devices>
|
||||
<channel type="qemu-vdagent">
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<graphics type="vnc" port="5907"/>
|
||||
<sound model="ich9"/>
|
||||
<video>
|
||||
|
@ -12,6 +12,8 @@
|
||||
<graphics type='spice' port='5907' tlsPort='5901' autoport='no' passwd='sercet' passwdValidTo='2011-05-31T16:11:22' connected='disconnect' keymap='de' listen='127.0.0.1'>
|
||||
<listen type='socket' socket='/tmp/spice.sock'/>
|
||||
<listen type='address' address='127.0.0.1'/>
|
||||
<clipboard copypaste='no'/>
|
||||
<mouse mode='client'/>
|
||||
<gl enable='yes' rendernode='/dev/my/rendernode'/>
|
||||
</graphics>
|
||||
<graphics type='sdl'/>
|
||||
|
@ -18,6 +18,13 @@
|
||||
<acceleration accel3d="yes"/>
|
||||
</model>
|
||||
</video>
|
||||
<channel type="qemu-vdagent">
|
||||
<source>
|
||||
<clipboard copypaste="no"/>
|
||||
<mouse mode="client"/>
|
||||
</source>
|
||||
<target type="virtio" name="com.redhat.spice.0"/>
|
||||
</channel>
|
||||
<graphics type="egl-headless">
|
||||
<gl rendernode="/dev/my/rendernode"/>
|
||||
</graphics>
|
||||
|
@ -1220,12 +1220,12 @@ def testConvertToQ35():
|
||||
def testConvertToVNC():
|
||||
conn = utils.URIs.openconn(utils.URIs.kvm_x86)
|
||||
|
||||
def _test(filename_base):
|
||||
def _test(filename_base, **kwargs):
|
||||
guest, outfile = _get_test_content(conn, filename_base)
|
||||
guest.convert_to_vnc()
|
||||
guest.convert_to_vnc(**kwargs)
|
||||
_alter_compare(conn, guest.get_xml(), outfile)
|
||||
|
||||
_test("convert-to-vnc-empty")
|
||||
_test("convert-to-vnc-empty", qemu_vdagent=True)
|
||||
_test("convert-to-vnc-spice-devices")
|
||||
_test("convert-to-vnc-spice-manyopts")
|
||||
_test("convert-to-vnc-has-vnc")
|
||||
_test("convert-to-vnc-spice-manyopts", qemu_vdagent=True)
|
||||
_test("convert-to-vnc-has-vnc", qemu_vdagent=True)
|
||||
|
@ -843,7 +843,7 @@ class Guest(XMLBuilder):
|
||||
dev.rendernode = spicedev.rendernode
|
||||
self.add_device(dev)
|
||||
|
||||
def _convert_to_vnc_graphics(self):
|
||||
def _convert_to_vnc_graphics(self, agent):
|
||||
"""
|
||||
If there's already VNC graphics configured, we leave it intact,
|
||||
but rip out all evidence of other graphics devices.
|
||||
@ -894,6 +894,10 @@ class Guest(XMLBuilder):
|
||||
dev.add_child(listen)
|
||||
dev.set_defaults(self)
|
||||
|
||||
if agent:
|
||||
agent.source.clipboard_copypaste = srcdev.clipboard_copypaste
|
||||
agent.source.mouse_mode = srcdev.mouse_mode
|
||||
|
||||
def _convert_to_vnc_video(self):
|
||||
"""
|
||||
If there's no video device, add a default one.
|
||||
@ -920,7 +924,18 @@ class Guest(XMLBuilder):
|
||||
"removing it instead.", dev.model)
|
||||
self.remove_device(dev)
|
||||
|
||||
def convert_to_vnc(self):
|
||||
def _add_qemu_vdagent(self):
|
||||
if any(c for c in self.devices.channel if
|
||||
c.type == c.TYPE_QEMUVDAGENT):
|
||||
return
|
||||
|
||||
dev = DeviceChannel(self.conn)
|
||||
dev.type = dev.TYPE_QEMUVDAGENT
|
||||
dev.set_defaults(self)
|
||||
self.add_device(dev)
|
||||
return dev
|
||||
|
||||
def convert_to_vnc(self, qemu_vdagent=False):
|
||||
"""
|
||||
Convert existing XML to have one VNC graphics connection.
|
||||
"""
|
||||
@ -930,7 +945,11 @@ class Guest(XMLBuilder):
|
||||
# Could be necessary if XML is in broken state.
|
||||
self._force_remove_spice_devices()
|
||||
|
||||
self._convert_to_vnc_graphics()
|
||||
agent = None
|
||||
if qemu_vdagent:
|
||||
agent = self._add_qemu_vdagent()
|
||||
|
||||
self._convert_to_vnc_graphics(agent)
|
||||
self._convert_to_vnc_video()
|
||||
|
||||
def set_defaults(self, _guest):
|
||||
|
Loading…
Reference in New Issue
Block a user