Esempio n. 1
0
    def _create_test_host(self, personality, subfunction=None, numa_nodes=1):
        subfunctions = [personality]
        if subfunction:
            subfunctions.append(subfunction)

        host = dbutils.create_test_ihost(personality=personality,
                                         hostname='%s-0' % personality,
                                         forisystemid=self.system.id,
                                         subfunctions=",".join(subfunctions))

        for numa_node in range(0, numa_nodes):
            node = self.dbapi.inode_create(
                host.id, dbutils.get_test_node(numa_node=numa_node))

            self.dbapi.imemory_create(
                host.id, dbutils.get_test_imemory(forinodeid=node.id))

        self.dbapi.idisk_create(
            host.id,
            dbutils.get_test_idisk(device_node=self.root_disk_device_node,
                                   device_type=self.root_disk_device_type))

        self.hosts.append(host)

        return host
Esempio n. 2
0
    def _create_test_host(self,
                          personality,
                          subfunction=None,
                          numa_nodes=1,
                          unit=0,
                          **kw):
        subfunctions = [personality]
        if subfunction:
            subfunctions.append(subfunction)

        if personality == constants.CONTROLLER:
            hostname = '%s-%s' % (personality, unit)
            name = utils.format_address_name(hostname,
                                             constants.NETWORK_TYPE_MGMT)
            address = self.dbapi.address_get_by_name(name)
            mgmt_ipaddr = address.address

            host = dbutils.create_test_ihost(
                uuid=uuidutils.generate_uuid(),
                personality=personality,
                hostname='%s-%s' % (personality, unit),
                mgmt_mac='03:11:22:33:44:' + str(10 + len(self.hosts)),
                mgmt_ip=mgmt_ipaddr,
                forisystemid=self.system.id,
                subfunctions=",".join(subfunctions),
                **kw)
        else:
            host = dbutils.create_test_ihost(
                uuid=uuidutils.generate_uuid(),
                personality=personality,
                hostname='%s-%s' % (personality, unit),
                mgmt_mac='03:11:22:33:44:' + str(10 + len(self.hosts)),
                forisystemid=self.system.id,
                subfunctions=",".join(subfunctions),
                **kw)

        for numa_node in range(0, numa_nodes):
            node = self.dbapi.inode_create(
                host.id,
                dbutils.get_test_node(numa_node=numa_node, forhostid=host.id))

            self.dbapi.imemory_create(
                host.id, dbutils.get_test_imemory(forinodeid=node.id))

        disk = self.dbapi.idisk_create(
            host.id,
            dbutils.get_test_idisk(device_node=self.root_disk_device_node,
                                   device_type=self.root_disk_device_type))
        self.disks[host.id] = disk

        self.hosts.append(host)

        return host
Esempio n. 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'])
Esempio n. 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))