Beispiel #1
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)
Beispiel #2
0
 def setUp(self):
     super(TaskManagerSetup, self).setUp()
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
     self.config(host='test-host')
Beispiel #3
0
 def test_check_image_size_without_memory_mb(self, size_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(size_mock.called)
Beispiel #4
0
 def setUp(self):
     super(ManagerTestCase, self).setUp()
     self.service = manager.ConductorManager('test-host', 'test-topic')
     self.context = context.get_admin_context()
     self.dbapi = dbapi.get_instance()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
 def setUp(self):
     super(IloCommonMethodsTestCase, self).setUp()
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     mgr_utils.mock_the_extension_manager(driver="fake_ilo")
     self.node = obj_utils.create_test_node(self.context,
             driver='fake_ilo', driver_info=INFO_DICT)
Beispiel #6
0
 def setUp(self):
     super(MSFTOCSManagementTestCase, 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)
Beispiel #7
0
 def setUp(self):
     super(AMTPowerTestCase, 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)
Beispiel #8
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)
Beispiel #9
0
    def setUp(self):
        super(TestNeutron, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="fake")
        self.config(cleaning_network_uuid="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
 def setUp(self):
     super(TestPXEUtils, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake")
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     self.pxe_options = {
         'deployment_key': '0123456789ABCDEFGHIJKLMNOPQRSTUV',
         'ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
                     u'ramdisk',
         'iscsi_target_iqn': u'iqn-1be26c0b-03f2-4d2e-ae87-c02d7f33'
                             u'c123',
         'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
                                u'f33c123/deploy_ramdisk',
         'pxe_append_params': 'test_param',
         'aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
                     u'kernel',
         'deployment_id': u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
         'ironic_api_url': 'http://192.168.122.184:6385',
         'deployment_aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
                                u'c02d7f33c123/deploy_kernel',
         'disk': 'cciss/c0d0,sda,hda,vda'
     }
     self.agent_pxe_options = {
         'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
                                u'f33c123/deploy_ramdisk',
         'pxe_append_params': 'test_param',
         'aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
                     u'kernel',
         'ipa-api-url': 'http://192.168.122.184:6385',
         'deployment_aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
                                u'c02d7f33c123/deploy_kernel',
     }
     self.node = object_utils.create_test_node(self.context)
 def setUp(self):
     super(IloPXEVendorPassthruTestCase, self).setUp()
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     mgr_utils.mock_the_extension_manager(driver="pxe_ilo")
     self.node = obj_utils.create_test_node(self.context,
             driver='pxe_ilo', driver_info=INFO_DICT)
 def setUp(self):
     super(IloVirtualMediaAgentDeployTestCase, self).setUp()
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     mgr_utils.mock_the_extension_manager(driver="agent_ilo")
     self.node = obj_utils.create_test_node(self.context,
             driver='agent_ilo', driver_info=INFO_DICT)
Beispiel #13
0
    def setUp(self):
        super(SSHDriverTestCase, self).setUp()
        self.context = context.get_admin_context()
        mgr_utils.mock_the_extension_manager(driver="fake_ssh")
        self.driver = driver_factory.get_driver("fake_ssh")
        n = db_utils.get_test_node(
                driver='fake_ssh',
                driver_info=INFO_DICT)
        self.dbapi = dbapi.get_instance()
        self.node = self.dbapi.create_node(n)
        self.port = self.dbapi.create_port(db_utils.get_test_port(
                                                         node_id=self.node.id))
        self.sshclient = paramiko.SSHClient()

        #setup these mocks because most tests use them
        self.parse_drv_info_patcher = mock.patch.object(ssh,
                                                        '_parse_driver_info')
        self.parse_drv_info_mock = None
        self.get_mac_addr_patcher = mock.patch.object(
                ssh,
                '_get_nodes_mac_addresses')
        self.get_mac_addr_mock = self.get_mac_addr_patcher.start()
        self.get_conn_patcher = mock.patch.object(ssh, '_get_connection')
        self.get_conn_mock = self.get_conn_patcher.start()

        def stop_patchers():
            if self.parse_drv_info_mock:
                self.parse_drv_info_patcher.stop()
            if self.get_mac_addr_mock:
                self.get_mac_addr_patcher.stop()
            if self.get_conn_mock:
                self.get_conn_patcher.stop()

        self.addCleanup(stop_patchers)
Beispiel #14
0
 def test_reboot_to_instance_agent_ipmitool_driver(
         self, get_power_state_mock):
     mgr_utils.mock_the_extension_manager(driver='agent_ipmitool')
     self.node.driver = 'agent_ipmitool'
     self.node.save()
     self._test_reboot_to_instance(
         get_power_state_mock=get_power_state_mock)
Beispiel #15
0
 def setUp(self):
     super(UtilsTestCase, self).setUp()
     self.context = context.get_admin_context()
     self.dbapi = db_api.get_instance()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
     self.node = obj_utils.create_test_node(self.context)
Beispiel #16
0
 def test_reboot_to_instance_agent_irmc_driver(self, get_power_state_mock):
     irmc_deploy._check_share_fs_mounted_patcher.start()
     mgr_utils.mock_the_extension_manager(driver='agent_irmc')
     self.node.driver = 'agent_irmc'
     self.node.save()
     self._test_reboot_to_instance(
         get_power_state_mock=get_power_state_mock, uses_pxe=False)
Beispiel #17
0
 def setUp(self):
     super(IRMCPowerTestCase, 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)
    def setUp(self):
        super(OneViewManagementDriverTestCase, self).setUp()
        self.config(manager_url="https://1.2.3.4", group="oneview")
        self.config(username="******", group="oneview")
        self.config(password="******", group="oneview")

        self.mock_verify_oneview_version_obj = mock.patch.object(
            oneview_client, "verify_oneview_version", autospec=True, return_value=120
        )
        self.mock_verify_oneview_version = self.mock_verify_oneview_version_obj.start()
        self.addCleanup(self.mock_verify_oneview_version_obj.stop)
        self.mock_check_oneview_status_obj = mock.patch.object(
            oneview_client, "check_oneview_status", autospec=True, return_value=200
        )
        self.mock_check_oneview_status = self.mock_check_oneview_status_obj.start()
        self.addCleanup(self.mock_check_oneview_status_obj.stop)

        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=PROPERTIES_DICT,
            extra=EXTRA_DICT,
            driver_info=DRIVER_INFO_DICT,
            instance_info=INSTANCE_INFO_DICT,
        )
        self.info = common.parse_driver_info(self.node)
Beispiel #19
0
    def setUp(self):
        super(TestNeutron, self).setUp()
        mgr_utils.mock_the_extension_manager(driver='fake')
        self.config(
            cleaning_network_uuid='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
Beispiel #20
0
 def setUp(self):
     super(PXEPrivateMethodsTestCase, self).setUp()
     n = {"driver": "fake_pxe", "driver_info": INFO_DICT}
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     self.node = obj_utils.create_test_node(self.context, **n)
Beispiel #21
0
 def setUp(self):
     super(WakeOnLanPrivateMethodTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_wol')
     self.driver = driver_factory.get_driver('fake_wol')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_wol')
     self.port = obj_utils.create_test_port(self.context,
                                            node_id=self.node.id)
Beispiel #22
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')
Beispiel #23
0
 def test__wait_for_neutron_update(self):
     kw = {"id": 190238451205398, "uuid": utils.generate_uuid(), "driver": "fake_ssh"}
     node = object_utils.create_test_node(self.context, **kw)
     mgr_utils.mock_the_extension_manager(driver="fake_ssh")
     with task_manager.acquire(self.context, node.uuid) as task:
         with mock.patch("time.sleep") as mock_sleep:
             neutron._wait_for_neutron_update(task)
             mock_sleep.assert_called_once_with(15)
Beispiel #24
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)
Beispiel #25
0
 def setUp(self):
     super(DracManagementTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_drac")
     self.context = context.get_admin_context()
     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()
     self.task.node = self.node
Beispiel #26
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')
Beispiel #27
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='instance_uuid_123')
 def setUp(self):
     super(IscsiDeployMethodsTestCase, self).setUp()
     n = {
           'driver': 'fake_pxe',
           'instance_info': INST_INFO_DICT,
           'driver_info': DRV_INFO_DICT,
     }
     mgr_utils.mock_the_extension_manager(driver="fake_pxe")
     self.node = obj_utils.create_test_node(self.context, **n)
Beispiel #29
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')
Beispiel #30
0
 def setUp(self):
     super(CleanUpTestCase, self).setUp()
     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)
Beispiel #31
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')

        self.get_server_mock = None
        self.Server = Fake_Server
        self.Volume = Fake_Volume
        self.info = seamicro._parse_driver_info(self.node)
Beispiel #32
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)]
Beispiel #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=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')
Beispiel #34
0
    def setUp(self):
        super(SeaMicroPowerDriverTestCase, self).setUp()
        if not seamicroclient:
            self.skipTest("Seamicroclient library not found")
        mgr_utils.mock_the_extension_manager(driver='fake_seamicro')
        self.driver = driver_factory.get_driver('fake_seamicro')
        db_node = db_utils.get_test_node(driver='fake_seamicro',
                                         driver_info=INFO_DICT)
        self.dbapi = dbapi.get_instance()
        self.node = self.dbapi.create_node(db_node)
        self.get_server_patcher = mock.patch.object(seamicro, '_get_server')

        self.get_server_mock = None
        self.Server = Fake_Server
        self.Volume = Fake_Volume
