From 56fee73b958ff4bcd56011aa2ffd31f4067ccd3f Mon Sep 17 00:00:00 2001 From: Guido Trotter <ultrotter@google.com> Date: Thu, 29 Jan 2009 15:51:29 +0000 Subject: [PATCH] KVM: Allow the HV_VNC_BIND_ADDRESS parameter Reviewed-by: iustinp --- lib/constants.py | 1 + lib/hypervisor/hv_kvm.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/constants.py b/lib/constants.py index 2e0b8d99a..b33054f77 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -448,6 +448,7 @@ HVC_DEFAULTS = { HV_ROOT_PATH: '/dev/vda', HV_ACPI: True, HV_SERIAL_CONSOLE: True, + HV_VNC_BIND_ADDRESS: None, }, HT_FAKE: { }, diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 25fbb9d9e..07c2a9d7c 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -54,6 +54,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): constants.HV_ROOT_PATH, constants.HV_ACPI, constants.HV_SERIAL_CONSOLE, + constants.HV_VNC_BIND_ADDRESS, ] _MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)', @@ -649,6 +650,13 @@ class KVMHypervisor(hv_base.BaseHypervisor): raise errors.HypervisorError("The initrd path must an absolute path" ", if defined") + vnc_bind_address = hvparams[constants.HV_VNC_BIND_ADDRESS] + if vnc_bind_address: + if not utils.IsValidIP(vnc_bind_address): + raise errors.OpPrereqError("given VNC bind address '%s' doesn't look" + " like a valid IP address" % + vnc_bind_address) + def ValidateParameters(self, hvparams): """Check the given parameters for validity. -- GitLab