4070N/A# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. 4070N/A# Licensed under the Apache License, Version 2.0 (the "License"); you may 4070N/A# not use this file except in compliance with the License. You may obtain 4070N/A# Unless required by applicable law or agreed to in writing, software 4070N/A# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 4070N/A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 4070N/A# License for the specific language governing permissions and limitations 3809N/A "# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.\n" 4070N/A# Borderless, Monospsce font, point size 14, white foreground on black 4070N/A# background are reasonable defaults. 4070N/A '"Zone Console: $ZONENAME"' 4626N/A# Port ranges allocated for VNC and X11 sockets. 3809N/A# Enclose command in comments to prevent xterm consuming zlogin opts 4626N/A # This is meant to be an on-demand service. 4626N/A # Determine if nova-compute requested enablement of this instance. 4626N/A # Exit with SMF_EXIT_TEMP_DISABLE if not true. 4626N/A "nova-compute starts this service on demand") 4626N/A # NOTE: 'geometry' is that which matches the size of standard 4626N/A # 80 character undecorated xterm window using font style specified 4626N/A # in XTERMOPTS. The geometry doesn't matter too much because the 4626N/A # display will be resized using xrandr once the xterm geometry is 4626N/A "-SecurityTypes=None",
"-geometry",
"964x580",
4626N/A # set SMF instance port num prop 3809N/A # first kill the SMF contract 3809N/A # 1 is returncode if no SMF contract processes were matched, 3809N/A # meaning they have already terminated. 3809N/A print "failed to kill the SMF contract: %s" %
cpe 3809N/A # reset port num prop to initial zero value 3809N/A print("VNC console service not available on this compute node. " 3809N/A print("VNC console service not available on this compute node. " 4070N/A """ Try to determine xterm window geometry and resize the Xvnc display 4070N/A to match using XRANDR. Treat failure as non-fatal since an 4070N/A incorrectly sized console is arguably better than none. 4070N/A Returns: tuple of window [width, height] 4070N/A UninitializedWindowError if window not yet initialized 4070N/A print "Error finding console xwindow info: " +
err 4070N/A # Window is not mapped yet. 4070N/A # What, no width and height??? 4070N/A print "xterm window not initialized yet. Retrying in %ds" \
4070N/A print "xterm window is taking too long to initialize" 4070N/A print "Discovered xterm not mapped yet. Retrying in %ds" \
4070N/A print "Discovered xterm window is taking too long to map" 4070N/A print "Too many failed attempts to discover xterm window geometry" 4070N/A # Generate a mode line for width and height, with a refresh of 60.0Hz 4070N/A print "Error creating new modeline for VNC display: " +
err 4070N/A # Create a new mode for the Xvnc server using the modeline generated by gtf 4070N/A print "Error creating new xrandr modeline for VNC display: " +
err 4070N/A # Add the new mode to the default display output 4070N/A print "Error adding new xrandr modeline for VNC display: " +
err 4070N/A # Activate the new mode on the default display output 4070N/A print "Error setting new xrandr modeline for VNC display: " +
err 4626N/A """Ensures instance exclusive use of VNC, X11 service ports 4626N/A Generator yields an integer of the port relative to port_start to use. 4626N/A eg. 32: VNC port 5932, X11 port 6032, X11 display :32 4626N/A lockfile is port specific and prevents multiple instances from 4626N/A attempting to use the same port number during SMF start method 4626N/A Socket binding on address:port establishes that the port is not 4626N/A already in use by another Xvnc process 4626N/A # Acquire port file lock first to lock out other instances trying 4626N/A # to come online in parallel. They will grab the next available 4626N/A # Ensure the standard X11 locking files are not present 4626N/A print ("Warning: X11 display :{0} is taken because of " 4626N/A "{1}\nRemove this file if there is no X "