Exemple #1
0
    def _create_compute_service(self):
        """Create compute-manager(ComputeNode and Service record)."""
        ctxt = self.req.environ["nova.context"]
        dic = {
            'host': 'dummy',
            'binary': 'nova-compute',
            'topic': 'compute',
            'report_count': 0
        }
        s_ref = db.service_create(ctxt, dic)

        dic = {
            'service_id': s_ref['id'],
            'host': s_ref['host'],
            'uuid': uuidsentinel.compute_node,
            'vcpus': 16,
            'memory_mb': 32,
            'local_gb': 100,
            'vcpus_used': 16,
            'memory_mb_used': 32,
            'local_gb_used': 10,
            'hypervisor_type': 'qemu',
            'hypervisor_version': 12003,
            'cpu_info': '',
            'stats': ''
        }
        db.compute_node_create(ctxt, dic)

        return db.service_get(ctxt, s_ref['id'])
Exemple #2
0
    def _create_compute_service(self):
        """Create compute-manager(ComputeNode and Service record)."""
        ctxt = self.req.environ["nova.context"]
        dic = {'host': 'dummy', 'binary': 'nova-compute', 'topic': 'compute',
               'report_count': 0}
        s_ref = db.service_create(ctxt, dic)

        dic = {'service_id': s_ref['id'],
               'host': s_ref['host'],
               'uuid': uuidsentinel.compute_node,
               'vcpus': 16, 'memory_mb': 32, 'local_gb': 100,
               'vcpus_used': 16, 'memory_mb_used': 32, 'local_gb_used': 10,
               'hypervisor_type': 'qemu', 'hypervisor_version': 12003,
               'cpu_info': '', 'stats': ''}
        db.compute_node_create(ctxt, dic)

        return db.service_get(ctxt, s_ref['id'])
Exemple #3
0
    def create(self):
        if self.obj_attr_is_set('id'):
            raise exception.ObjectActionError(action='create',
                                              reason='already created')
        updates = self.obj_get_changes()
        if 'uuid' not in updates:
            updates['uuid'] = uuidutils.generate_uuid()
            self.uuid = updates['uuid']

        self._convert_stats_to_db_format(updates)
        self._convert_host_ip_to_db_format(updates)
        self._convert_supported_instances_to_db_format(updates)
        self._convert_pci_stats_to_db_format(updates)

        db_compute = db.compute_node_create(self._context, updates)
        self._from_db_object(self._context, self, db_compute)