gfxdetails: Fix switching from listen=none to listen=address

... with the 'hypervisor default' address. In this case, we need to
force set port=-1 in the XML, to make the changes actually stick

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2022-01-20 13:31:57 -05:00
parent 5622854d8c
commit 2815b7406e

View File

@ -268,16 +268,25 @@ class vmmGraphicsDetails(vmmGObjectUI):
if not self.widget("graphics-password-chk").get_active():
passwd = None
portauto = self.widget("graphics-port-auto").get_active()
port = uiutil.spin_get_helper(self.widget("graphics-port"))
if self.widget("graphics-port-auto").get_active():
if (self.widget("graphics-port-auto").get_inconsistent() and
self.widget("graphics-port-auto").is_visible()):
# When switching from listen=None to listen=address with
# Hypervisor default, we need to force autoport otherwise
# the XML change doesn't stick
self._active_edits.append(_EDIT_GFX_PORT)
portauto = True
if portauto:
port = -1
listen = uiutil.get_list_selection(self.widget("graphics-listen-type"))
addr = uiutil.get_list_selection(self.widget("graphics-address"))
if listen and listen != "none":
listen = addr
else:
if listen and listen == "none":
port = None
elif listen:
listen = addr
gtype = uiutil.get_list_selection(self.widget("graphics-type"))