The default port and tlsPort should be configured only if no listen type was specified or the listen type is "address" or "network". For other listen types the port and tlsPort doesn't make sense. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- tests/cli-test-xml/compare/virt-install-many-devices.xml | 2 +- virtinst/devicegraphics.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml index 11a0771b..d0ab6eec 100644 --- a/tests/cli-test-xml/compare/virt-install-many-devices.xml +++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml @@ -234,7 +234,7 @@ <mouse mode="client"/> <filetransfer enable="yes"/> </graphics> - <graphics type="spice" port="-1" tlsPort="-1" autoport="yes"> + <graphics type="spice"> <gl enable="yes"/> <image compression="off"/> <listen type="socket"/> diff --git a/virtinst/devicegraphics.py b/virtinst/devicegraphics.py index ac69df5e..d7f04535 100644 --- a/virtinst/devicegraphics.py +++ b/virtinst/devicegraphics.py @@ -144,12 +144,15 @@ class VirtualGraphics(VirtualDevice): val = _validate_port("TLS Port", val) self.autoport = self._get_default_autoport() return val + def _listen_need_port(self): + listen = self.get_first_listen_type() + return not listen or listen in ["address", "network"] def _get_default_port(self): - if self.type == "vnc" or self.type == "spice": + if (self.type == "vnc" or self.type == "spice") and self._listen_need_port(): return -1 return None def _get_default_tlsport(self): - if self.type == "spice": + if self.type == "spice" and self._listen_need_port(): return -1 return None def _get_default_autoport(self): -- 2.13.5 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list