def setUp(self):
     super(AMTManagementTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_amt_fake')
     self.info = INFO_DICT
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_amt_fake',
                                            driver_info=self.info)
Пример #2
0
 def setUp(self):
     super(TestCinderActions, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake')
     self.config(enabled_drivers=['fake'])
     self.node = object_utils.create_test_node(
         self.context,
         instance_uuid=uuidutils.generate_uuid())
Пример #3
0
 def setUp(self):
     super(DracPeriodicTaskTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_drac')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_drac',
                                            driver_info=INFO_DICT)
     self.driver = driver_factory.get_driver("fake_drac")
     self.job = {
         'id': 'JID_001436912645',
         'name': 'ConfigBIOS:BIOS.Setup.1-1',
         'start_time': '00000101000000',
         'until_time': 'TIME_NA',
         'message': 'Job in progress',
         'state': 'Running',
         'percent_complete': 34}
     self.virtual_disk = {
         'id': 'Disk.Virtual.0:RAID.Integrated.1-1',
         'name': 'disk 0',
         'description': 'Virtual Disk 0 on Integrated RAID Controller 1',
         'controller': 'RAID.Integrated.1-1',
         'raid_level': '1',
         'size_mb': 571776,
         'state': 'ok',
         'raid_state': 'online',
         'span_depth': 1,
         'span_length': 2,
         'pending_operations': None
     }
Пример #4
0
    def setUp(self):
        super(TestNeutron, self).setUp()
        mgr_utils.mock_the_extension_manager(driver='fake')
        self.config(
            cleaning_network='00000000-0000-0000-0000-000000000000',
            group='neutron')
        self.config(enabled_drivers=['fake'])
        self.config(dhcp_provider='neutron',
                    group='dhcp')
        self.config(url='test-url',
                    url_timeout=30,
                    retries=2,
                    group='neutron')
        self.config(insecure=False,
                    certfile='test-file',
                    admin_user='******',
                    admin_tenant_name='test-admin-tenant',
                    admin_password='******',
                    auth_uri='test-auth-uri',
                    group='keystone_authtoken')
        self.node = object_utils.create_test_node(self.context)
        self.ports = [
            object_utils.create_test_port(
                self.context, node_id=self.node.id, id=2,
                uuid='1be26c0b-03f2-4d2e-ae87-c02d7f33c782',
                address='52:54:00:cf:2d:32')]
        # Very simple neutron port representation
        self.neutron_port = {'id': '132f871f-eaec-4fed-9475-0d54465e0f00',
                             'mac_address': '52:54:00:cf:2d:32'}

        dhcp_factory.DHCPFactory._dhcp_provider = None
Пример #5
0
 def test_check_image_size_without_memory_mb(self, show_mock):
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties.pop('memory_mb', None)
         agent.check_image_size(task, 'fake-image')
         self.assertFalse(show_mock.called)
Пример #6
0
 def setUp(self):
     super(IRMCInspectInternalMethodsTestCase, self).setUp()
     driver_info = INFO_DICT
     mgr_utils.mock_the_extension_manager(driver='fake_irmc')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_irmc',
                                            driver_info=driver_info)
Пример #7
0
 def setUp(self):
     irmc_boot.check_share_fs_mounted_patcher.start()
     self.addCleanup(irmc_boot.check_share_fs_mounted_patcher.stop)
     super(IRMCVirtualMediaBootTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="iscsi_irmc")
     self.node = obj_utils.create_test_node(
         self.context, driver='iscsi_irmc', driver_info=INFO_DICT)
Пример #8
0
 def setUp(self):
     super(IloPowerTestCase, self).setUp()
     driver_info = INFO_DICT
     mgr_utils.mock_the_extension_manager(driver="fake_ilo")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_ilo',
                                            driver_info=driver_info)
Пример #9
0
 def setUp(self):
     super(MSFTOCSCommonTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_msftocs')
     self.info = INFO_DICT
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_msftocs',
                                            driver_info=self.info)
Пример #10
0
 def setUp(self):
     super(VirtualBoxMethodsTestCase, self).setUp()
     driver_info = INFO_DICT.copy()
     mgr_utils.mock_the_extension_manager(driver="fake_vbox")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_vbox',
                                            driver_info=driver_info)
Пример #11
0
 def setUp(self):
     super(DracPowerTestCase, self).setUp()
     driver_info = INFO_DICT
     mgr_utils.mock_the_extension_manager(driver="fake_drac")
     self.node = db_utils.create_test_node(
         driver='fake_drac',
         driver_info=driver_info,
         instance_uuid='instance_uuid_123')
Пример #12
0
 def setUp(self):
     super(WakeOnLanPrivateMethodTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_wol_fake')
     self.driver = driver_factory.get_driver('fake_wol_fake')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_wol_fake')
     self.port = obj_utils.create_test_port(self.context,
                                            node_id=self.node.id)
Пример #13
0
 def setUp(self):
     super(IRMCPowerInternalMethodsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_irmc')
     driver_info = INFO_DICT
     self.node = db_utils.create_test_node(
         driver='fake_irmc',
         driver_info=driver_info,
         instance_uuid=uuidutils.generate_uuid())
Пример #14
0
 def setUp(self):
     super(IRMCCommonMethodsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_irmc")
     self.info = db_utils.get_test_irmc_info()
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake_irmc',
         driver_info=self.info)
Пример #15
0
 def test_check_image_size(self, size_mock):
     size_mock.return_value = 10 * 1024 * 1024
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         size_mock.assert_called_once_with(self.context, 'fake-image')
Пример #16
0
 def setUp(self):
     super(FakeDriverTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
     self.node = obj_utils.get_test_node(self.context)
     self.task = mock.MagicMock(spec=task_manager.TaskManager)
     self.task.shared = False
     self.task.node = self.node
     self.task.driver = self.driver
Пример #17
0
 def setUp(self):
     super(UcsManagementTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_ucs')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_ucs',
                                            driver_info=INFO_DICT)
     self.interface = ucs_mgmt.UcsManagement()
     self.task = mock.Mock()
     self.task.node = self.node
Пример #18
0
 def setUp(self):
     super(AMTPowerInteralMethodsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_amt')
     self.info = INFO_DICT
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_amt',
                                            driver_info=self.info)
     CONF.set_override('max_attempts', 2, 'amt')
     CONF.set_override('action_wait', 0, 'amt')
Пример #19
0
 def setUp(self):
     super(RedfishPowerTestCase, self).setUp()
     self.config(enabled_hardware_types=['redfish'],
                 enabled_power_interfaces=['redfish'],
                 enabled_management_interfaces=['redfish'])
     mgr_utils.mock_the_extension_manager(
         driver='redfish', namespace='ironic.hardware.types')
     self.node = obj_utils.create_test_node(
         self.context, driver='redfish', driver_info=INFO_DICT)
Пример #20
0
 def setUp(self):
     super(UcsValidateParametersTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_ucs")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_ucs',
                                            driver_info=INFO_DICT)
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=True) as task:
         self.helper = ucs_helper.CiscoUcsHelper(task)
Пример #21
0
    def setUp(self):
        super(IPMINativeDriverTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="fake_ipminative")
        self.driver = driver_factory.get_driver("fake_ipminative")

        self.node = obj_utils.create_test_node(self.context,
                                               driver='fake_ipminative',
                                               driver_info=INFO_DICT)
        self.info = ipminative._parse_driver_info(self.node)
Пример #22
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=uuidutils.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")
Пример #23
0
 def setUp(self):
     super(ISCSIPXEOneViewInspectTestCase, self).setUp()
     self.config(enabled=True, group='inspector')
     mgr_utils.mock_the_extension_manager(driver="iscsi_pxe_oneview")
     self.node = obj_utils.create_test_node(
         self.context, driver='iscsi_pxe_oneview',
         properties=db_utils.get_test_oneview_properties(),
         driver_info=db_utils.get_test_oneview_driver_info(),
     )
Пример #24
0
 def setUp(self):
     super(DracManagementTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_drac')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_drac',
                                            driver_info=INFO_DICT)
     self.driver = drac_mgmt.DracManagement()
     self.task = mock.Mock(spec=['node'])
     self.task.node = self.node
Пример #25
0
    def _test_get_pxe_conf_option(self, driver, expected_value):
        mgr_utils.mock_the_extension_manager(driver=driver)
        self.node.driver = driver
        self.node.save()

        with task_manager.acquire(self.context, self.node.uuid) as task:
            returned_value = pxe._get_pxe_conf_option(task, "pxe_config_template")

        self.assertEqual(expected_value, returned_value)
Пример #26
0
 def setUp(self):
     super(NoopInterfaceTestCase, self).setUp()
     self.config(enabled_drivers=['fake'])
     mgr_utils.mock_the_extension_manager()
     self.interface = noop.NoopNetwork()
     self.node = utils.create_test_node(self.context,
                                        network_interface='noop')
     self.port = utils.create_test_port(
         self.context, node_id=self.node.id, address='52:54:00:cf:2d:32')
Пример #27
0
 def setUp(self):
     super(PXEPrivateMethodsTestCase, self).setUp()
     n = {
         "driver": "fake_pxe",
         "instance_info": INST_INFO_DICT,
         "driver_info": DRV_INFO_DICT,
         "driver_internal_info": DRV_INTERNAL_INFO_DICT,
     }
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     self.node = obj_utils.create_test_node(self.context, **n)
Пример #28
0
 def setUp(self):
     super(OneViewCommonTestCase, self).setUp()
     self.node = obj_utils.create_test_node(
         self.context, driver='fake_oneview', properties=PROPERTIES_DICT,
         driver_info=DRIVER_INFO_DICT,
     )
     self.config(manager_url='https://1.2.3.4', group='oneview')
     self.config(username='******', group='oneview')
     self.config(password='******', group='oneview')
     mgr_utils.mock_the_extension_manager(driver="fake_oneview")
Пример #29
0
 def setUp(self):
     super(UcsCommonMethodsTestcase, self).setUp()
     self.dbapi = dbapi.get_instance()
     mgr_utils.mock_the_extension_manager(driver="fake_ucs")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_ucs',
                                            driver_info=INFO_DICT.copy())
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=True) as task:
         self.helper = ucs_helper.CiscoUcsHelper(task)
Пример #30
0
 def setUp(self):
     super(CIMCBaseTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_cimc")
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake_cimc',
         driver_info=db_utils.get_test_cimc_info(),
         instance_uuid="fake_uuid")
     CONF.set_override('max_retry', 2, 'cimc')
     CONF.set_override('action_interval', 0, 'cimc')
Пример #31
0
 def setUp(self):
     super(AnsibleDeployTestCaseBase, self).setUp()
     self.config(enabled_deploy_interfaces='direct,iscsi,ansible')
     mgr_utils.mock_the_extension_manager(driver='ipmi',
                                          namespace='ironic.hardware.types')
     node = {
         'driver': 'ipmi',
         'deploy_interface': 'ansible',
         'instance_info': INSTANCE_INFO,
         'driver_info': DRIVER_INFO,
         'driver_internal_info': DRIVER_INTERNAL_INFO,
     }
     self.node = object_utils.create_test_node(self.context, **node)
Пример #32
0
 def setUp(self):
     super(ISCSIDeployTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     self.driver = driver_factory.get_driver("fake_pxe")
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake_pxe',
         instance_info=INST_INFO_DICT,
         driver_info=DRV_INFO_DICT,
         driver_internal_info=DRV_INTERNAL_INFO_DICT,
     )
     self.node.driver_internal_info['agent_url'] = 'http://1.2.3.4:1234'
     dhcp_factory.DHCPFactory._dhcp_provider = None
Пример #33
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=uuidutils.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')
Пример #34
0
    def setUp(self):
        super(IRMCManagementFunctionsTestCase, self).setUp()
        driver_info = INFO_DICT

        mgr_utils.mock_the_extension_manager(driver="fake_irmc")
        self.driver = driver_factory.get_driver("fake_irmc")
        self.node = obj_utils.create_test_node(self.context,
                                               driver='fake_irmc',
                                               driver_info=driver_info)
        self.info = irmc_common.parse_driver_info(self.node)

        irmc_management.irmc.scci.SCCIError = Exception
        irmc_management.irmc.scci.SCCIInvalidInputError = ValueError
Пример #35
0
    def setUp(self):
        super(TestBaseAgentVendor, self).setUp()
        self.config(
            post_deploy_get_power_state_retries=GET_POWER_STATE_RETRIES,
            group='agent')
        mgr_utils.mock_the_extension_manager(driver="agent_pxe_oneview")
        self.passthru = vendor.AgentVendorInterface()

        self.node = obj_utils.create_test_node(
            self.context, driver='agent_pxe_oneview',
            properties=db_utils.get_test_oneview_properties(),
            driver_info=db_utils.get_test_oneview_driver_info(),
        )
