Sandro Bonazzola has uploaded a new change for review. Change subject: packaging: setup: detect display port at runtime ......................................................................
packaging: setup: detect display port at runtime previously the tool wrongly assumed that the SPICE and the VNC port was always 5900. It may happen however that secureDisplayPort is set to 5901 instead of 5900. Now displayPort and secureDisplayPort are detected at runtime querying the status of the VM. Firewall ports 5900 and 5901 are now both open. Change-Id: I8ae46b061b2a3ad0190f798cb141a41431120839 Signed-off-by: Sandro Bonazzola <[email protected]> --- M src/plugins/ovirt-hosted-engine-setup/vm/runvm.py M templates/hosted-console.xml.in 2 files changed, 29 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/25/19925/1 diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py index fd656e1..4615048 100644 --- a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py +++ b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py @@ -63,22 +63,45 @@ ) def _generateUserMessage(self, console_type): + displayPort = 5900 + displaySecurePort = 5901 + serv = self.environment[ohostedcons.VDSMEnv.VDS_CLI] + try: + stats = serv.s.getVmStats( + self.environment[ohostedcons.VMEnv.VM_UUID] + ) + self.logger.debug(stats) + if not stats['status']['code'] == 0: + self.logger.error(stats['status']['message']) + else: + statsList = stats['statsList'][0] + displaySecurePort = statsList['displaySecurePort'] + displayPort = statsList['displayPort'] + except Exception: + self.logger.debug( + 'Error getting VM stats', + exc_info=True, + ) if console_type == 'vnc': return _( 'You can now connect to the VM with the following command:\n' - '\t{remote} vnc://localhost:5900\nUse temporary password ' - '"{password}" to connect to vnc console.\n' + '\t{remote} vnc://localhost:{displayPort}\n' + 'Use temporary password "{password}" ' + 'to connect to vnc console.\n' ).format( remote=self.command.get('remote-viewer'), password=self.environment[ ohostedcons.VMEnv.VM_PASSWD ], + displayPort=displayPort ) elif console_type == 'qxl': + if displaySecurePort < 0: + displaySecurePort = displayPort return _( 'You can now connect to the VM with the following command:\n' '\t{remote} --spice-ca-file={ca_cert} ' - 'spice://localhost?tls-port=5900 ' + 'spice://localhost?tls-port={displaySecurePort} ' '--spice-host-subject="{subject}"\nUse temporary password ' '"{password}" to connect to spice console.' ).format( @@ -88,6 +111,7 @@ password=self.environment[ ohostedcons.VMEnv.VM_PASSWD ], + displaySecurePort=displaySecurePort ) else: diff --git a/templates/hosted-console.xml.in b/templates/hosted-console.xml.in index db00dd3..c7dee98 100644 --- a/templates/hosted-console.xml.in +++ b/templates/hosted-console.xml.in @@ -4,4 +4,6 @@ <description>oVirt Hosted Engine console service</description> <port protocol="tcp" port="5900"/> <port protocol="udp" port="5900"/> + <port protocol="tcp" port="5901"/> + <port protocol="udp" port="5901"/> </service> -- To view, visit http://gerrit.ovirt.org/19925 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8ae46b061b2a3ad0190f798cb141a41431120839 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: ovirt-hosted-engine-setup-1.0 Gerrit-Owner: Sandro Bonazzola <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
