Philipp Schuster
6ea132708c
vmm: use Error trait directly with Note for compiler bug
...
While working on this, I found a subtle but severe compiler bug [0].
To fight the bug with explicitness rather than implicitness (to
prevent weird stuff in the future), this change is beneficial.
The bug is at least in Rust stable 1.34..1.87.
[0]: https://github.com/rust-lang/rust/issues/141673
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
060c9de07f
vmm: introduce nice error messages on exit (CHV and ch-remote)
...
With the foundations of each error type implementing std::error::Error,
we can now nicely walk the `.source()` chain and print an error trace.
This commit introduces improved user-facing error printing when:
- Cloud Hypervisor fails with an error
- ch-remote fails (client error)
- ch-remote fails (remote error)
The additional context is a clear improvement in UX for both users and
developers. In the following example, the new behaviour is shown for
a direct invocation of Cloud Hypervisor leading to a failure. This
looks similar for ch-remote.
```
Old Style
`target/release/cloud-hypervisor --api-socket /tmp/chv2.sock --kernel /etc/bootitems/linux/kernel_minimal/stable.bzImage --cmdline console=ttyS0 --serial tty --console off --disk path=img.raw --initramfs /etc/bootitems/linux/initrd_minimal/default`
Error booting VM: VmBoot(LockingError(BlockError(LockDiskImage(AlreadyLocked)))
```
```
`target/release/cloud-hypervisor --api-socket /tmp/chv2.sock --kernel /etc/bootitems/linux/kernel_minimal/stable.bzImage --cmdline console=ttyS0 --serial tty --console off --disk path=img.raw --initramfs
/etc/bootitems/linux/initrd_minimal/default`
Error: Cloud Hypervisor exited with the following chain of errors:
0: Error booting VM
1: The VM could not boot
2: Error locking disk images: Another instance likely holds a lock
3: Cannot lock images of all block devices
4: Failed to get Write lock for disk image: ./img.raw
5: The file is already locked
Debug Info: VmBoot(VmBoot(LockingError(DiskLockError(LockDiskImage { error: AlreadyLocked, lock_type: Write, path: "./raw_disk.bin" })))
```
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
1433763d40
misc: virtio-devices: manual adjustment of special case
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
30ee2c129d
misc: vm-migration: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
9bf15ed280
misc: vhost_user_net: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
ed63b352d1
misc: vhost_user_block: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
8e2973fe7c
misc: virtio-devices: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
3541cebbf1
misc: tpm: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
1ede418dcc
misc: test_infra: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
1b03e59152
misc: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
8f56de713b
misc: rate_limiter: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
2100d8c30f
misc: performance-metrics: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
a3692144f0
misc: pci: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
192b19c060
misc: option_parser: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
67896333e3
misc: net_util: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
72c8178335
misc: hypervisor: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
1b91aa8ef3
misc: devices: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
5711f31995
misc: ch-remote: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
aebbd1aecd
misc: block: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
06a868cb85
misc: arch: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
3f3489e38e
misc: api_client: streamline error Display::fmt()
...
The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
d7edd9d51f
misc: vmm: streamline error Display::fmt()
...
The changes were mostly automatically applied using the following
Python script:
```python
import os, re
for root, _, files in os.walk("."):
for f in files:
if not f.endswith(".rs"):
continue
p = os.path.join(root, f)
with open(p, "r", encoding="utf-8") as file:
lines = file.readlines()
changed = False
for i in range(len(lines) - 1):
if re.search(r'#\[error\(".*: \{0[^}]*\}"\)\]', lines[i]) and "#[source]" in lines[i + 1].strip():
lines[i] = re.sub(r': \{0[^}]*\}"\)\]', '")]', lines[i])
changed = True
if changed:
with open(p, "w", encoding="utf-8") as file:
file.writelines(lines)
print("Fixed:", p)
```
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
# Conflicts:
# vmm/src/api/http/mod.rs
2025-06-13 19:55:54 +00:00
Philipp Schuster
4987d63b6a
vmm: fix typo
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:55:54 +00:00
Philipp Schuster
53e9c94e68
tests: cleanup test_util module
...
We can remove the `tests` module as the entire file is only
available when running tests.
Follow-up of #7130 / 1f13165fae .
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-13 19:02:39 +00:00
dependabot[bot]
9d8bda20e5
build: Bump object from 0.36.5 to 0.36.7
...
Bumps [object](https://github.com/gimli-rs/object ) from 0.36.5 to 0.36.7.
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md )
- [Commits](https://github.com/gimli-rs/object/compare/0.36.5...0.36.7 )
---
updated-dependencies:
- dependency-name: object
dependency-version: 0.36.7
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-13 00:25:40 +00:00
dependabot[bot]
63d7f562e5
build: Bump houseabsolute/actions-rust-cross from 0 to 1
...
Bumps [houseabsolute/actions-rust-cross](https://github.com/houseabsolute/actions-rust-cross ) from 0 to 1.
- [Release notes](https://github.com/houseabsolute/actions-rust-cross/releases )
- [Changelog](https://github.com/houseabsolute/actions-rust-cross/blob/v1/Changes.md )
- [Commits](https://github.com/houseabsolute/actions-rust-cross/compare/v0...v1 )
---
updated-dependencies:
- dependency-name: houseabsolute/actions-rust-cross
dependency-version: '1'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-13 00:09:49 +00:00
Philipp Schuster
9bd9c0cb71
misc: replace manual From<T> for *Error with #[from]
...
This is a small simplification we can use since we use `thiserror`
anyway. Note that `#[from]` implies `#[source]` [0].
[0]: https://docs.rs/thiserror/2.0.12/thiserror/index.html
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-12 15:55:54 +00:00
Philipp Schuster
d594107c0d
ch-remote: sort all commands and args alphabetically
...
Having them sorted alphabetically makes more sense since there are
already many, and the list is growing. This improves the UX for users
and developers.
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-12 13:53:55 +00:00
Philipp Schuster
1f13165fae
tests: prepare common test infrastructure for CLI args
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-12 13:53:55 +00:00
Philipp Schuster
12493db144
ch-remote: move Args and Commands creation to function
...
This enables to sort them alphabetically in a next step, similar
to #6988 / c37c639f3f .
[0] https://github.com/cloud-hypervisor/cloud-hypervisor/pull/6988
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-12 13:53:55 +00:00
Jinrong Liang
f151fdb16f
vmm: config: Add tests for check block serial length
...
Signed-off-by: Jinrong Liang <cloudliang@tencent.com >
2025-06-12 13:51:52 +00:00
Jinrong Liang
bb6ca56fb0
vmm: config: Add DiskConfig check for device serial length
...
Signed-off-by: Jinrong Liang <cloudliang@tencent.com >
2025-06-12 13:51:52 +00:00
dependabot[bot]
a336533389
build: Bump actions/setup-python from 1 to 5
...
Bumps [actions/setup-python](https://github.com/actions/setup-python ) from 1 to 5.
- [Release notes](https://github.com/actions/setup-python/releases )
- [Commits](https://github.com/actions/setup-python/compare/v1...v5 )
---
updated-dependencies:
- dependency-name: actions/setup-python
dependency-version: '5'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-12 00:17:53 +00:00
dependabot[bot]
c4b6ed1077
build: Bump getrandom from 0.3.1 to 0.3.3
...
Bumps [getrandom](https://github.com/rust-random/getrandom ) from 0.3.1 to 0.3.3.
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md )
- [Commits](https://github.com/rust-random/getrandom/compare/v0.3.1...v0.3.3 )
---
updated-dependencies:
- dependency-name: getrandom
dependency-version: 0.3.3
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-12 00:01:56 +00:00
dependabot[bot]
3e8dda4e7d
build: Bump softprops/action-gh-release from 1 to 2
...
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release ) from 1 to 2.
- [Release notes](https://github.com/softprops/action-gh-release/releases )
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md )
- [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2 )
---
updated-dependencies:
- dependency-name: softprops/action-gh-release
dependency-version: '2'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-11 00:57:58 +00:00
dependabot[bot]
e9edb2e51c
build: Bump adler2 from 2.0.0 to 2.0.1
...
Bumps [adler2](https://github.com/oyvindln/adler2 ) from 2.0.0 to 2.0.1.
- [Changelog](https://github.com/oyvindln/adler2/blob/main/CHANGELOG.md )
- [Commits](https://github.com/oyvindln/adler2/commits )
---
updated-dependencies:
- dependency-name: adler2
dependency-version: 2.0.1
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-10 23:48:15 +00:00
dependabot[bot]
0798effcc6
build: Bump async-io from 2.3.3 to 2.4.1
...
Bumps [async-io](https://github.com/smol-rs/async-io ) from 2.3.3 to 2.4.1.
- [Release notes](https://github.com/smol-rs/async-io/releases )
- [Changelog](https://github.com/smol-rs/async-io/blob/master/CHANGELOG.md )
- [Commits](https://github.com/smol-rs/async-io/compare/v2.3.3...v2.4.1 )
---
updated-dependencies:
- dependency-name: async-io
dependency-version: 2.4.1
dependency-type: indirect
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-10 17:42:39 +00:00
dependabot[bot]
6079791bca
build: Bump fsfe/reuse-action from 3 to 5
...
Bumps [fsfe/reuse-action](https://github.com/fsfe/reuse-action ) from 3 to 5.
- [Release notes](https://github.com/fsfe/reuse-action/releases )
- [Commits](https://github.com/fsfe/reuse-action/compare/v3...v5 )
---
updated-dependencies:
- dependency-name: fsfe/reuse-action
dependency-version: '5'
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-10 17:26:50 +00:00
Philipp Schuster
ff2330defe
ci: activate dependabot for github-actions
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-10 15:52:12 +00:00
Philipp Schuster
12b72ba3c1
ci: bump typos
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-06-10 15:52:12 +00:00
dependabot[bot]
92f9e20f57
build: Bump itoa from 1.0.11 to 1.0.15
...
Bumps [itoa](https://github.com/dtolnay/itoa ) from 1.0.11 to 1.0.15.
- [Release notes](https://github.com/dtolnay/itoa/releases )
- [Commits](https://github.com/dtolnay/itoa/compare/1.0.11...1.0.15 )
---
updated-dependencies:
- dependency-name: itoa
dependency-version: 1.0.15
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-06-10 00:38:46 +00:00
Gauthier Jolly
3d78662498
block: virtio-blk: report IO errors to the guest
...
Instead of exiting on IO errors, report the errors to the guest with
VIRTIO_BLK_S_IOERR. For example, the guest kernel will log something
similar to this if the nbd behind /dev/vdc is unexpectedly disconnected:
[ 166.033957] I/O error, dev vdc, sector 264 op 0x1:(WRITE) flags 0x9800 phys_seg 1 prio class 2
[ 166.035083] Aborting journal on device vdc-8.
[ 166.037307] Buffer I/O error on dev vdc, logical block 9, lost sync page write
[ 166.038471] JBD2: I/O error when updating journal superblock for vdc-8.
[...]
[ 174.234470] EXT4-fs (vdc): I/O error while writing superblock
In case the rootfs is not located on the affected block device, this
will not crash the guest.
Fixes : #6995
Signed-off-by: Gauthier Jolly <contact@gjolly.fr >
2025-06-09 16:48:07 +00:00
Jinank Jain
2bc8d51a60
misc: Fix missing lifetime syntax clippy warning
...
This was caught by the nightly compiler during cargo fuzz build.
error: lifetime flowing from input to output with different syntax can be confusing
--> /home/runner/work/cloud-hypervisor/cloud-hypervisor/hypervisor/src/arch/x86/emulator/mod.rs:493:26
|
493 | pub fn new(platform: &mut dyn PlatformEmulator<CpuState = T>) -> Emulator<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ----------- the lifetime gets resolved as `'_`
| |
| this lifetime flows to the output
|
= note: `-D mismatched-lifetime-syntaxes` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(mismatched_lifetime_syntaxes)]`
help: one option is to remove the lifetime for references and use the anonymous lifetime for paths
|
493 | pub fn new(platform: &mut dyn PlatformEmulator<CpuState = T>) -> Emulator<'_, T> {
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2025-06-09 11:19:11 +00:00
Jinank Jain
51002f2bae
build: Bump zbus from 4.4.0 to 5.7.1
...
Along with this also fix some API incompatibilities issues.
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2025-06-09 11:19:11 +00:00
Nuno Das Neves
59e11f1b0b
hypervisor: mshv: fix advance_rip_update_rax() helper
...
The dirty bit for the GP registers must be set for the hypervisor to
update them.
Signed-off-by: Nuno Das Neves <nunodasneves@linux.microsoft.com >
2025-06-05 20:23:30 +00:00
Jinank Jain
fc01e4cbec
fuzz: Update Cargo.lock for fuzz build
...
It seems like multiple packages inside Cargo.lock are outdated.
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2025-06-04 17:04:07 +00:00
Jinank Jain
3f8186f627
hypervisor: Fix issues with nightly compilers
...
cargo fuzz build complaints about some un-used function in the
instruction emultator. Silence the warning by allowing dead code
generation.
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2025-06-04 17:04:07 +00:00
Jinank Jain
6f56ef9a36
misc: Move zerocopy to workspace dependencies
...
Since it is used by multiple components at this point, it is better to
move it to workspace level dependency.
Signed-off-by: Jinank Jain <jinankjain@microsoft.com >
2025-06-04 17:04:07 +00:00
Philipp Schuster
d6ed74b5b8
tests: fix vCPU test relying on specific Display formatting
...
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de >
On-behalf-of: SAP philipp.schuster@sap.com
2025-05-30 19:07:15 +00:00
dependabot[bot]
7fbe94a227
build: Bump quote from 1.0.36 to 1.0.40
...
Bumps [quote](https://github.com/dtolnay/quote ) from 1.0.36 to 1.0.40.
- [Release notes](https://github.com/dtolnay/quote/releases )
- [Commits](https://github.com/dtolnay/quote/compare/1.0.36...1.0.40 )
---
updated-dependencies:
- dependency-name: quote
dependency-version: 1.0.40
dependency-type: indirect
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
2025-05-30 00:37:50 +00:00