xenstore: watch support (#4)

This commit is contained in:
Alex Zenla
2024-03-07 04:14:25 -08:00
committed by GitHub
parent 670e140682
commit 182401371b
13 changed files with 526 additions and 199 deletions

View File

@ -2,11 +2,11 @@ use std::io;
#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("io issue encountered")]
#[error("io issue encountered: {0}")]
Io(#[from] io::Error),
#[error("xenstore issue encountered")]
#[error("xenstore issue encountered: {0}")]
XenStore(#[from] xenstore::error::Error),
#[error("xencall issue encountered")]
#[error("xencall issue encountered: {0}")]
XenCall(#[from] xencall::error::Error),
#[error("domain does not have a tty")]
TtyNotFound,
@ -18,7 +18,7 @@ pub enum Error {
PathParentNotFound,
#[error("domain does not exist")]
DomainNonExistent,
#[error("elf parse failed")]
#[error("elf parse failed: {0}")]
ElfParseFailed(#[from] elf::ParseError),
#[error("mmap failed")]
MmapFailed,

View File

@ -145,7 +145,7 @@ impl XenClient {
}];
{
let mut tx = self.store.transaction().await?;
let tx = self.store.transaction().await?;
tx.rm(dom_path.as_str()).await?;
tx.mknod(dom_path.as_str(), ro_perm).await?;
@ -250,7 +250,7 @@ impl XenClient {
}
{
let mut tx = self.store.transaction().await?;
let tx = self.store.transaction().await?;
tx.write_string(format!("{}/image/os_type", vm_path).as_str(), "linux")
.await?;
tx.write_string(
@ -641,7 +641,7 @@ impl XenClient {
},
];
let mut tx = self.store.transaction().await?;
let tx = self.store.transaction().await?;
tx.mknod(&frontend_path, frontend_perms).await?;
for (p, value) in &frontend_items {
let path = format!("{}/{}", frontend_path, *p);
@ -706,7 +706,7 @@ impl XenClient {
for backend in &backend_paths {
let state_path = format!("{}/state", backend);
let online_path = format!("{}/online", backend);
let mut tx = self.store.transaction().await?;
let tx = self.store.transaction().await?;
let state = tx.read_string(&state_path).await?.unwrap_or(String::new());
if state.is_empty() {
break;
@ -735,7 +735,7 @@ impl XenClient {
}
}
let mut tx = self.store.transaction().await?;
let tx = self.store.transaction().await?;
let mut backend_removals: Vec<String> = Vec::new();
backend_removals.extend_from_slice(backend_paths.as_slice());
if let Some(backend) = console_backend_path {