mirror of
https://github.com/virt-manager/virt-manager.git
synced 2026-08-10 04:58:08 -05:00
viewers: Drop old style VNC socket handling
In all modern local cases we will be using openFD to get a direct file descriptor from the VM, so this code should never be triggered nowadays Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<domain type="kvm">
|
||||
<name>uitests-vnc-socket</name>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="x86_64">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<devices>
|
||||
<graphics type="vnc" socket="/tmp/vmm-uitests-vnc.sock"/>
|
||||
<console type='pty'/>
|
||||
</devices>
|
||||
</domain>
|
||||
|
||||
@@ -184,6 +184,26 @@ class Console(uiutils.UITestCase):
|
||||
return self._checkPassword()
|
||||
|
||||
|
||||
@_vm_wrapper("uitests-vnc-socket")
|
||||
def testConsoleVNCSocket(self, dom):
|
||||
ignore = dom
|
||||
win = self.app.topwin
|
||||
con = win.find("console-gfx-viewport")
|
||||
uiutils.check(lambda: con.showing)
|
||||
|
||||
def _click_textconsole_menu(msg):
|
||||
vmenu = win.find("^View$", "menu")
|
||||
vmenu.click()
|
||||
tmenu = win.find("Text Consoles", "menu")
|
||||
tmenu.point()
|
||||
tmenu.find(msg, "radio menu item").click()
|
||||
|
||||
# A bit of an extra test, make sure selecting Graphical Console works
|
||||
_click_textconsole_menu("Text Console 1")
|
||||
uiutils.check(lambda: not con.showing)
|
||||
_click_textconsole_menu("Graphical Console")
|
||||
uiutils.check(lambda: con.showing)
|
||||
|
||||
@_vm_wrapper("uitests-lxc-serial", uri="lxc:///")
|
||||
def testConsoleLXCSerial(self):
|
||||
"""
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
# This work is licensed under the GNU GPLv2 or later.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
import socket
|
||||
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import GObject
|
||||
|
||||
@@ -284,7 +282,6 @@ class VNCViewer(Viewer):
|
||||
def __init__(self, *args, **kwargs):
|
||||
Viewer.__init__(self, *args, **kwargs)
|
||||
self._display = None
|
||||
self._sockfd = None
|
||||
self._desktop_resolution = None
|
||||
|
||||
|
||||
@@ -365,9 +362,6 @@ class VNCViewer(Viewer):
|
||||
|
||||
def close(self):
|
||||
self._display.close()
|
||||
if self._sockfd:
|
||||
self._sockfd.close()
|
||||
self._sockfd = None
|
||||
|
||||
def _is_open(self):
|
||||
return self._display.is_open()
|
||||
@@ -443,29 +437,8 @@ class VNCViewer(Viewer):
|
||||
|
||||
def _open_host(self):
|
||||
host, port, ignore = self._ginfo.get_conn_host()
|
||||
|
||||
if not self._ginfo.gsocket:
|
||||
log.debug("VNC connecting to host=%s port=%s", host, port)
|
||||
self._display.open_host(host, port)
|
||||
return
|
||||
|
||||
log.debug("VNC connecting to socket=%s", self._ginfo.gsocket)
|
||||
try:
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sock.connect(self._ginfo.gsocket)
|
||||
self._sockfd = sock
|
||||
except Exception as e:
|
||||
raise RuntimeError(
|
||||
_("Error opening socket path '%(path)s': %(error)s") % {
|
||||
"path": self._ginfo.gsocket,
|
||||
"error": e,
|
||||
})
|
||||
|
||||
fd = self._sockfd.fileno()
|
||||
if fd < 0:
|
||||
raise RuntimeError((_("Error opening socket path '%s'") %
|
||||
self._ginfo.gsocket) + " fd=%s" % fd)
|
||||
self._open_fd(fd)
|
||||
log.debug("VNC connecting to host=%s port=%s", host, port)
|
||||
self._display.open_host(host, port)
|
||||
|
||||
def _open_fd(self, fd):
|
||||
self._display.open_fd(fd)
|
||||
|
||||
Reference in New Issue
Block a user