Beispiel #35
0
 def setUp(self):
     super(TestNeutron, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake')
     self.config(enabled_drivers=['fake'])
     self.config(url='test-url', url_timeout=30, 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.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     self.node = object_utils.create_test_node(self.context)
Beispiel #36
0
 def setUp(self):
     super(TestNeutron, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake')
     self.config(enabled_drivers=['fake'])
     self.config(dhcp_provider='neutron', group='dhcp')
     self.config(url='test-url', url_timeout=30, 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)
     dhcp_factory.DHCPFactory._dhcp_provider = None
Beispiel #37
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)
Beispiel #38
0
    def test_build_instance_info_for_deploy_nonsupported_image(
            self, validate_href_mock):
        validate_href_mock.side_effect = 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)
Beispiel #39
0
 def setUp(self):
     super(PXEDriverTestCase, self).setUp()
     self.context = context.get_admin_context()
     self.context.auth_token = '4562138218392831'
     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")
     driver_info = INFO_DICT
     driver_info['pxe_deploy_key'] = 'fake-56789'
     n = db_utils.get_test_node(driver='fake_pxe', driver_info=driver_info)
     self.dbapi = dbapi.get_instance()
     self.node = self.dbapi.create_node(n)
     self.port = self.dbapi.create_port(
         db_utils.get_test_port(node_id=self.node.id))
Beispiel #40
0
 def setUp(self):
     super(PXEDriverTestCase, self).setUp()
     self.context.auth_token = '4562138218392831'
     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)
     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/')
