137 |
137 |
_CTRL_DIR = _ROOT_DIR + "/ctrl" # contains instances control sockets
|
138 |
138 |
_CONF_DIR = _ROOT_DIR + "/conf" # contains instances startup data
|
139 |
139 |
_NICS_DIR = _ROOT_DIR + "/nic" # contains instances nic <-> tap associations
|
|
140 |
_KEYMAP_DIR = _ROOT_DIR + "/keymap" # contains instances keymaps
|
140 |
141 |
# KVM instances with chroot enabled are started in empty chroot directories.
|
141 |
142 |
_CHROOT_DIR = _ROOT_DIR + "/chroot" # for empty chroot directories
|
142 |
143 |
# After an instance is stopped, its chroot directory is removed.
|
... | ... | |
177 |
178 |
hv_base.ParamInSet(False, constants.HT_KVM_VALID_DISK_TYPES),
|
178 |
179 |
constants.HV_USB_MOUSE:
|
179 |
180 |
hv_base.ParamInSet(False, constants.HT_KVM_VALID_MOUSE_TYPES),
|
|
181 |
constants.HV_KEYMAP: hv_base.NO_CHECK,
|
180 |
182 |
constants.HV_MIGRATION_PORT: hv_base.NET_PORT_CHECK,
|
181 |
183 |
constants.HV_MIGRATION_BANDWIDTH: hv_base.NO_CHECK,
|
182 |
184 |
constants.HV_MIGRATION_DOWNTIME: hv_base.NO_CHECK,
|
... | ... | |
357 |
359 |
return utils.PathJoin(cls._InstanceNICDir(instance_name), str(seq))
|
358 |
360 |
|
359 |
361 |
@classmethod
|
|
362 |
def _InstanceKeymapFile(cls, instance_name):
|
|
363 |
"""Returns the name of the file containing the keymap for a given instance
|
|
364 |
|
|
365 |
"""
|
|
366 |
return utils.PathJoin(cls._KEYMAP_DIR, instance_name)
|
|
367 |
|
|
368 |
@classmethod
|
360 |
369 |
def _TryReadUidFile(cls, uid_file):
|
361 |
370 |
"""Try to read a uid file
|
362 |
371 |
|
... | ... | |
380 |
389 |
utils.RemoveFile(cls._InstanceMonitor(instance_name))
|
381 |
390 |
utils.RemoveFile(cls._InstanceSerial(instance_name))
|
382 |
391 |
utils.RemoveFile(cls._InstanceKVMRuntime(instance_name))
|
|
392 |
utils.RemoveFile(cls._InstanceKeymapFile(instance_name))
|
383 |
393 |
uid_file = cls._InstanceUidFile(instance_name)
|
384 |
394 |
uid = cls._TryReadUidFile(uid_file)
|
385 |
395 |
utils.RemoveFile(uid_file)
|
... | ... | |
644 |
654 |
elif vnc_bind_address:
|
645 |
655 |
kvm_cmd.extend(['-usbdevice', constants.HT_MOUSE_TABLET])
|
646 |
656 |
|
|
657 |
keymap = hvp[constants.HV_KEYMAP]
|
|
658 |
if keymap:
|
|
659 |
keymap_path = self._InstanceKeymapFile(instance.name)
|
|
660 |
# If a keymap file is specified, KVM won't use its internal defaults. By
|
|
661 |
# first including the "en-us" layout, an error on loading the actual
|
|
662 |
# layout (e.g. because it can't be found) won't lead to a non-functional
|
|
663 |
# keyboard. A keyboard with incorrect keys is still better than none.
|
|
664 |
utils.WriteFile(keymap_path, data="include en-us\ninclude %s\n" % keymap)
|
|
665 |
kvm_cmd.extend(["-k", keymap_path])
|
|
666 |
|
647 |
667 |
if vnc_bind_address:
|
648 |
668 |
if netutils.IP4Address.IsValid(vnc_bind_address):
|
649 |
669 |
if instance.network_port > constants.VNC_BASE_PORT:
|