mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-04 07:39:39 +00:00 
			
		
		
		
	xenstore: watch support (#4)
This commit is contained in:
		@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user