'Create cloud database instance.'

def handle_create(self):

    self.flavor = self.properties[self.FLAVOR]
    self.volume = {'size': self.properties[self.SIZE]}
    self.databases = self.properties[self.DATABASES]
    self.users = self.properties[self.USERS]
    restore_point = self.properties[self.RESTORE_POINT]
    if restore_point:
        restore_point = {'backupRef': restore_point}
    zone = self.properties[self.AVAILABILITY_ZONE]
    self.datastore_type = self.properties[self.DATASTORE_TYPE]
    self.datastore_version = self.properties[self.DATASTORE_VERSION]
    replica_of = self.properties[self.REPLICA_OF]
    replica_count = self.properties[self.REPLICA_COUNT]
    for user in self.users:
        dbs = [{'name': db} for db in user.get(self.USER_DATABASES, [])]
        user[self.USER_DATABASES] = dbs
    nics = []
    for nic in self.properties[self.NICS]:
        nic_dict = {}
        net = nic.get(self.NET)
        if net:
            net_id = self.client_plugin('neutron').find_resourceid_by_name_or_id('network', net)
            nic_dict['net-id'] = net_id
        port = nic.get(self.PORT)
        if port:
            neutron = self.client_plugin('neutron')
            nic_dict['port-id'] = neutron.find_resourceid_by_name_or_id('port', port)
        ip = nic.get(self.V4_FIXED_IP)
        if ip:
            nic_dict['v4-fixed-ip'] = ip
        nics.append(nic_dict)
    instance = self.client().instances.create(self._dbinstance_name(), self.flavor, volume=self.volume, databases=self.databases, users=self.users, restorePoint=restore_point, availability_zone=zone, datastore=self.datastore_type, datastore_version=self.datastore_version, nics=nics, replica_of=replica_of, replica_count=replica_count)
    self.resource_id_set(instance.id)
    return instance.id