Beispiel #41
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('http://image-ref')
Beispiel #42
0
    def setUp(self):
        super(TestPXEUtils, self).setUp()
        mgr_utils.mock_the_extension_manager(driver="fake")

        common_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',
            'pxe_append_params': 'test_param',
            'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
            u'f33c123/deploy_ramdisk',
            'root_device': 'vendor=fake,size=123',
            'ipa-api-url': 'http://192.168.122.184:6385',
        }

        self.pxe_options = {
            'deployment_key': '0123456789ABCDEFGHIJKLMNOPQRSTUV',
            'ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
            u'ramdisk',
            'iscsi_target_iqn': u'iqn-1be26c0b-03f2-4d2e-ae87-c02d7f33'
            u'c123',
            'deployment_id': u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
            'ironic_api_url': 'http://192.168.122.184:6385',
            'disk': 'cciss/c0d0,sda,hda,vda',
            'boot_option': 'netboot',
            'ipa-driver-name': 'pxe_ssh',
            'boot_mode': 'bios',
        }
        self.pxe_options.update(common_pxe_options)

        self.agent_pxe_options = {
            'ipa-driver-name': 'agent_ipmitool',
        }
        self.agent_pxe_options.update(common_pxe_options)

        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',
        })

        self.node = object_utils.create_test_node(self.context)
    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')
Beispiel #44
0
    def test_finish_deploy_ssh_with_local_boot(self, notify_mock,
                                               node_power_mock):
        instance_info = dict(INST_INFO_DICT)
        instance_info['capabilities'] = {'boot_option': 'local'}
        n = {
              'uuid': uuidutils.generate_uuid(),
              'driver': 'fake_ssh',
              'instance_info': instance_info,
              'provision_state': states.DEPLOYING,
              'target_provision_state': states.ACTIVE,
        }
        mgr_utils.mock_the_extension_manager(driver="fake_ssh")
        node = obj_utils.create_test_node(self.context, **n)

        with task_manager.acquire(self.context, node.uuid,
                                  shared=False) as task:
            iscsi_deploy.finish_deploy(task, '1.2.3.4')
            notify_mock.assert_called_once_with('1.2.3.4')
            self.assertEqual(states.ACTIVE, task.node.provision_state)
            self.assertEqual(states.NOSTATE, task.node.target_provision_state)
            node_power_mock.assert_called_once_with(task, states.REBOOT)
Beispiel #45
0
 def setUp(self):
     super(TestPXEUtils, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake")
     self.dbapi = dbapi.get_instance()
     self.context = context.get_admin_context()
     self.pxe_options = {
         'deployment_key': '0123456789ABCDEFGHIJKLMNOPQRSTUV',
         'ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
         u'ramdisk',
         'iscsi_target_iqn': u'iqn-1be26c0b-03f2-4d2e-ae87-c02d7f33'
         u'c123',
         'deployment_ari_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
         u'f33c123/deploy_ramdisk',
         'pxe_append_params': 'test_param',
         'aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
         u'kernel',
         'deployment_id': u'1be26c0b-03f2-4d2e-ae87-c02d7f33c123',
         'ironic_api_url': 'http://192.168.122.184:6385',
         'deployment_aki_path': u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
         u'c02d7f33c123/deploy_kernel',
         'disk': 'cciss/c0d0,sda,hda,vda'
     }
     self.agent_pxe_options = {
         'deployment_ari_path':
         u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7'
         u'f33c123/deploy_ramdisk',
         'pxe_append_params':
         'test_param',
         'aki_path':
         u'/tftpboot/1be26c0b-03f2-4d2e-ae87-c02d7f33c123/'
         u'kernel',
         'ipa-api-url':
         'http://192.168.122.184:6385',
         'deployment_aki_path':
         u'/tftpboot/1be26c0b-03f2-4d2e-ae87-'
         u'c02d7f33c123/deploy_kernel',
     }
     self.node = object_utils.create_test_node(self.context)
Beispiel #46
0
    def test_build_instance_info_for_deploy_glance_image(self, glance_mock):
        i_info = self.node.instance_info
        i_info['image_source'] = '733d1c44-a2ea-414b-aca7-69decf20d810'
        self.node.instance_info = i_info
        self.node.save()

        image_info = {'checksum': 'aa', 'disk_format': 'qcow2',
                      'container_format': 'bare'}
        glance_mock.return_value.show = mock.MagicMock(spec_set=[],
                                                       return_value=image_info)

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

            agent.build_instance_info_for_deploy(task)

            glance_mock.assert_called_once_with(version=2,
                                                context=task.context)
            glance_mock.return_value.show.assert_called_once_with(
                self.node.instance_info['image_source'])
            glance_mock.return_value.swift_temp_url.assert_called_once_with(
                image_info)
Beispiel #47
0
    def test_get_mockable_ext_mgr(self):
        (mgr, ext) = utils.mock_the_extension_manager('fake', 'ironic.drivers')

        # confirm that stevedore did not scan the actual entrypoints
        self.assertNotEqual(mgr._extension_manager.namespace, 'ironic.drivers')
        # confirm mgr has only one extension
        self.assertEqual(len(mgr._extension_manager.extensions), 1)
        # confirm that we got a reference to the extension in this manager
        self.assertEqual(mgr._extension_manager.extensions[0], ext)
        # confirm that it is the "fake" driver we asked for
        self.assertEqual("%s" % ext.entry_point,
                         "fake = ironic.drivers.fake:FakeDriver")
        # Confirm driver is loaded
        self.assertIn('fake', mgr.names)
Beispiel #48
0
 def setUp(self):
     super(TestNetwork, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake')
     self.node = object_utils.create_test_node(self.context)
Beispiel #49
0
 def setUp(self):
     super(VirtualMediaDeployUtilsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
     info_dict = db_utils.get_test_ilo_info()
     self.node = obj_utils.create_test_node(self.context,
     driver='iscsi_ilo', driver_info=info_dict)
Beispiel #50
0
 def setUp(self):
     super(AMTManagementInteralMethodsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver='fake_amt')
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_amt',
                                            driver_info=INFO_DICT)
Beispiel #51
0
 def test_reboot_to_instance_agent_ilo_driver(self, get_power_state_mock):
     mgr_utils.mock_the_extension_manager(driver='agent_ilo')
     self.node.driver = 'agent_ilo'
     self.node.save()
     self._test_reboot_to_instance(
         get_power_state_mock=get_power_state_mock, uses_pxe=False)
Beispiel #52
0
 def setUp(self):
     super(IloInspectTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="fake_ilo")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='fake_ilo',
                                            driver_info=INFO_DICT)
Beispiel #53
0
 def setUp(self):
     super(NodePowerActionTestCase, self).setUp()
     self.context = context.get_admin_context()
     self.dbapi = dbapi.get_instance()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
Beispiel #54
0
 def setUp(self):
     super(IloVirtualMediaAgentDeployTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="agent_ilo")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='agent_ilo',
                                            driver_info=INFO_DICT)
