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:
Cole Robinson
2020-08-29 16:49:52 -04:00
parent 940bd3873e
commit e414fc3bdc
3 changed files with 37 additions and 29 deletions
@@ -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>
+20
View File
@@ -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):
"""
+2 -29
View File
@@ -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)