示例#1
0
 def test_node_set_boot_device_non_existent_device(self):
     mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
     self.driver = driver_factory.get_driver("fake_ipmitool")
     ipmi_info = utils.get_test_ipmi_info()
     node = obj_utils.create_test_node(self.context,
                                       uuid=cmn_utils.generate_uuid(),
                                       driver='fake_ipmitool',
                                       driver_info=ipmi_info)
     task = task_manager.TaskManager(self.context, node.uuid)
     self.assertRaises(exception.InvalidParameterValue,
                       conductor_utils.node_set_boot_device,
                       task,
                       device='fake')
示例#2
0
 def test_node_set_boot_device_non_existent_device(self):
     mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
     self.driver = driver_factory.get_driver("fake_ipmitool")
     ipmi_info = utils.get_test_ipmi_info()
     node = obj_utils.create_test_node(self.context,
                                       uuid=cmn_utils.generate_uuid(),
                                       driver='fake_ipmitool',
                                       driver_info=ipmi_info)
     task = task_manager.TaskManager(self.context, node.uuid)
     self.assertRaises(exception.InvalidParameterValue,
                       conductor_utils.node_set_boot_device,
                       task,
                       device='fake')
示例#3
0
    def test_node_set_boot_device_valid(self):
        mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
        self.driver = driver_factory.get_driver("fake_ipmitool")
        ipmi_info = utils.get_test_ipmi_info()
        node = obj_utils.create_test_node(self.context,
                                          uuid=cmn_utils.generate_uuid(),
                                          driver='fake_ipmitool',
                                          driver_info=ipmi_info)
        task = task_manager.TaskManager(self.context, node.uuid)

        with mock.patch.object(self.driver.management,
                               'set_boot_device') as mock_sbd:
            conductor_utils.node_set_boot_device(task, device='pxe')
            mock_sbd.assert_called_once_with(task,
                                             device='pxe',
                                             persistent=False)
示例#4
0
    def test_node_set_boot_device_valid(self):
        mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
        self.driver = driver_factory.get_driver("fake_ipmitool")
        ipmi_info = utils.get_test_ipmi_info()
        node = obj_utils.create_test_node(self.context,
                                          uuid=cmn_utils.generate_uuid(),
                                          driver='fake_ipmitool',
                                          driver_info=ipmi_info)
        task = task_manager.TaskManager(self.context, node.uuid)

        with mock.patch.object(self.driver.management,
                               'set_boot_device') as mock_sbd:
            conductor_utils.node_set_boot_device(task,
                                                 device='pxe')
            mock_sbd.assert_called_once_with(task,
                                             device='pxe',
                                             persistent=False)
    def test_node_set_boot_device_valid(self):
        mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
        self.driver = driver_factory.get_driver("fake_ipmitool")
        ipmi_info = utils.get_test_ipmi_info()
        ndict = utils.get_test_node(uuid=cmn_utils.generate_uuid(),
                                    driver='fake_ipmitool',
                                    driver_info=ipmi_info)
        node = self.dbapi.create_node(ndict)
        task = task_manager.TaskManager(self.context, node.uuid)

        with mock.patch.object(self.driver.vendor,
                               'vendor_passthru') as driver_vpassthru:
            conductor_utils.node_set_boot_device(task, task.node, device='pxe')
            driver_vpassthru.assert_called_once_with(task,
                                                     task.node,
                                                     device='pxe',
                                                     persistent=False,
                                                     method='set_boot_device')
示例#6
0
    def test_node_set_boot_device_valid(self):
        mgr_utils.mock_the_extension_manager(driver="fake_ipmitool")
        self.driver = driver_factory.get_driver("fake_ipmitool")
        ipmi_info = utils.get_test_ipmi_info()
        ndict = utils.get_test_node(uuid=cmn_utils.generate_uuid(),
                                    driver='fake_ipmitool',
                                    driver_info=ipmi_info)
        node = self.dbapi.create_node(ndict)
        task = task_manager.TaskManager(self.context, node.uuid)

        with mock.patch.object(self.driver.vendor,
                               'vendor_passthru') as driver_vpassthru:
            conductor_utils.node_set_boot_device(task,
                                                 task.node,
                                                 device='pxe')
            driver_vpassthru.assert_called_once_with(task,
                                                task.node,
                                                device='pxe',
                                                persistent=False,
                                                method='set_boot_device')
示例#7
0
import tempfile

from oslo.config import cfg

from ironic.common import exception
from ironic.common import utils
from ironic.drivers.modules import console_utils
from ironic.drivers.modules import ipmitool as ipmi
from ironic.openstack.common import context
from ironic.tests import base
from ironic.tests.db import utils as db_utils
from ironic.tests.objects import utils as obj_utils

CONF = cfg.CONF

INFO_DICT = db_utils.get_test_ipmi_info()


class ConsoleUtilsTestCase(base.TestCase):
    def setUp(self):
        super(ConsoleUtilsTestCase, self).setUp()
        self.context = context.get_admin_context()
        self.node = obj_utils.get_test_node(self.context,
                                            driver='fake_ipmitool',
                                            driver_info=INFO_DICT)
        self.info = ipmi._parse_driver_info(self.node)

    def test__get_console_pid_file(self):
        tempdir = tempfile.gettempdir()
        self.config(terminal_pid_dir=tempdir, group='console')
        path = console_utils._get_console_pid_file(self.info['uuid'])
示例#8
0
import mock
from oslo.concurrency import processutils
from oslo.config import cfg

from ironic.common import exception
from ironic.common import utils
from ironic.drivers.modules import console_utils
from ironic.drivers.modules import ipmitool as ipmi
from ironic.tests.db import base as db_base
from ironic.tests.db import utils as db_utils
from ironic.tests.objects import utils as obj_utils


CONF = cfg.CONF

INFO_DICT = db_utils.get_test_ipmi_info()


class ConsoleUtilsTestCase(db_base.DbTestCase):

    def setUp(self):
        super(ConsoleUtilsTestCase, self).setUp()
        self.node = obj_utils.get_test_node(
                self.context,
                driver='fake_ipmitool',
                driver_info=INFO_DICT)
        self.info = ipmi._parse_driver_info(self.node)

    def test__get_console_pid_dir(self):
        pid_dir = '/tmp/pid_dir'
        self.config(terminal_pid_dir=pid_dir, group='console')