Beispiel #55
0
 def setUp(self):
     super(NodePowerActionTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
Beispiel #56
0
 def setUp(self):
     super(IloDeployPrivateMethodsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="iscsi_ilo")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='iscsi_ilo',
                                            driver_info=INFO_DICT)
Beispiel #57
0
 def setUp(self):
     super(UtilsTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager()
     self.driver = driver_factory.get_driver("fake")
     self.node = obj_utils.create_test_node(self.context)
Beispiel #58
0
    def setUp(self):
        super(CleanUpFullFlowTestCase, self).setUp()
        self.config(image_cache_size=0, group='pxe')

        # Configure node
        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)
        self.port = obj_utils.create_test_port(self.context,
                                               node_id=self.node.id)

        # Configure temporary directories
        pxe_temp_dir = tempfile.mkdtemp()
        self.config(tftp_root=pxe_temp_dir, group='pxe')
        tftp_master_dir = os.path.join(CONF.pxe.tftp_root,
                                       'tftp_master')
        self.config(tftp_master_path=tftp_master_dir, group='pxe')
        os.makedirs(tftp_master_dir)

        instance_temp_dir = tempfile.mkdtemp()
        self.config(images_path=instance_temp_dir,
                    group='pxe')
        instance_master_dir = os.path.join(CONF.pxe.images_path,
                                           'instance_master')
        self.config(instance_master_path=instance_master_dir,
                    group='pxe')
        os.makedirs(instance_master_dir)
        self.pxe_config_dir = os.path.join(CONF.pxe.tftp_root, 'pxelinux.cfg')
        os.makedirs(self.pxe_config_dir)

        # Populate some file names
        self.master_kernel_path = os.path.join(CONF.pxe.tftp_master_path,
                                               'kernel')
        self.master_instance_path = os.path.join(CONF.pxe.instance_master_path,
                                                'image_uuid')
        self.node_tftp_dir = os.path.join(CONF.pxe.tftp_root,
                                          self.node.uuid)
        os.makedirs(self.node_tftp_dir)
        self.kernel_path = os.path.join(self.node_tftp_dir,
                                        'kernel')
        self.node_image_dir = iscsi_deploy._get_image_dir_path(self.node.uuid)
        os.makedirs(self.node_image_dir)
        self.image_path = iscsi_deploy._get_image_file_path(self.node.uuid)
        self.config_path = pxe_utils.get_pxe_config_file_path(self.node.uuid)
        self.mac_path = pxe_utils._get_pxe_mac_path(self.port.address)
        self.token_path = pxe._get_token_file_path(self.node.uuid)

        # Create files
        self.files = [self.config_path, self.master_kernel_path,
                      self.master_instance_path, self.token_path]
        for fname in self.files:
            # NOTE(dtantsur): files with 0 size won't be cleaned up
            with open(fname, 'w') as fp:
                fp.write('test')

        os.link(self.config_path, self.mac_path)
        os.link(self.master_kernel_path, self.kernel_path)
        os.link(self.master_instance_path, self.image_path)
Beispiel #59
0
 def _do_mock(self):
     # NOTE(dtantsur): fake driver always has inspection, using another one
     mgr_utils.mock_the_extension_manager("pxe_ssh")
     self.driver = driver_factory.get_driver("pxe_ssh")
Beispiel #60
0
 def setUp(self):
     super(IloPXEVendorPassthruTestCase, self).setUp()
     mgr_utils.mock_the_extension_manager(driver="pxe_ilo")
     self.node = obj_utils.create_test_node(self.context,
                                            driver='pxe_ilo',
                                            driver_info=INFO_DICT)