#
190a11f2 |
| 10-Jun-2025 |
Philipp Schuster <philipp.schuster@cyberus-technology.de> |
ch-remote: also pretty-print remote server errors
Remote server errors are transferred as raw HTTP body. This way, we lose the nested structured error information.
This is an attempt to retrieve th
ch-remote: also pretty-print remote server errors
Remote server errors are transferred as raw HTTP body. This way, we lose the nested structured error information.
This is an attempt to retrieve the errors from the HTTP response and to align the output with the normal error output.
For example, this produces the following chain of errors. Note that everything after level 0 was retrieved from the HTTP server response:
``` Error: ch-remote exited with the following chain of errors: 0: http client error 1: Server responded with InternalServerError 2: Error from API 3: The disk could not be added to the VM 4: Failed to validate config 5: Identifier disk1 is not unique
Debug Info: HttpApiClient(ServerResponse(InternalServerError, Some("Error from API<br>The disk could not be added to the VM<br>Failed to validate config<br>Identifier disk1 is not unique"))) ```
In case the JSON can't be parsed properly, ch-remote will print:
``` Error: ch-remote exited with the following chain of errors: 0: http client error X: Can't get remote's error messages from JSON response: EOF while parsing a value at line 1 column 0: body=''
Debug Info: HttpApiClient(ServerResponse(InternalServerError, Some(""))) ```
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de> On-behalf-of: SAP philipp.schuster@sap.com
show more ...
|
#
6ea13270 |
| 28-May-2025 |
Philipp Schuster <philipp.schuster@cyberus-technology.de> |
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
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
show more ...
|
#
060c9de0 |
| 19-May-2025 |
Philipp Schuster <philipp.schuster@cyberus-technology.de> |
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
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
show more ...
|