Skip to content

api_server: convert the VmmActionError to a JSON object#1547

Merged
dianpopa merged 5 commits intofirecracker-microvm:masterfrom
kzys:json-error
Jan 28, 2020
Merged

api_server: convert the VmmActionError to a JSON object#1547
dianpopa merged 5 commits intofirecracker-microvm:masterfrom
kzys:json-error

Conversation

@kzys
Copy link
Copy Markdown

@kzys kzys commented Jan 24, 2020

The response from this function has content-type:application/json and
Swagger specifies that the JSON object must have "fault_message".

However the implementation was returning a plan string such as
"vCPUs resume failed." which broke clients.

Signed-off-by: Kazuyoshi Kato katokazu@amazon.com

Reason for This PR

The response from this function has content-type:application/json and
Swagger specifies that the JSON object must have "fault_message".

However the implementation was returning a plan string such as
"vCPUs resume failed." which broke clients.

Description of Changes

It adds ApiServer::json_fault_message() to convert a string to a valid JSON document.

License Acceptance

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license.

PR Checklist

[Author TODO: Meet these criteria. Where there are two options, keep one.]
[Reviewer TODO: Verify that these criteria are met. Request changes if not]

  • All commits in this PR are signed (git commit -s).
  • Either this PR is linked to an issue, or, the reason for this PR is
    clearly provided.
  • The description of changes is clear and encompassing.
  • Either no docs need to be updated as part of this PR, or, the required
    doc changes are included in this PR. Docs in scope are all *.md files
    located either in the repository root, or in the docs/ directory.
  • Either no code has been touched, or, code-level documentation for touched
    code is included in this PR.
  • Either no API changes are included in this PR, or, the API changes are
    reflected in firecracker/swagger.yaml.
  • Either the changes in this PR have no user impact, or, the changes in
    this PR have user impact and have been added to the CHANGELOG.md file.
  • Either no new unsafe code has been added, or, the newly added unsafe
    code is unavoidable and properly documented.

Kazuyoshi Kato added 2 commits January 24, 2020 13:09
The response from this function has content-type:application/json and
Swagger specifies that the JSON object must have "fault_message".

However the implementation was returning a plan string such as
"vCPUs resume failed." which broke clients.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
When "PUT /logger" returns an error, the error message must be wrapped as
a JSON object.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
@andreeaflorescu andreeaflorescu added the Status: Awaiting review Indicates that a pull request is ready to be reviewed label Jan 27, 2020
@dianpopa dianpopa merged commit 9e68aa4 into firecracker-microvm:master Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: Awaiting review Indicates that a pull request is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants