Commit 2e74c823 authored by Alexander Efremkin's avatar Alexander Efremkin
Browse files

Fix broken long kernel command lines

This patch fixes the situation when kexec command is submitted in parts to work around command length limit, and continuation characters end up in kernel command line.
parent 0185b5ae
Pipeline #240774140 passed with stages
in 5 minutes and 58 seconds
......@@ -591,10 +591,20 @@ class HypervisorHmc(HypervisorBase):
# the api has a limit of 200 chars per call so we need
# to split the commands in smaller pieces
def _string_to_chunks(string, size=180):
def _string_to_chunks(string, size=200):
if len(string) < size:
yield string
# save command to a temporary file - 'tr' reads stdin as is
yield "tr -d '\\n' > /tmp/command"
for start in range(0, len(string), size):
yield string[start:start+size] + (
'\\' if start+size < len(string) else '')
yield string[start:start+size]
# stop reading stdin
yield '^D'
# run command from temporary file
yield '. /tmp/command'
timeout = time.time() + OS_MESSAGES_TIMEOUT
command_gen = _get_cmd(commands)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment