Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gurinderu committed Jul 30, 2024
1 parent ddcfbf4 commit 56e8faf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions crates/workers/src/workers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

use std::collections::HashMap;
use std::ops::Deref;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;

Expand Down Expand Up @@ -638,7 +638,7 @@ impl Workers {
pub async fn create_vm(
&self,
worker_id: WorkerId,
image: PathBuf,
image: &Path,
) -> Result<String, WorkersError> {
match &self.config.vm {
None => Err(WorkersError::FeatureDisabled),
Expand All @@ -656,7 +656,7 @@ impl Workers {
let file_name = &image
.file_name()
.ok_or_else(|| WorkersError::VMImageNotFile {
image: image.clone(),
image: image.to_path_buf(),
})?;

let vm_name = worker_id.to_string();
Expand All @@ -669,7 +669,10 @@ impl Workers {

tokio::fs::copy(&image, &worker_image)
.await
.map_err(|err| WorkersError::FailedToCopyVMImage { image, err })?;
.map_err(|err| WorkersError::FailedToCopyVMImage {
image: image.to_path_buf(),
err,
})?;

let params = CreateVMDomainParams::new(
vm_name.clone(),
Expand Down
2 changes: 1 addition & 1 deletion particle-builtins/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ where

let vm_name = self
.workers
.create_vm(worker_id, vault_image)
.create_vm(worker_id, vault_image.as_path())
.await
.map_err(|err| JError::new(format!("Failed to create vm: {err}")))?;

Expand Down

0 comments on commit 56e8faf

Please sign in to comment.