mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
Import the Xend parts of xen-unstable changeset
11840:02506a7443155611d6bbf03e49fbf193e96d24db. [HVM] Implement password authentication of VNC connections. The specification is as mentioned at http://lists.xensource.com/archives/html/xen-devel/2006-09/msg00666.html (However, password came to describe plain text) The difference is follows. - protocol_authtype() without the necessity was deleted. - The check on the protocol version was added. - And, some small modification. Signed-off-by: Masami Watanabe <masami.watanabe@jp.fujitsu.com>
This commit is contained in:
1 parent
a81b06e66a
commit
8f988fdcc8
4 files changed
+47
-1
No files matched your search
@@ -93,6 +93,8 @@ class XendRoot:
|
||||
|
||||
dom0_vcpus_default = '0'
|
||||
|
||||
vncpasswd_default = None
|
||||
|
||||
"""Default interface to listen for VNC connections on"""
|
||||
xend_vnc_listen_default = '127.0.0.1'
|
||||
|
||||
@@ -287,6 +289,10 @@ class XendRoot:
|
||||
def get_vnclisten_address(self):
|
||||
return self.get_config_value('vnc-listen', self.xend_vnc_listen_default)
|
||||
|
||||
def get_vncpasswd_default(self):
|
||||
return self.get_config_value('vncpasswd',
|
||||
self.vncpasswd_default)
|
||||
|
||||
def instance():
|
||||
"""Get an instance of XendRoot.
|
||||
Use this instead of the constructor.
|
||||
|
||||
@@ -354,23 +354,49 @@ class HVMImageHandler(ImageHandler):
|
||||
sdl = sxp.child_value(config, 'sdl')
|
||||
ret = []
|
||||
nographic = sxp.child_value(config, 'nographic')
|
||||
|
||||
# get password from VM config (if password omitted, None)
|
||||
vncpasswd_vmconfig = sxp.child_value(config, 'vncpasswd')
|
||||
|
||||
if nographic:
|
||||
ret.append('-nographic')
|
||||
# remove password
|
||||
if vncpasswd_vmconfig:
|
||||
config.remove(['vncpasswd', vncpasswd_vmconfig])
|
||||
return ret
|
||||
|
||||
if vnc:
|
||||
vncdisplay = sxp.child_value(config, 'vncdisplay',
|
||||
int(self.vm.getDomid()))
|
||||
|
||||
vncunused = sxp.child_value(config, 'vncunused')
|
||||
if vncunused:
|
||||
ret += ['-vncunused']
|
||||
else:
|
||||
ret += ['-vnc', '%d' % vncdisplay]
|
||||
|
||||
ret += ['-k', 'en-us']
|
||||
|
||||
vnclisten = sxp.child_value(config, 'vnclisten')
|
||||
if not(vnclisten):
|
||||
vnclisten = xen.xend.XendRoot.instance().get_vnclisten_address()
|
||||
vnclisten = (xen.xend.XendRoot.instance().
|
||||
get_vnclisten_address())
|
||||
if vnclisten:
|
||||
ret += ['-vnclisten', vnclisten]
|
||||
|
||||
vncpasswd = vncpasswd_vmconfig
|
||||
if vncpasswd is None:
|
||||
vncpasswd = (xen.xend.XendRoot.instance().
|
||||
get_vncpasswd_default())
|
||||
if vncpasswd is None:
|
||||
raise VmError('vncpasswd is not set up in ' +
|
||||
'VMconfig and xend-config.')
|
||||
if vncpasswd != '':
|
||||
self.vm.storeVm("vncpasswd", vncpasswd)
|
||||
|
||||
# remove password
|
||||
config.remove(['vncpasswd', vncpasswd_vmconfig])
|
||||
|
||||
return ret
|
||||
|
||||
def createDeviceModel(self):
|
||||
|
||||
@@ -104,6 +104,10 @@ gopts.opt('console_autoconnect', short='c',
|
||||
fn=set_true, default=0,
|
||||
use="Connect to the console after the domain is created.")
|
||||
|
||||
gopts.var('vncpasswd', val='NAME',
|
||||
fn=set_value, default=None,
|
||||
use="Password for VNC console on HVM domain.")
|
||||
|
||||
gopts.var('vncviewer', val='no|yes',
|
||||
fn=set_bool, default=None,
|
||||
use="Spawn a vncviewer listening for a vnc server in the domain.\n"
|
||||
@@ -660,6 +664,7 @@ def configure_hvm(config_image, vals):
|
||||
for a in args:
|
||||
if (vals.__dict__[a]):
|
||||
config_image.append([a, vals.__dict__[a]])
|
||||
config_image.append(['vncpasswd', vals.vncpasswd])
|
||||
|
||||
def run_bootloader(vals, config_image):
|
||||
if not os.access(vals.bootloader, os.X_OK):
|
||||
|
||||