mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-25 23:21:45 +03:00
virt-manager: connect with openGraphicsFD
This allows to connect to VM without any display listening socket, the fd passing is done through libvirt connection. Furthermore, since it uses unix socket, spice can use virgl locally with texture sharing. This effectively enables spice-gtk to display local virgl rendering. Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
This commit is contained in:
parent
ea1bd169c1
commit
5c451b6401
@ -621,7 +621,7 @@ class vmmConsolePages(vmmGObjectUI):
|
||||
gdevs = self.vm.get_graphics_devices()
|
||||
gdev = gdevs and gdevs[0] or None
|
||||
if gdev:
|
||||
ginfo = ConnectionInfo(self.vm.conn, gdev)
|
||||
ginfo = ConnectionInfo(self.vm, gdev)
|
||||
except Exception, e:
|
||||
# We can fail here if VM is destroyed: xen is a bit racy
|
||||
# and can't handle domain lookups that soon after
|
||||
|
@ -1116,6 +1116,9 @@ class vmmDomain(vmmLibvirtObject):
|
||||
def open_console(self, devname, stream, flags=0):
|
||||
return self._backend.openConsole(devname, stream, flags)
|
||||
|
||||
def open_graphics_fd(self):
|
||||
return self._backend.openGraphicsFD(0)
|
||||
|
||||
def refresh_snapshots(self):
|
||||
self._snapshot_list = None
|
||||
|
||||
|
@ -32,7 +32,9 @@ class ConnectionInfo(object):
|
||||
"""
|
||||
Holds all the bits needed to make a connection to a graphical console
|
||||
"""
|
||||
def __init__(self, conn, gdev):
|
||||
def __init__(self, vm, gdev):
|
||||
conn = vm.conn
|
||||
self.vm = vm
|
||||
self.gtype = gdev.type
|
||||
self.gport = gdev.port and str(gdev.port) or None
|
||||
self.gsocket = gdev.socket
|
||||
@ -47,6 +49,9 @@ class ConnectionInfo(object):
|
||||
if self._connhost == "localhost":
|
||||
self._connhost = "127.0.0.1"
|
||||
|
||||
def get_conn_fd(self):
|
||||
return self.vm.open_graphics_fd()
|
||||
|
||||
def _is_listen_localhost(self, host=None):
|
||||
try:
|
||||
return ipaddr.IPNetwork(host or self.gaddr).is_loopback
|
||||
|
@ -133,6 +133,10 @@ class Viewer(vmmGObject):
|
||||
def _open(self):
|
||||
if self._ginfo.need_tunnel():
|
||||
self._open_fd(self._tunnels.open_new())
|
||||
return
|
||||
connfd = self._ginfo.get_conn_fd()
|
||||
if connfd != -1:
|
||||
self._open_fd(connfd)
|
||||
else:
|
||||
self._open_host()
|
||||
|
||||
@ -545,6 +549,11 @@ class SpiceViewer(Viewer):
|
||||
self._tunnels.unlock()
|
||||
|
||||
def _channel_open_fd_request(self, channel, tls_ignore):
|
||||
if not self._ginfo.need_tunnel():
|
||||
connfd = self._ginfo.get_conn_fd()
|
||||
channel.open_fd(connfd)
|
||||
return
|
||||
|
||||
if not self._tunnels:
|
||||
# Can happen if we close the details window and clear self._tunnels
|
||||
# while initially connecting to spice and channel FD requests
|
||||
|
Loading…
Reference in New Issue
Block a user