^M characters appearing in console output

Bug #1108820 reported by Christopher Yeoh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Chuck Short

Bug Description

When retreiving the console output through the os-console-output API in ^M characters appear in the output. Sometimes ^M characters appear without a corresponding linefeed character. As a side-effect this causes the tempest test test_get_console_output to sometimes fail. This occurs when the tests run slowly compared to a booting instance and the console output looks like this (the tempest test has requested 10 lines of console output):

================START====================
 WARN: /etc/rc3.d/S99-cloud-userdata failed^M
  ____ ____ ____^M
 / __/ __ ____ ____ / __ \/ __/^M
/ /__ / // __// __// /_/ /\ \ ^M
\___//_//_/ /_/ \____/___/ ^M
 http://launchpad.net/cirros^M
^M
^M^M
login as 'cirros' user. default password: 'cubswin:)'. use 'sudo' for root.^M
cirros login:
==================END================

During conversion from XML the lxml/etree module ends up coverting ^M/LF characters to LF but also ^M characters by themselves are also converted to LF. This ends up with effectively 12 lines of output and so the test fails as it is only expecting 10 lines. The test passes if the instance is slow to boot as the excerpts from earlier in the boot process do not contain consecutive ^M characters.

Whilst this is fixable on the tempest side test I'm wondering if this is the behaviour that we expect from Nova. Firstly it is a a bit of a surprise that we are generating ^M characters on linux booting a linux instance. Does anyone know where these are coming?

The console-output extension currently filters out a few characters before passing back the console output:

        # XML output is not correctly escaped, so remove invalid characters
        remove_re = re.compile('[\x00-\x08\x0B-\x0C\x0E-\x1F]')

Should ^M characters be added to this list - will this adversely affect anyone?

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

I can see ^M characters in the actual file output from kvm/virsh/libvirt layers

dims@dims-desktop:~$ find /opt -name console.log
/opt/stack/data/nova/instances/instance-00000003/console.log
/opt/stack/data/nova/instances/instance-00000002/console.log

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/21608

Changed in nova:
assignee: nobody → Chuck Short (zulcss)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/21608
Committed: http://github.com/openstack/nova/commit/fffcaea176b785c9715a180f6a629708db16536c
Submitter: Jenkins
Branch: master

commit fffcaea176b785c9715a180f6a629708db16536c
Author: Chuck Short <email address hidden>
Date: Sun Feb 10 16:45:07 2013 -0600

    Add control-M to list of characters to strip out

    Adds ^M to list of characters to strip out. Fixes LP: #1108820

    Change-Id: I070fa566afaafdb932a21b198c669628c56b284b
    Signed-off-by: Chuck Short <email address hidden>

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-3 → 2013.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.