Revision 8447f52b
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
264 | 264 |
vnc_bind_address = instance.hvparams[constants.HV_VNC_BIND_ADDRESS] |
265 | 265 |
if vnc_bind_address: |
266 | 266 |
kvm_cmd.extend(['-usbdevice', 'tablet']) |
267 |
if instance.network_port > constants.HT_HVM_VNC_BASE_PORT: |
|
268 |
display = instance.network_port - constants.HT_HVM_VNC_BASE_PORT |
|
269 |
if vnc_bind_address == '0.0.0.0': |
|
270 |
vnc_arg = ':%d' % (display) |
|
267 |
if utils.IsValidIP(vnc_bind_address): |
|
268 |
if instance.network_port > constants.HT_HVM_VNC_BASE_PORT: |
|
269 |
display = instance.network_port - constants.HT_HVM_VNC_BASE_PORT |
|
270 |
if vnc_bind_address == '0.0.0.0': |
|
271 |
vnc_arg = ':%d' % (display) |
|
272 |
else: |
|
273 |
vnc_arg = '%s:%d' % (constants.HV_VNC_BIND_ADDRESS, display) |
|
271 | 274 |
else: |
272 |
vnc_arg = '%s:%d' % (constants.HV_VNC_BIND_ADDRESS, display) |
|
273 |
kvm_cmd.extend(['-vnc', vnc_arg]) |
|
275 |
logging.error("Network port is not a valid VNC display (%d < %d)." |
|
276 |
" Not starting VNC" % |
|
277 |
(instance.network_port, |
|
278 |
constants.HT_HVM_VNC_BASE_PORT)) |
|
279 |
vnc_arg = 'none' |
|
274 | 280 |
else: |
275 |
logging.error("Network port is not a valid VNC display (%d < %d)." |
|
276 |
" Not starting VNC" % |
|
277 |
(instance.network_port, constants.HT_HVM_VNC_BASE_PORT)) |
|
278 |
kvm_cmd.extend(['-vnc', 'none']) |
|
281 |
if os.path.isdir(vnc_bind_address): |
|
282 |
vnc_arg = 'unix:%s/%s.vnc' % (vnc_bind_address, instance.name) |
|
283 |
else: |
|
284 |
vnc_arg = 'unix:%s' % vnc_bind_address |
|
285 |
kvm_cmd.extend(['-vnc', vnc_arg]) |
|
279 | 286 |
else: |
280 | 287 |
kvm_cmd.extend(['-nographic']) |
281 | 288 |
|
... | ... | |
683 | 690 |
vnc_bind_address = hvparams[constants.HV_VNC_BIND_ADDRESS] |
684 | 691 |
if vnc_bind_address: |
685 | 692 |
if not utils.IsValidIP(vnc_bind_address): |
686 |
raise errors.OpPrereqError("given VNC bind address '%s' doesn't look" |
|
687 |
" like a valid IP address" % |
|
688 |
vnc_bind_address) |
|
693 |
if not os.path.isabs(vnc_bind_address): |
|
694 |
raise errors.HypervisorError("The VNC bind address must be either" |
|
695 |
" a valid IP address or an absolute" |
|
696 |
" pathname. '%s' given" % |
|
697 |
vnc_bind_address) |
|
689 | 698 |
|
690 | 699 |
def ValidateParameters(self, hvparams): |
691 | 700 |
"""Check the given parameters for validity. |
Also available in: Unified diff