Пример #36
0
 def setUp(self):
     super(TestOneViewAgentDeploy, self).setUp()
     self.config(
         post_deploy_get_power_state_retries=GET_POWER_STATE_RETRIES,
         group='agent')
     mgr_utils.mock_the_extension_manager(driver="agent_pxe_oneview")
     self.driver = driver_factory.get_driver("agent_pxe_oneview")
     self.node = obj_utils.create_test_node(
         self.context, driver='agent_pxe_oneview',
         properties=db_utils.get_test_oneview_properties(),
         driver_info=db_utils.get_test_oneview_driver_info(),
         driver_internal_info={'agent_url': 'http://1.2.3.4:5678'},
     )
Пример #37
0
 def setUp(self):
     super(OneViewCommonTestCase, self).setUp()
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake_oneview',
         properties=db_utils.get_test_oneview_properties(),
         driver_info=db_utils.get_test_oneview_driver_info(),
     )
     self.config(manager_url='https://1.2.3.4', group='oneview')
     self.config(username='******', group='oneview')
     self.config(password='******', group='oneview')
     self.config(tls_cacert_file='ca_file', group='oneview')
     self.config(allow_insecure_connections=False, group='oneview')
     mgr_utils.mock_the_extension_manager(driver="fake_oneview")
Пример #38
0
 def test_check_image_size_raw_stream_enabled(self, show_mock):
     CONF.set_override('stream_raw_images', True, 'agent')
     # Image is bigger than memory but it's raw and will be streamed
     # so the test should pass
     show_mock.return_value = {
         'size': 15 * 1024 * 1024,
         'disk_format': 'raw',
     }
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         agent.check_image_size(task, 'fake-image')
         show_mock.assert_called_once_with(self.context, 'fake-image')
Пример #39
0
 def setUp(self):
     super(BaseTestCase, self).setUp()
     self.config(enabled=True, group='inspector')
     mgr_utils.mock_the_extension_manager("fake_inspector")
     self.driver = driver_factory.get_driver("fake_inspector")
     self.node = obj_utils.get_test_node(self.context)
     self.task = mock.MagicMock(spec=task_manager.TaskManager)
     self.task.context = self.context
     self.task.shared = False
     self.task.node = self.node
     self.task.driver = self.driver
     self.api_version = (1, 0)
     # NOTE(pas-ha) force-reset  global inspector session object
     inspector._INSPECTOR_SESSION = None
