Add support for reading hypervisor console (#344)

* feature(xencall): add hypervisor SYSCTL_readconsole definitions

* feature(hypervisor-dmesg): xencall: add read_console_ring_raw hypercall wrapper

* feature(hypervisor-dmesg): protobuf: add ReadHypervisorConsoleRing RPC

* feature(hypervisor-dmesg): runtime: add read_hypervisor_console wrapper

* feature(hypervisor-dmesg): daemon: add ReadHypervisorConsoleRing rpc implementation

* feature(hypervisor-dmesg): ctl: add host hypervisor-messages command to get hypervisor messages

* feature(hypervisor-dmesg): cli: rename hypervisor-messages command to hv-console

* feature(hypervisor-dmesg): proto: change ReadHypervisorConsoleRing to ReadHypervisorConsole

* feature(hypervisor-dmesg): fix up kratactl protobuf calls
This commit is contained in:
Ariadne Conill
2024-08-19 16:49:02 -07:00
committed by GitHub
parent 2519d76479
commit 2ab2cda937
8 changed files with 118 additions and 2 deletions

View File

@ -297,4 +297,14 @@ impl Runtime {
let context = RuntimeContext::new().await?;
Ok(PowerManagementContext { context })
}
pub async fn read_hypervisor_console(&self, clear: bool) -> Result<Arc<str>> {
let index = 0 as u32;
let (rawbuf, newindex) = self.context
.xen
.call
.read_console_ring_raw(clear, index).await?;
let buf = std::str::from_utf8(&rawbuf[..newindex as usize])?;
Ok(Arc::from(buf))
}
}