Displaying the Virtual Machine Console
After a vApp is powered on, you can retrieve a screen ticket from any of its virtual machines. You use that ticket with the VMware HTML Console SDK to access the virtual machine console from a browser.
Each
Vm
element in a vApp includes a link where
rel="screen:acquireMksTicket"
if the virtual machine
it represents is powered on. You can use that link to retrieve a screen ticket
that includes all the information you need to create a VMware HTML Console to
access the virtual machine.
Note: A
Vm
element might also contain a link of the form:
<Link rel="screen:acquireTicket" href="https://vcloud.example.com/api/vApp/vm-4/screen/action/acquireTicket" />This link is provided for compatibility with older systems. The ticket returned by a request to this link is not compatible with this release of VMware Cloud Director.
Prerequisites
-
This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.
- Verify that the virtual machine whose console you want to display is powered on.
- Download and unzip the VMware HTML Console SDK version 2.1 or later.
Procedure
Example: Using an MksTicket in a VMware HTML Console SDK Script
This HTML fragment shows a
Script
element derived from an example in the VMware HTML Console SDK
Release Notes.
In this example:
- The contents of the
Vmx
element in the
MksTicket is quoted and
passed as the first parameter to the as SDK
createWMKS method. You
must also pass the boolean option
enableUint8Utf8 to this
method specifying a value of
true
. - The URL passed as a
parameter to the SDK
wmks.connect method
includes the following information from the
MksTicket.
- console-ip-address is the IP address of the virtual machine, returned in the Host element of the MksTicket.
- console-port is the VMware Cloud Director console proxy port (defaults to 443).
- Mks-port is the value returned in the Port element of the MksTicket
- ticket is the string returned in the Ticket element of the MksTicket. The ticket-string is valid for 30 seconds from the time you retrieve the MksTicket.
<script> var wmks = WMKS.createWMKS("wmksContainer",{VCDProxyHandshakeVmxPath: "vmfs/volumes/5331e00b-467faf9c-5561-d48564677c70/example-vm (19115346-c01c-4c9b-a21f-d487865a9f98)/example-vm (19115346-c01c-4c9b-a21f-d487865a9f98).vmx.vmx", enableUint8Utf8:true}) .register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, function(event,data){ if(data.state == WMKS.CONST.ConnectionState.CONNECTED){ console.log("connection state change : connected");} }); wmks.connect("wss://10.150.130.63:443/902;ticket-string"); </script>