mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
Set up X11 authorization when a VMX domain uses SDL.
Signed-off-by: Hiromichi Itou <ito@begi.net>
This commit is contained in:
1 parent
ada4e79b32
commit
5fb7e24473
2 files changed
+12
-1
No files matched your search
@@ -194,6 +194,7 @@ class VmxImageHandler(ImageHandler):
|
||||
if not self.device_model:
|
||||
raise VmError("vmx: missing device model")
|
||||
self.display = sxp.child_value(imageConfig, 'display')
|
||||
self.xauthority = sxp.child_value(imageConfig, 'xauthority')
|
||||
|
||||
self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
|
||||
("image/device-model", self.device_model),
|
||||
@@ -340,6 +341,8 @@ class VmxImageHandler(ImageHandler):
|
||||
env = dict(os.environ)
|
||||
if self.display:
|
||||
env['DISPLAY'] = self.display
|
||||
if self.xauthority:
|
||||
env['XAUTHORITY'] = self.xauthority
|
||||
log.info("spawning device models: %s %s", self.device_model, args)
|
||||
self.pid = os.spawnve(os.P_NOWAIT, self.device_model, args, env)
|
||||
log.info("device model pid: %d", self.pid)
|
||||
|
||||
@@ -388,6 +388,10 @@ gopts.var('display', val='DISPLAY',
|
||||
fn=set_value, default=None,
|
||||
use="X11 display to use")
|
||||
|
||||
gopts.var('xauthority', val='XAUTHORITY',
|
||||
fn=set_value, default=None,
|
||||
use="X11 Authority to use")
|
||||
|
||||
|
||||
def err(msg):
|
||||
"""Print an error to stderr and exit.
|
||||
@@ -526,7 +530,8 @@ def configure_vmx(config_image, vals):
|
||||
"""
|
||||
args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
|
||||
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
|
||||
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic',
|
||||
'xauthority' ]
|
||||
for a in args:
|
||||
if (vals.__dict__[a]):
|
||||
config_image.append([a, vals.__dict__[a]])
|
||||
@@ -801,6 +806,9 @@ def parseCommandLine(argv):
|
||||
if not gopts.vals.display:
|
||||
gopts.vals.display = os.getenv("DISPLAY")
|
||||
|
||||
if not gopts.vals.xauthority:
|
||||
gopts.vals.xauthority = os.getenv("XAUTHORITY")
|
||||
|
||||
# Process remaining args as config variables.
|
||||
for arg in args:
|
||||
if '=' in arg:
|
||||
|
||||