Spawn vncviewer from qemu-dm.

- add vncviewer option to qemu-dm to spawn a vncviewer process.
- add the `vncconsole' config parameter which enables qemu-dm's vncviewer
  option.

Based on a patch from: Don Dugger <donald.d.dugger@intel.com>
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
This commit is contained in:
chris@kneesaa.uk.xensource.com committed 2006-07-14 18:53:27 +01:00
1 parent 0dffe4b8a2
commit da71e93abc
8 files changed
+164 -32

No files matched your search

+3 -18
View File
@@ -208,6 +208,7 @@ class HVMImageHandler(ImageHandler):
raise VmError("hvm: missing device model")
self.display = sxp.child_value(imageConfig, 'display')
self.xauthority = sxp.child_value(imageConfig, 'xauthority')
self.vncconsole = sxp.child_value(imageConfig, 'vncconsole')
self.vm.storeVm(("image/dmargs", " ".join(self.dmargs)),
("image/device-model", self.device_model),
@@ -335,11 +336,7 @@ class HVMImageHandler(ImageHandler):
return
# Execute device model.
#todo: Error handling
# XXX RN: note that the order of args matter!
args = [self.device_model]
vnc = self.vncParams()
if len(vnc):
args = args + vnc
args = args + ([ "-d", "%d" % self.vm.getDomid(),
"-m", "%s" % (self.vm.getMemoryTarget() / 1024)])
args = args + self.dmargs
@@ -348,24 +345,12 @@ class HVMImageHandler(ImageHandler):
env['DISPLAY'] = self.display
if self.xauthority:
env['XAUTHORITY'] = self.xauthority
if self.vncconsole:
args = args + ([ "-vncviewer" ])
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)
def vncParams(self):
# see if a vncviewer was specified
# XXX RN: bit of a hack. should unify this, maybe stick in config space
vncconnect=[]
args = self.cmdline
if args:
arg_list = string.split(args)
for arg in arg_list:
al = string.split(arg, '=')
if al[0] == "VNC_VIEWER":
vncconnect=["-vncconnect", "%s" % al[1]]
break
return vncconnect
def destroy(self):
self.unregister_shutdown_watch();
import signal
+19 -12
View File
@@ -112,6 +112,12 @@ gopts.var('vncviewer', val='no|yes',
Only valid when vnc=1.
""")
gopts.var('vncconsole', val='no|yes',
fn=set_bool, default=None,
use="""Spawn a vncviewer process for the domain's graphical console.
Only valid when vnc=1.
""")
gopts.var('name', val='NAME',
fn=set_value, default=None,
use="Domain name. Must be unique.")
@@ -625,7 +631,7 @@ def configure_hvm(config_image, vals):
"""
args = [ 'device_model', 'pae', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'audio',
'vnc', 'vncdisplay', 'vncviewer', 'sdl', 'display',
'vnc', 'vncdisplay', 'vncconsole', 'sdl', 'display',
'acpi', 'apic', 'xauthority', 'usb', 'usbdevice' ]
for a in args:
if (vals.__dict__[a]):
@@ -854,17 +860,18 @@ def preprocess_vnc(vals):
"""If vnc was specified, spawn a vncviewer in listen mode
and pass its address to the domain on the kernel command line.
"""
if not (vals.vnc and vals.vncviewer) or vals.dryrun: return
vnc_display = choose_vnc_display()
if not vnc_display:
warn("No free vnc display")
return
print 'VNC=', vnc_display
vnc_port = spawn_vnc(vnc_display)
if vnc_port > 0:
vnc_host = get_host_addr()
vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port)
vals.extra = vnc + ' ' + vals.extra
if vals.dryrun: return
if vals.vncviewer:
vnc_display = choose_vnc_display()
if not vnc_display:
warn("No free vnc display")
return
print 'VNC=', vnc_display
vnc_port = spawn_vnc(vnc_display)
if vnc_port > 0:
vnc_host = get_host_addr()
vnc = 'VNC_VIEWER=%s:%d' % (vnc_host, vnc_port)
vals.extra = vnc + ' ' + vals.extra
def preprocess(vals):
if not vals.kernel and not vals.bootloader:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.