--- a/components/openstack/nova/files/zone-vnc-console Tue Mar 31 13:48:00 2015 -0700
+++ b/components/openstack/nova/files/zone-vnc-console Wed Apr 01 17:30:47 2015 -0700
@@ -32,6 +32,7 @@
XRANDR = "/usr/bin/xrandr"
XSTARTUPHDR = "# WARNING: THIS FILE GENERATED BY SMF.\n" + \
"# DO NOT EDIT THIS FILE. EDITS WILL BE LOST.\n"
+XRESOURCES = "[[ -f ~/.Xresources ]] && /usr/bin/xrdb -merge ~/.Xresources\n"
XTERM = "/usr/bin/xterm"
# Borderless, Monospsce font, point size 14, white foreground on black
# background are reasonable defaults.
@@ -40,7 +41,7 @@
XWININFO = "/usr/bin/xwininfo"
# Enclose command in comments to prevent xterm consuming zlogin opts
ZLOGINOPTS = ' -e "/usr/bin/pfexec /usr/sbin/zlogin -C -E $ZONENAME"\n'
-XSTARTUP = XSTARTUPHDR + XTERM + XTERMOPTS + ZLOGINOPTS
+XSTARTUP = XSTARTUPHDR + XRESOURCES + XTERM + XTERMOPTS + ZLOGINOPTS
def start():
@@ -162,13 +163,18 @@
to match using XRANDR. Treat failure as non-fatal since an
incorrectly sized console is arguably better than none.
"""
+ class UninitializedWindowError(Exception):
+ pass
+
class UnmappedWindowError(Exception):
pass
def _get_window_geometry(display, windowname):
""" Find the xterm xwindow by name/title and extract its geometry
Returns: tuple of window [width, height]
- Raises: UnmappedWindowError if window is not viewable/unmapped
+ Raises:
+ UninitializedWindowError if window not yet initialized
+ UnmappedWindowError if window is not viewable/mapped
"""
cmd = [XWININFO, '-d', display, '-name', windowname]
xwininfo = subprocess.Popen(cmd, stdout=subprocess.PIPE,
@@ -177,7 +183,7 @@
retcode = xwininfo.wait()
if retcode != 0:
print "Error finding console xwindow info: " + err
- return
+ raise UninitializedWindowError
width = None
height = None
@@ -201,23 +207,38 @@
print "No window geometry info returned by " + XWINFINFO
raise UnmappedWindowError
- retries = 5
+ retries = 10
+ sleep = 1
+ uninit_count = 0
+ unmap_count = 0
width = 0
height = 0
- for tries in range(retries):
+ while uninit_count < retries and unmap_count < retries:
try:
width, height = _get_window_geometry(display,
'Zone Console: ' + zonename)
print "Discovered xterm geometry: %d x %d" % (width, height)
break
+ except UninitializedWindowError:
+ if uninit_count < retries:
+ print "xterm window not initialized yet. Retrying in %ds" \
+ % sleep
+ uninit_count += 1
+ time.sleep(sleep)
+ continue
+ else:
+ print "xterm window is taking too long to initialize"
+ break
except UnmappedWindowError:
- if tries < retries:
- print "Discovered xterm not mapped yet. Retrying in 0.5s"
- time.sleep(0.5)
+ if unmap_count < retries:
+ print "Discovered xterm not mapped yet. Retrying in %ds" \
+ % sleep
+ unmap_count += 1
+ time.sleep(sleep)
continue
else:
print "Discovered xterm window is taking too long to map"
- return
+ break
else:
print "Too many failed attempts to discover xterm window geometry"
return
--- a/components/openstack/nova/files/zone-vnc-console.xml Tue Mar 31 13:48:00 2015 -0700
+++ b/components/openstack/nova/files/zone-vnc-console.xml Wed Apr 01 17:30:47 2015 -0700
@@ -38,7 +38,7 @@
<logfile_attributes permissions='600'/>
- <exec_method timeout_seconds="10" type="method" name="start"
+ <exec_method timeout_seconds="60" type="method" name="start"
exec="/lib/svc/method/zone-vnc-console %m">
<method_context>
<method_credential user='nova' group='nova' />
--- a/components/openstack/nova/nova.p5m Tue Mar 31 13:48:00 2015 -0700
+++ b/components/openstack/nova/nova.p5m Wed Apr 01 17:30:47 2015 -0700
@@ -864,6 +864,9 @@
# force a group dependency on package delivering the optional xrandr(1)
depend type=group fmri=__TBD pkg.debug.depend.file=usr/bin/xrandr
+# force a group dependency on package delivering the optional xrdb(1)
+depend type=group fmri=__TBD pkg.debug.depend.file=usr/bin/xrdb
+
# force a group dependency on package delivering the optional xterm(1)
depend type=group fmri=__TBD pkg.debug.depend.file=usr/bin/xterm