Пример #40
0
    def setUp(self):
        super(NodeCleaningStepsTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager()

        self.power_update = {
            'step': 'update_firmware', 'priority': 10, 'interface': 'power'}
        self.deploy_update = {
            'step': 'update_firmware', 'priority': 10, 'interface': 'deploy'}
        self.deploy_erase = {
            'step': 'erase_disks', 'priority': 20, 'interface': 'deploy'}
        self.clean_steps = [self.deploy_erase, self.power_update,
                            self.deploy_update]
        self.deploy_raid = {
            'step': 'build_raid', 'priority': 0, 'interface': 'deploy'}
Пример #41
0
    def setUp(self):
        super(OneViewPeriodicTasks, self).setUp()
        self.config(manager_url='https://1.2.3.4', group='oneview')
        self.config(username='******', group='oneview')
        self.config(password='******', group='oneview')

        mgr_utils.mock_the_extension_manager(driver='fake_oneview')
        self.driver = driver_factory.get_driver('fake_oneview')
        self.deploy = OneViewDriverDeploy()
        self.os_primary = mock.MagicMock(spec=METHODS)
        self.node = obj_utils.create_test_node(
            self.context, driver='fake_oneview',
            properties=db_utils.get_test_oneview_properties(),
            driver_info=db_utils.get_test_oneview_driver_info(),
        )
Пример #42
0
    def setUp(self):
        super(OneViewManagementDriverFunctionsTestCase, self).setUp()
        self.config(manager_url='https://1.2.3.4', group='oneview')
        self.config(username='******', group='oneview')
        self.config(password='******', group='oneview')

        mgr_utils.mock_the_extension_manager(driver="fake_oneview")
        self.driver = driver_factory.get_driver("fake_oneview")

        self.node = obj_utils.create_test_node(
            self.context, driver='fake_oneview',
            properties=db_utils.get_test_oneview_properties(),
            driver_info=db_utils.get_test_oneview_driver_info(),
        )
        self.info = common.get_oneview_info(self.node)
Пример #43
0
 def setUp(self):
     super(DracJobTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_drac')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_drac',
                                            driver_info=INFO_DICT)
     self.job_dict = {
         'id': 'JID_001436912645',
         'name': 'ConfigBIOS:BIOS.Setup.1-1',
         'start_time': '00000101000000',
         'until_time': 'TIME_NA',
         'message': 'Job in progress',
         'state': 'Running',
         'percent_complete': 34}
     self.job = test_utils.dict_to_namedtuple(values=self.job_dict)
Пример #44
0
    def setUp(self):
        super(SeaMicroDriverTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager(driver='fake_seamicro')
        self.driver = driver_factory.get_driver('fake_seamicro')
        self.node = obj_utils.create_test_node(self.context,
                                               driver='fake_seamicro',
                                               driver_info=INFO_DICT)
        self.get_server_patcher = mock.patch.object(seamicro,
                                                    '_get_server',
                                                    autospec=True)

        self.get_server_mock = None
        self.Server = Fake_Server
        self.Volume = Fake_Volume
        self.info = seamicro._parse_driver_info(self.node)
Пример #45
0
    def test_node_set_boot_device_adopting(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=uuidutils.generate_uuid(),
                                          driver='fake_ipmitool',
                                          driver_info=ipmi_info,
                                          provision_state=states.ADOPTING)
        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')
            self.assertFalse(mock_sbd.called)
Пример #46
0
    def setUp(self):
        irmc_boot.check_share_fs_mounted_patcher.start()
        self.addCleanup(irmc_boot.check_share_fs_mounted_patcher.stop)
        super(IRMCDeployPrivateMethodsTestCase, self).setUp()
        mgr_utils.mock_the_extension_manager(driver='iscsi_irmc')
        self.node = obj_utils.create_test_node(
            self.context, driver='iscsi_irmc', driver_info=INFO_DICT)

        CONF.irmc.remote_image_share_root = '/remote_image_share_root'
        CONF.irmc.remote_image_server = '10.20.30.40'
        CONF.irmc.remote_image_share_type = 'NFS'
        CONF.irmc.remote_image_share_name = 'share'
        CONF.irmc.remote_image_user_name = 'admin'
        CONF.irmc.remote_image_user_password = '******'
        CONF.irmc.remote_image_user_domain = 'local'
Пример #47
0
 def test_check_image_size_raw_stream_disabled(self, show_mock):
     CONF.set_override('stream_raw_images', False, 'agent')
     show_mock.return_value = {
         'size': 15 * 1024 * 1024,
         'disk_format': 'raw',
     }
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     with task_manager.acquire(self.context, self.node.uuid,
                               shared=False) as task:
         task.node.properties['memory_mb'] = 10
         # Image is raw but stream is disabled, so test should fail since
         # the image is bigger than the RAM size
         self.assertRaises(exception.InvalidParameterValue,
                           agent.check_image_size, task, 'fake-image')
         show_mock.assert_called_once_with(self.context, 'fake-image')
Пример #48
0
 def setUp(self):
     super(TestAgentDeploy, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_agent')
     self.driver = agent.AgentDeploy()
     n = {
         'driver': 'fake_agent',
         'instance_info': INSTANCE_INFO,
         'driver_info': DRIVER_INFO,
         'driver_internal_info': DRIVER_INTERNAL_INFO,
     }
     self.node = object_utils.create_test_node(self.context, **n)
     self.ports = [
         object_utils.create_test_port(self.context, node_id=self.node.id)
     ]
     dhcp_factory.DHCPFactory._dhcp_provider = None
Пример #49
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=uuidutils.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)
Пример #50
0
 def setUp(self):
     super(NeutronInterfaceTestCase, self).setUp()
     self.config(enabled_drivers=['fake'])
     mgr_utils.mock_the_extension_manager()
     self.interface = neutron.NeutronNetwork()
     self.node = utils.create_test_node(self.context,
                                        network_interface='neutron')
     self.port = utils.create_test_port(
         self.context,
         node_id=self.node.id,
         address='52:54:00:cf:2d:32',
         extra={'vif_port_id': uuidutils.generate_uuid()})
     self.neutron_port = {
         'id': '132f871f-eaec-4fed-9475-0d54465e0f00',
         'mac_address': '52:54:00:cf:2d:32'
     }
Пример #51
0
    def test__get_domain_by_macs_not_found(self, libvirt_conn_mock):
        mgr_utils.mock_the_extension_manager(driver="fake_libvirt_fake")
        driver_factory.get_driver("fake_libvirt_fake")
        node = obj_utils.create_test_node(
            self.context,
            driver='fake_libvirt_fake',
            driver_info=_get_test_libvirt_driver_info('socket'))
        obj_utils.create_test_port(self.context,
                                   node_id=node.id,
                                   address='00:17:3a:50:12:12')

        with task_manager.acquire(self.context, node.uuid,
                                  shared=True) as task:

            self.assertRaises(exception.NodeNotFound,
                              power._get_domain_by_macs, task)
Пример #52
0
    def setUp(self):
        super(OneViewPowerDriverTestCase, self).setUp()
        self.config(manager_url='https://1.2.3.4', group='oneview')
        self.config(username='******', group='oneview')
        self.config(password='******', group='oneview')

        mgr_utils.mock_the_extension_manager(driver='fake_oneview')
        self.driver = driver_factory.get_driver('fake_oneview')

        self.node = obj_utils.create_test_node(
            self.context, driver='fake_oneview',
            properties=db_utils.get_test_oneview_properties(),
            driver_info=db_utils.get_test_oneview_driver_info(),
        )
        self.info = common.get_oneview_info(self.node)
        deploy_utils.is_node_in_use_by_oneview = mock.Mock(return_value=False)
Пример #53
0
    def test__get_domain_by_macs(self, libvirt_conn_mock):
        mgr_utils.mock_the_extension_manager(driver="fake_libvirt_fake")
        driver_factory.get_driver("fake_libvirt_fake")
        node = obj_utils.create_test_node(
            self.context,
            driver='fake_libvirt_fake',
            driver_info=_get_test_libvirt_driver_info('socket'))
        obj_utils.create_test_port(self.context,
                                   node_id=node.id,
                                   address='00:16:3e:49:1d:11')

        with task_manager.acquire(self.context, node.uuid,
                                  shared=True) as task:
            domain = power._get_domain_by_macs(task)

        self.assertEqual('test_libvirt_domain', domain.name())
Пример #54
0
    def setUp(self):
        super(TestPXEUtils, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="fake")

        self.pxe_options = {
            'deployment_aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
            u'c02d7f33c123/deploy_kernel',
            'aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
            u'kernel',
            'ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
            u'ramdisk',
            'pxe_append_params': 'test_param',
            'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
            u'f33c123/deploy_ramdisk',
            'ipa-api-url': 'http://192.168.122.184:6385',
            'ipxe_timeout': 0,
        }

        self.ipxe_options = self.pxe_options.copy()
        self.ipxe_options.update({
            'deployment_aki_path': 'http://1.2.3.4:1234/deploy_kernel',
            'deployment_ari_path': 'http://1.2.3.4:1234/deploy_ramdisk',
            'aki_path': 'http://1.2.3.4:1234/kernel',
            'ari_path': 'http://1.2.3.4:1234/ramdisk',
            'initrd_filename': 'deploy_ramdisk',
        })

        self.ipxe_options_timeout = self.ipxe_options.copy()
        self.ipxe_options_timeout.update({'ipxe_timeout': 120})

        self.ipxe_options_boot_from_volume = self.ipxe_options.copy()
        self.ipxe_options_boot_from_volume.update({
            'boot_from_volume':
            True,
            'iscsi_boot_url':
            'iscsi:fake_host::3260:0:fake_iqn',
            'iscsi_initiator_iqn':
            'fake_iqn',
            'iscsi_volumes': ['iscsi:fake_host::3260:1:fake_iqn'],
            'username':
            '******',
            'password':
            '******'
        })
        self.ipxe_options_boot_from_volume.pop('initrd_filename', None)

        self.node = object_utils.create_test_node(self.context)
Пример #55
0
 def setUp(self):
     super(ISCSIDeployTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     self.driver = driver_factory.get_driver("fake_pxe")
     # NOTE(TheJulia): We explicitly set the noop storage interface as the
     # default below for deployment tests in order to raise any change
     # in the default which could be a breaking behavior change
     # as the storage interface is explicitly an "opt-in" interface.
     self.node = obj_utils.create_test_node(
         self.context, driver='fake_pxe',
         instance_info=INST_INFO_DICT,
         driver_info=DRV_INFO_DICT,
         driver_internal_info=DRV_INTERNAL_INFO_DICT,
         storage_interface='noop',
     )
     self.node.driver_internal_info['agent_url'] = 'http://1.2.3.4:1234'
     dhcp_factory.DHCPFactory._dhcp_provider = None
Пример #56
0
    def test_build_instance_info_for_deploy_nonsupported_image(
            self, validate_href_mock):
        validate_href_mock.side_effect = iter([
            exception.ImageRefValidationFailed(image_href='file://img.qcow2',
                                               reason='fail')
        ])
        i_info = self.node.instance_info
        i_info['image_source'] = 'file://img.qcow2'
        i_info['image_checksum'] = 'aa'
        self.node.instance_info = i_info
        self.node.save()

        mgr_utils.mock_the_extension_manager(driver='fake_agent')
        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:

            self.assertRaises(exception.ImageRefValidationFailed,
                              agent.build_instance_info_for_deploy, task)
Пример #57
0
    def test_build_instance_info_for_deploy_nonglance_image(
            self, validate_href_mock):
        i_info = self.node.instance_info
        i_info['image_source'] = 'http://image-ref'
        i_info['image_checksum'] = 'aa'
        self.node.instance_info = i_info
        self.node.save()

        mgr_utils.mock_the_extension_manager(driver='fake_agent')
        with task_manager.acquire(self.context, self.node.uuid,
                                  shared=False) as task:

            info = agent.build_instance_info_for_deploy(task)

            self.assertEqual(self.node.instance_info['image_source'],
                             info['image_url'])
            validate_href_mock.assert_called_once_with(mock.ANY,
                                                       'http://image-ref')
Пример #58
0
 def setUp(self):
     super(TestVendorPassthru, self).setUp()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
     self.driver.vendor = iscsi_deploy.VendorPassthru()
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake',
         instance_info=INST_INFO_DICT,
         driver_info=DRV_INFO_DICT,
         driver_internal_info=DRV_INTERNAL_INFO_DICT,
     )
     self.node.driver_internal_info['agent_url'] = 'http://1.2.3.4:1234'
     self.task = mock.MagicMock(spec=task_manager.TaskManager)
     self.task.shared = False
     self.task.node = self.node
     self.task.driver = self.driver
     self.task.context = self.context
Пример #59
0
 def setUp(self):
     super(PXEBootTestCase, self).setUp()
     self.context.auth_token = 'fake'
     self.temp_dir = tempfile.mkdtemp()
     self.config(tftp_root=self.temp_dir, group='pxe')
     self.temp_dir = tempfile.mkdtemp()
     self.config(images_path=self.temp_dir, group='pxe')
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     instance_info = INST_INFO_DICT
     instance_info['deploy_key'] = 'fake-56789'
     self.node = obj_utils.create_test_node(
         self.context,
         driver='fake_pxe',
         instance_info=instance_info,
         driver_info=DRV_INFO_DICT,
         driver_internal_info=DRV_INTERNAL_INFO_DICT)
     self.port = obj_utils.create_test_port(self.context,
                                            node_id=self.node.id)
     self.config(group='conductor', api_url='http://127.0.0.1:1234/')
Пример #60
0
    def setUp(self):
        super(OneViewAgentDeployTestCase, self).setUp()
        self.config(manager_url='https://1.2.3.4', group='oneview')
        self.config(username='******', group='oneview')
        self.config(password='******', group='oneview')

        mgr_utils.mock_the_extension_manager(driver='agent_pxe_oneview')
        self.driver = driver_factory.get_driver('agent_pxe_oneview')

        OV_DRV_INFO_DICT = db_utils.get_test_oneview_driver_info()
        OV_DRV_INFO_DICT.update(PXE_DRV_INFO_DICT)
        self.node = obj_utils.create_test_node(
            self.context, driver='agent_pxe_oneview',
            properties=db_utils.get_test_oneview_properties(),
            driver_info=OV_DRV_INFO_DICT,
            instance_info=PXE_INST_INFO_DICT,
        )
        self.port = obj_utils.create_test_port(self.context,
                                               node_id=self.node.id)
        self.info = common.get_oneview_info(self.node)