Run console on the serial port if required

This commit adds the ability to use IPMI SOL console when the nodes
provisioned with an option 'console=ttySx' or 'console=ttySx,speed',
where x is 0 for the COM1 and 1 for COM2. If speed parameter doesn't
provided so 9600 used as default. This feature can be used for the
bootstrap nodes too.

DocImpact
Closes-Bug: #1544820
Change-Id: I210001c5692281add2439843f4ad69d65c8f6e17
Signed-off-by: Maksim Malchuk <mmalchuk@mirantis.com>
This commit is contained in:
Maksim Malchuk 2016-05-23 15:49:11 +03:00 committed by Alexander Gordeev
parent d2185b1316
commit 06ab1390fa
3 changed files with 60 additions and 0 deletions

View File

@ -97,3 +97,27 @@ cloud-init-per instance skel_bash cp -f /etc/skel/.bash* /root/
cloud-init-per instance hiera_puppet mkdir -p /etc/puppet /var/lib/hiera
cloud-init-per instance touch_puppet touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml /var/log/puppet.log
cloud-init-per instance chmod_puppet chmod 600 /var/log/puppet.log
cloud-init-per instance upstart_console /bin/sh -c 'for i in $(seq 0 1); do
cat >/etc/init/ttyS${i}.conf <<-EOF
# ttyS${i} - getty
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
pre-start script
# exit if console not present on ttyS${i}
cat /proc/cmdline | grep -q "console=ttyS${i}"
end script
script
# get console speed if provded with "console=ttySx,38400"
SPEED=\$(cat /proc/cmdline | sed -e"s/^.*console=ttyS${i}[,]*\([^ ]*\)[ ]*.*\$/\1/g")
# or use 9600 console speed as default
exec /sbin/getty -L \${SPEED:-9600} ttyS${i}
end script
EOF
done
'

View File

@ -0,0 +1,18 @@
# ttyS0 - getty
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
pre-start script
# exit if console not present on ttyS0
cat /proc/cmdline | grep -q "console=ttyS0"
end script
script
# get console speed if provded with "console=ttySx,38400"
SPEED=$(cat /proc/cmdline | sed -e"s/^.*console=ttyS0[,]*\([^ ]*\)[ ]*.*$/\1/g")
# or use 9600 console speed as default
exec /sbin/getty -L ${SPEED:-9600} ttyS0
end script

View File

@ -0,0 +1,18 @@
# ttyS1 - getty
start on stopped rc RUNLEVEL=[12345]
stop on runlevel [!12345]
respawn
pre-start script
# exit if console not present on ttyS1
cat /proc/cmdline | grep -q "console=ttyS1"
end script
script
# get console speed if provded with "console=ttySx,38400"
SPEED=$(cat /proc/cmdline | sed -e"s/^.*console=ttyS1[,]*\([^ ]*\)[ ]*.*$/\1/g")
# or use 9600 console speed as default
exec /sbin/getty -L ${SPEED:-9600} ttyS1
end script