'Creates a server and assigns it to security group.
If multi-host is enabled, Ensures servers are created on different
compute nodes, by storing created servers\' ids and uses different_host
as scheduler_hints on creation.
Validates servers are created as requested, using admin client.'

def _create_server(self, name, tenant, security_groups, **kwargs):

    security_groups_names = [{'name': s['name']} for s in security_groups]
    if self.multi_node:
        kwargs['scheduler_hints'] = {'different_host': self.servers}
    server = self.create_server(name=name, networks=[{'uuid': tenant.network['id']}], key_name=tenant.keypair['name'], security_groups=security_groups_names, clients=tenant.manager, **kwargs)
    if ('security_groups' in server):
        self.assertEqual(sorted([s['name'] for s in security_groups]), sorted([s['name'] for s in server['security_groups']]))
    if self.multi_node:
        adm_get_server = self.os_admin.servers_client.show_server
        new_host = adm_get_server(server['id'])['server']['OS-EXT-SRV-ATTR:host']
        host_list = [adm_get_server(s)['server']['OS-EXT-SRV-ATTR:host'] for s in self.servers]
        self.assertNotIn(new_host, host_list, message='Failed    to    boot    servers    on    different    Compute    nodes.')
        self.servers.append(server['id'])
    return server
