'Create a server.
Create a server using the parameters supplied in the POST
application/json object. The required parameters as specified by
the underlying novaclient are:
:param name: The new server name.
:param source_id: The ID of the image to use.
:param flavor_id: The ID of the flavor to use.
:param key_name: (optional extension) name of previously created
keypair to inject into the instance.
:param user_data: user data to pass to be exposed by the metadata
server this can be a file type object as well or a
string.
:param security_groups: An array of one or more objects with a "name"
attribute.
Other parameters are accepted as per the underlying novaclient:
"block_device_mapping", "block_device_mapping_v2", "nics", "meta",
"availability_zone", "instance_count", "admin_pass", "disk_config",
"config_drive", "scheduler_hints"
This returns the new server object on success.'

@rest_utils.ajax(data_required=True)
def post(self, request):

    try:
        args = (request, request.DATA['name'], request.DATA['source_id'], request.DATA['flavor_id'], request.DATA['key_name'], request.DATA['user_data'], request.DATA['security_groups'])
    except KeyError as e:
        raise rest_utils.AjaxError(400, ("missing    required    parameter    '%s'" % e.args[0]))
    kw = {}
    for name in self._optional_create:
        if (name in request.DATA):
            kw[name] = request.DATA[name]
    new = api.nova.server_create(*args, **kw)
    return rest_utils.CreatedResponse(('/api/nova/servers/%s' % utils_http.urlquote(new.id)), new.to_dict())
