Commit Graph

13 Commits

Author SHA1 Message Date
Rob Bradford
6f8bd27cf7 build: Bulk update dependencies
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2022-11-28 16:57:49 +00:00
James O. D. Hunt
cd0208fe0a api-client: Allow response to be captured
Previously, the API response was always written to stdout, but that may
not be appropriate for all clients.

The client can now control this behaviour as the client API returns the
response in the `Result`.

Fixes: #4703.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-09-28 15:23:03 +01:00
James O. D. Hunt
eea9bcea38 api-client: Refactor to removed hard-coded prefix
The existing API client only allows access to "VM" operations, so added
a new `simple_api_full_command_with_fds()` that allows access to "VMM"
operations too.

Also added a `simple_api_full_command()` to avoid having to specify the
file descriptors, in a similar manner to `simple_api_command()`.

Fixes: #4701.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-09-28 12:30:02 +01:00
Maximilian Nitsch
87c0791d53 api-client: Handle body_offset is None
Handle the case `body_offset` is `None` instead of calling `unwrap()`
which leads to a panic.

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2022-07-26 15:39:31 +02:00
Maximilian Nitsch
686e6d5082 api-client: Break the receive loop if the VMM shuts down the socket
Breaks the receive loop of the API client when the VMM shuts down the
socket connection. A shutdown is indicated by the return value 0 of the
`recv()` system call.[^1][^2] This case was not handled before, so the
API client tried infinitely to receive more bytes and did not return.

[^1]: https://linux.die.net/man/2/recv
[^2]: https://doc.rust-lang.org/std/io/trait.Read.html#tymethod.read

Signed-off-by: Maximilian Nitsch <maximilian.nitsch@d3tn.com>
2022-07-25 13:19:37 +01:00
dependabot[bot]
b440cb7d23 build: bump vmm-sys-util from 0.9.0 to 0.10.0
This patch requires the vhost-user-backend crate to be bumped from 0.5.0
to 0.5.1.

Bumps [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) from 0.9.0 to 0.10.0.
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: vmm-sys-util
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2022-07-20 09:40:28 +00:00
Wei Liu
7d7bfb2034 build: migrate to Rust 2021 edition
Rust 2021 edition has a few improvements over the 2018 edition. Migrate
the project to 2021 edition by following recommended migration steps.
Luckily, the code itself doesn't require fixing.

Bump MSRV to 1.56 as it is required by the 2021 edition. Also fix the
clap build dependency to make Cloud Hypervisor build again.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2022-04-11 09:51:12 +01:00
dependabot[bot]
f67b3f79ea build: bump vmm-sys-util from 0.8.0 to 0.9.0
Bumps [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Changelog](https://github.com/rust-vmm/vmm-sys-util/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-vmm/vmm-sys-util/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: vmm-sys-util
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

This needed a bunch of manual updates as well, including vfio-ioctls and
vhost crates. The vhost crate is being patched with the latest version
from rust-vmm because the version 0.1.0 on crates.io doesn't include the
patches we need yet.

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-09-16 14:01:19 +01:00
Rob Bradford
f7f2f25a57 build: Use fixed versions in Cargo.toml files
This doesn't really affect the build as we ship a Cargo.lock with fixed
versions in. However for clarity it makes sense to use fixed versions
throughout and let dependabot update them.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-08-06 12:11:39 +02:00
Sebastien Boeuf
9af2968a7d api_client: Add ability to send file descriptors
Allow the user to send a list of file descriptors along with the HTTP
request.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-07-21 15:34:22 +02:00
Gaelan Steele
7a18e247f4 api_client: use Option::map in get_header
It's more idiomatic Rust, and satisfies nightly clippy.

Signed-off-by: Gaelan Steele <gbs@canishe.com>
2021-03-29 09:55:29 +02:00
Rob Bradford
030d6046b2 api_client: Address Rust 1.51.0 clippy issue (upper_case_acroynms)
--> api_client/src/lib.rs:40:5
   |
40 |     OK,
   |     ^^ help: consider making the acronym lowercase, except the initial letter (notice the capitalization): `Ok`
   |
   = note: `-D clippy::upper-case-acronyms` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-03-26 11:32:09 +00:00
Rob Bradford
8de3bd728c ch-remote, api_client: Split HTTP/API client code into new crate
Split out the HTTP request handling code from ch-remote into a new
crate which can be used in other places where talking to the API server
by HTTP is necessary.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2020-10-23 14:50:36 +02:00