Set VNC keypress rate for outputting kernel_cmd
Change-Id: I2806626e2c3ace8d3644a9ff4df36caf54295dc5 Closes-Bug: #1699631
This commit is contained in:
parent
a693436f60
commit
e67743b22c
|
@ -43,6 +43,7 @@ from devops.models import driver
|
|||
from devops.models import network
|
||||
from devops.models import node
|
||||
from devops.models import volume
|
||||
from devops.settings import LIBVIRT_KEYPRESS_DELAY
|
||||
|
||||
|
||||
class _LibvirtManager(object):
|
||||
|
@ -1124,6 +1125,8 @@ class LibvirtNode(node.Node):
|
|||
time.sleep(1)
|
||||
continue
|
||||
self._libvirt_node.sendKey(0, 0, list(key_code), len(key_code), 0)
|
||||
# Limit Keypress rate with configurable delay between sending
|
||||
time.sleep(LIBVIRT_KEYPRESS_DELAY)
|
||||
|
||||
@decorators.retry(libvirt.libvirtError)
|
||||
def define(self):
|
||||
|
|
|
@ -37,6 +37,8 @@ DRIVER_PARAMETERS = {
|
|||
'use_host_cpu': get_var_as_bool('DRIVER_USE_HOST_CPU', True),
|
||||
'enable_acpi': get_var_as_bool('DRIVER_ENABLE_ACPI', False),
|
||||
}
|
||||
LIBVIRT_KEYPRESS_DELAY = float(
|
||||
os.environ.get("LIBVIRT_KEYPRESS_DELAY", "0.05"))
|
||||
|
||||
MIDDLEWARE_CLASSES = [] # required for django
|
||||
|
||||
|
|
|
@ -211,7 +211,11 @@ class TestLibvirtNode(LibvirtTestCase):
|
|||
mock.call(0, 0, [4], 1, 0),
|
||||
mock.call(0, 0, [28], 1, 0),
|
||||
])
|
||||
self.sleep_mock.assert_called_once_with(1)
|
||||
assert self.sleep_mock.call_args_list == [mock.call(0.05),
|
||||
mock.call(0.05),
|
||||
mock.call(0.05),
|
||||
mock.call(1),
|
||||
mock.call(0.05)]
|
||||
|
||||
def test_start_reboot(self):
|
||||
self.node.define()
|
||||
|
|
Loading…
Reference in New Issue