~ubuntu-branches/ubuntu/vivid/ironic/vivid-updates

« back to all changes in this revision

Viewing changes to ironic/drivers/modules/ssh.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-01-05 12:21:37 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20150105122137-171bqrdpcxqipunk
Tags: 2015.1~b1-0ubuntu1
* New upstream beta release:
  - d/control: Align version requirements with upstream release.
* d/watch: Update uversionmangle to deal with kilo beta versioning
  changes.
* d/control: Bumped Standards-Version to 3.9.6, no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import os
30
30
 
31
31
from oslo.config import cfg
 
32
from oslo_concurrency import processutils
32
33
 
33
34
from ironic.common import boot_devices
34
35
from ironic.common import exception
41
42
from ironic.drivers import base
42
43
from ironic.drivers import utils as driver_utils
43
44
from ironic.openstack.common import log as logging
44
 
from ironic.openstack.common import processutils
45
45
 
46
46
libvirt_opts = [
47
47
    cfg.StrOpt('libvirt_uri',
285
285
    missing_info = [key for key in REQUIRED_PROPERTIES if not info.get(key)]
286
286
    if missing_info:
287
287
        raise exception.MissingParameterValue(_(
288
 
            "SSHPowerDriver requires the following to be set: %s.")
289
 
            % missing_info)
 
288
            "SSHPowerDriver requires the following parameters to be set in "
 
289
            "node's driver_info: %s.") % missing_info)
290
290
 
291
291
    address = info.get('ssh_address')
292
292
    username = info.get('ssh_username')
341
341
 
342
342
    """
343
343
    power_state = None
344
 
    cmd_to_exec = "%s %s" % (driver_info['cmd_set']['base_cmd'],
345
 
                             driver_info['cmd_set']['list_running'])
346
 
    running_list = _ssh_execute(ssh_obj, cmd_to_exec)
347
 
    # Command should return a list of running vms. If the current node is
348
 
    # not listed then we can assume it is not powered on.
349
344
    node_name = _get_hosts_name_for_node(ssh_obj, driver_info)
350
345
    if node_name:
 
346
        # Get a list of vms running on the host. If the command supports
 
347
        # it, explicitly specify the desired node."
 
348
        cmd_to_exec = "%s %s" % (driver_info['cmd_set']['base_cmd'],
 
349
                                 driver_info['cmd_set']['list_running'])
 
350
        cmd_to_exec = cmd_to_exec.replace('{_NodeName_}', node_name)
 
351
        running_list = _ssh_execute(ssh_obj, cmd_to_exec)
351
352
        for node in running_list:
352
353
            if not node:
353
354
                continue
492
493
        :param task: a TaskManager instance containing the node to act on.
493
494
        :raises: InvalidParameterValue if any connection parameters are
494
495
            incorrect or if ssh failed to connect to the node.
 
496
        :raises: MissingParameterValue if no ports are enrolled for the given
 
497
                 node.
495
498
        """
496
499
        if not driver_utils.get_node_mac_addresses(task):
497
 
            raise exception.InvalidParameterValue(_("Node %s does not have "
 
500
            raise exception.MissingParameterValue(_("Node %s does not have "
498
501
                              "any port associated with it.") % task.node.uuid)
499
502
        try:
500
503
            _get_connection(task.node)