zone-vnc-console revision 3652
8d483882aa3390058094b043f3d62187b5d1de03mlffrom subprocess import CalledProcessError, check_call, Popen
8d483882aa3390058094b043f3d62187b5d1de03mlfXSTARTUPHDR = "# WARNING: THIS FILE GENERATED BY SMF.\n" + \
8d483882aa3390058094b043f3d62187b5d1de03mlf "# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.\n"
8d483882aa3390058094b043f3d62187b5d1de03mlf# Monospsce font, point size 15, white foreground on black background"
8d483882aa3390058094b043f3d62187b5d1de03mlf# Enclose command in comments to prevent xterm consuming zlogin opts
8d483882aa3390058094b043f3d62187b5d1de03mlfZLOGINOPTS = ' -e "/usr/bin/pfexec /usr/sbin/zlogin -C -E $ZONENAME"\n'
8d483882aa3390058094b043f3d62187b5d1de03mlf # NOTE: 'geometry' below is that which matches the size of standard
8d483882aa3390058094b043f3d62187b5d1de03mlf # 80 character undecorated xterm window using font style specified in
8d483882aa3390058094b043f3d62187b5d1de03mlf # XTERMOPTS. Update this geometry whenever XTERMOPTS are changed.
8d483882aa3390058094b043f3d62187b5d1de03mlf # Avoids exposing X root window within noVNC canvas widget.
8d483882aa3390058094b043f3d62187b5d1de03mlf cmd = [VNCSERVER, "-name", desktop_name, "-SecurityTypes=None",
8d483882aa3390058094b043f3d62187b5d1de03mlf vnc = Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
8d483882aa3390058094b043f3d62187b5d1de03mlf if line.startswith("New '%s' desktop is" % desktop_name):
8d483882aa3390058094b043f3d62187b5d1de03mlf # set host prop
8d483882aa3390058094b043f3d62187b5d1de03mlf # set port num prop
8d483882aa3390058094b043f3d62187b5d1de03mlf cmd = [SVCCFG, '-s', fmri, 'setprop', 'vnc/port', '=', 'integer:',
8d483882aa3390058094b043f3d62187b5d1de03mlf # first kill the SMF contract
8d483882aa3390058094b043f3d62187b5d1de03mlf # 1 is returncode if no SMF contract processes were matched,
8d483882aa3390058094b043f3d62187b5d1de03mlf # meaning they have already terminated.
7014882c6a3672fd0e5d60200af8643ae53c5928Richard Lowe # reset port num prop to initial zero value
8d483882aa3390058094b043f3d62187b5d1de03mlf cmd = [SVCCFG, '-s', fmri, 'setprop', 'vnc/port', '=', 'integer:',
8d483882aa3390058094b043f3d62187b5d1de03mlf print("VNC console service not available on this compute node. "
8d483882aa3390058094b043f3d62187b5d1de03mlf print("VNC console service not available on this compute node. "
8d483882aa3390058094b043f3d62187b5d1de03mlf # Always clobber xstartup
8d483882aa3390058094b043f3d62187b5d1de03mlf # stemp tuple = [fd, path]