SSH driver does not work with non-english locale

Bug #1373671 reported by aeva black
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Fix Released
High
Lucas Alvares Gomes

Bug Description

The SSH driver's "vmware" and "virsh" command sets contain a grep clause which depends upon localized strings, causing this driver to be unusable on systems with a non-english locale setting.

For vmware:

136 'list_running': (
137 "vmsvc/power.getstate {_NodeName_} | "
138 "grep 'Powered on' >/dev/null && "
139 "echo '\"{_NodeName_}\"' || true"),

For virsh:

159 'list_running': ("list --all|grep running | "
160 "awk -v qc='\"' -F\" \" '{print qc$2qc}'"),

Below is the output when the system locale is changed to "de_DE". The translation of the unexpected error is "Error: Domain is already active". However, any attempt to turn the node off is a no-op, because the SSH driver does not believe the node is running.

2014-09-24 16:55:14.587 DEBUG ironic.drivers.modules.ssh [-] Checking Node: baremetalbrbm_2's Mac address. from (pid=19417) _get_hosts_name_for_node /opt/stack/ironic/ironic/drivers/modules/ssh.py:404
2014-09-24 16:55:14.684 DEBUG ironic.drivers.modules.ssh [-] Found Mac address: 52:54:00:de:30:e3 from (pid=19417) _get_hosts_name_for_node /opt/stack/ironic/ironic/drivers/modules/ssh.py:417
2014-09-24 16:55:14.782 DEBUG ironic.drivers.modules.ssh [-] Cannot execute SSH cmd /usr/bin/virsh --connect qemu:///system start baremetalbrbm_2. Reason: Unexpected error while running command.
Command: /usr/bin/virsh --connect qemu:///system start baremetalbrbm_2
Exit code: 1
Stdout: '\n'
Stderr: 'Fehler: Domain ist bereits aktiv\n'. from (pid=19417) _ssh_execute /opt/stack/ironic/ironic/drivers/modules/ssh.py:277

2014-09-24 16:55:14.794 WARNING ironic.conductor.manager [-] Error in deploy of node 20770fde-b719-413d-9170-b257a76064a7: Failed to execute command via SSH: /usr/bin/virsh --connect qemu:///system start baremetalbrbm_2.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/hub.py", line 455, in fire_timers
    timer()
  File "/usr/local/lib/python2.7/dist-packages/eventlet/hubs/timer.py", line 58, in __call__
    cb(*args, **kw)
  File "/usr/local/lib/python2.7/dist-packages/eventlet/greenthread.py", line 212, in main
    result = function(*args, **kwargs)
  File "/opt/stack/ironic/ironic/conductor/manager.py", line 504, in _do_node_deploy
    node.target_provision_state = states.NOSTATE
  File "/usr/local/lib/python2.7/dist-packages/oslo/utils/excutils.py", line 82, in __exit__
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/stack/ironic/ironic/conductor/manager.py", line 497, in _do_node_deploy
    new_state = task.driver.deploy.deploy(task)
  File "/opt/stack/ironic/ironic/conductor/task_manager.py", line 116, in wrapper
    return f(*args, **kwargs)
  File "/opt/stack/ironic/ironic/drivers/modules/pxe.py", line 344, in deploy
    manager_utils.node_power_action(task, states.REBOOT)
  File "/opt/stack/ironic/ironic/conductor/task_manager.py", line 116, in wrapper
    return f(*args, **kwargs)
  File "/opt/stack/ironic/ironic/conductor/utils.py", line 118, in node_power_action
    'target': new_state, 'error': e}
  File "/usr/local/lib/python2.7/dist-packages/oslo/utils/excutils.py", line 82, in __exit__
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/stack/ironic/ironic/conductor/utils.py", line 112, in node_power_action
    task.driver.power.reboot(task)
  File "/opt/stack/ironic/ironic/conductor/task_manager.py", line 116, in wrapper
    return f(*args, **kwargs)
  File "/opt/stack/ironic/ironic/drivers/modules/ssh.py", line 586, in reboot
    state = _power_on(ssh_obj, driver_info)
  File "/opt/stack/ironic/ironic/drivers/modules/ssh.py", line 446, in _power_on
    _ssh_execute(ssh_obj, cmd_to_power_on)
  File "/opt/stack/ironic/ironic/drivers/modules/ssh.py", line 278, in _ssh_execute
    raise exception.SSHCommandFailed(cmd=cmd_to_exec)
SSHCommandFailed: Failed to execute command via SSH: /usr/bin/virsh --connect qemu:///system start baremetalbrbm_2.

aeva black (tenbrae)
affects: nova → ironic
Changed in ironic:
status: New → Confirmed
importance: Undecided → High
Changed in ironic:
assignee: nobody → Lucas Alvares Gomes (lucasagomes)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ironic (master)

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

Changed in ironic:
status: Confirmed → In Progress
Changed in ironic:
milestone: none → juno-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ironic (master)

Reviewed: https://review.openstack.org/124061
Committed: https://git.openstack.org/cgit/openstack/ironic/commit/?id=8ba03ed0bcd078edd7f5979b89c82a57671c95a2
Submitter: Jenkins
Branch: master

commit 8ba03ed0bcd078edd7f5979b89c82a57671c95a2
Author: Lucas Alvares Gomes <email address hidden>
Date: Thu Sep 25 14:48:31 2014 +0100

    Force the SSH commands to use their default language

    SSH commands often have to parse an output and do some pattern matchings
    (e.g using grep) that makes those commands dependent on the system
    language and causing it to fail on systems with a non-english locale
    setting.

    This patch forces the SSH commands to use their default language
    (whatever language the strings in the application was written in) for
    output by passing LC_ALL=C as part of the command. For virsh, vmware,
    vbox and prlctl the default language is english making the commands from
    the SSH driver to work independent of the system language.

    Closes-Bug: #1373671
    Change-Id: I175d84fca4e10b8c9468bc4fe54ecd865725e39c

Changed in ironic:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ironic:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ironic:
milestone: juno-rc1 → 2014.2
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.