Beispiel #1
0
    def test_create_cpuToplogy_on_a_server(self):
        n = self._create_test_ihost()
        forihostid = n['id']

        p = self.dbapi.icpu_create(forihostid,
                                   utils.get_test_icpu(forinodeid=3, cpu=2))
        self.assertEqual(n['id'], p['forihostid'])
Beispiel #2
0
    def _create_test_host_cpus(self,
                               host,
                               platform=0,
                               vswitch=0,
                               application=0,
                               threads=1):
        counts = [platform, vswitch, application]
        functions = [
            constants.PLATFORM_FUNCTION, constants.VSWITCH_FUNCTION,
            constants.APPLICATION_FUNCTION
        ]

        nodes = self.dbapi.inode_get_by_ihost(host.id)
        for node in nodes:
            cpu = 0
            for count, function in zip(counts, functions):
                for _ in range(0, count):
                    for thread in range(0, threads):
                        self.dbapi.icpu_create(
                            host.id,
                            dbutils.get_test_icpu(forinodeid=node.id,
                                                  cpu=cpu,
                                                  thread=thread,
                                                  allocated_function=function))
                    cpu = cpu + 1
Beispiel #3
0
    def test_create_memoryToplogy_on_a_server_and_cpu(self):
        hmemsize = 1000
        n = self._create_test_ihost()

        forihostid = n['id']

        p = self.dbapi.icpu_create(forihostid,
                utils.get_test_icpu(forinodeid=1, cpu=3))
        self.assertEqual(n['id'], p['forihostid'])

        forSocketNuma = p['forinodeid']

        m = self.dbapi.imemory_create(forihostid,
                utils.get_test_imemory(Hugepagesize=hmemsize,
                        forinodeid=forSocketNuma))
        self.assertEqual(n['id'], m['forihostid'])
        self.assertEqual(p['forinodeid'], m['forinodeid'])
Beispiel #4
0
    def setUp(self):
        super(ProfileTestCase, self).setUp()
        self.dbapi = dbapi.get_instance()
        self.system = dbutils.create_test_isystem()
        self.load = dbutils.create_test_load()
        self.controller = dbutils.create_test_ihost(
            id='1',
            uuid=None,
            forisystemid=self.system.id,
            hostname='controller-0',
            personality=constants.CONTROLLER,
            subfunctions=constants.CONTROLLER,
            invprovision=constants.PROVISIONED,
        )
        self.worker = dbutils.create_test_ihost(
            id='2',
            uuid=None,
            forisystemid=self.system.id,
            hostname='worker-0',
            personality=constants.WORKER,
            subfunctions=constants.WORKER,
            mgmt_mac='01:02.03.04.05.C0',
            mgmt_ip='192.168.24.12',
            invprovision=constants.PROVISIONED,
        )
        self.profile = {
            'profilename': 'profile-node1',
            'ihost_uuid': self.controller.uuid,
        }
        self.ctrlnode = self.dbapi.inode_create(self.controller.id,
                                                dbutils.get_test_node(id=1))
        self.ctrlcpu = self.dbapi.icpu_create(
            self.controller.id,
            dbutils.get_test_icpu(
                id=1,
                cpu=0,
                forihostid=self.controller.id,
                forinodeid=self.ctrlnode.id,
            ))

        self.ctrlif = dbutils.create_test_interface(
            forihostid=self.controller.id)
        self.port1 = dbutils.create_test_ethernet_port(
            id='1',
            name=self.ctrlif.ifname,
            host_id=self.controller.id,
            interface_id=self.ctrlif.id,
            mac='08:00:27:43:60:11')

        self.ctrlmemory = self.dbapi.imemory_create(
            self.controller.id,
            dbutils.get_test_imemory(id=1,
                                     hugepages_configured=True,
                                     forinodeid=self.ctrlcpu.forinodeid))

        self.compnode = self.dbapi.inode_create(self.worker.id,
                                                dbutils.get_test_node(id=2))
        self.compcpu = self.dbapi.icpu_create(
            self.worker.id,
            dbutils.get_test_icpu(id=5,
                                  cpu=3,
                                  forinodeid=self.compnode.id,
                                  forihostid=self.worker.id))
        self.compcpuapp = self.dbapi.icpu_create(
            self.worker.id,
            dbutils.get_test_icpu(
                id=6,
                cpu=4,
                forinodeid=self.compnode.id,
                forihostid=self.worker.id,
                allocated_function=constants.APPLICATION_FUNCTION))
        self.compmemory = self.dbapi.imemory_create(
            self.worker.id,
            dbutils.get_test_imemory(id=2,
                                     Hugepagesize=constants.MIB_1G,
                                     forinodeid=self.compcpu.forinodeid))

        self.disk = self.dbapi.idisk_create(
            self.worker.id,
            dbutils.get_test_idisk(device_node='/dev/sdb',
                                   device_type=constants.DEVICE_TYPE_HDD))
        self.lvg = self.dbapi.ilvg_create(
            self.worker.id,
            dbutils.get_test_lvg(lvm_vg_name=constants.LVG_NOVA_LOCAL))
        self.pv = self.dbapi.ipv_create(
            self.worker.id,
            dbutils.get_test_pv(lvm_vg_name=constants.LVG_NOVA_LOCAL,
                                disk_or_part_uuid=self.disk.uuid))