Skip to content

[Question, potentially a bug] How to debug requests when creating a server #403

@BelleNottelling

Description

@BelleNottelling

Hi there, I'd appreciate some assistance on the following error that's produced by the SDK:

[09-Feb-2024 07:13:20 UTC] HTTP Error
~~~~~~~~~~
The remote server returned a "400 Bad Request" error for the following transaction:
 
Request
~~~~~~~
POST /compute/v2.1/servers HTTP/1.1
User-Agent: GuzzleHttp/7
Content-Type: application/json
Host: something
 
Response
~~~~~~~~
HTTP/1.1 400 Bad Request
Date: Fri, 09 Feb 2024 07:13:20 GMT
Server: Apache/2.4.52 (Ubuntu)
OpenStack-API-Version: compute 2.1
X-OpenStack-Nova-API-Version: 2.1
Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 137
x-openstack-request-id: something
x-compute-request-id: something else
Connection: close
 
Further information
~~~~~~~~~~~~~~~~~~~
Please ensure that your input values are valid and well-formed. Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues.

This error is produced with code as follows:

// Creates a new user on the OpenStack server and then establishes a new OpenStack connection instance using the new user's credentials.
$OpenStack = $this->authenticateAsClient();

// Now create a new network for the server to be attached to
$network = $OpenStack->networkingV2()->createNetwork([
    'name'         => "Some name",
    'adminStateUp' => true,
]);

// Finally create the server
$server = $OpenStack->computeV2()->createServer([
    'name'     => "Some name",
    'imageId'  => "The image ID",
    'flavorId' => "The flavor ID",
    'networks'  => [
        ['uuid' => $network->id]
    ],
]);

I am fairly new to OpenStack and I am working on a project with it, so I apologize if there's something I am blaitantly doing wrong here, but the logged message isn't particularly clear on what the problem is & searching "debug" on the docs returns no results.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions