From 26ce54f63eade762dee2bb062560e97e003c9a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Tue, 9 Apr 2024 12:35:08 +0200 Subject: [PATCH] Fix invalid early exit condition --- common/src/error.rs | 4 ++-- firecracker-pilot/guestvm-tools/sci/src/defaults.rs | 4 ++-- firecracker-pilot/src/firecracker.rs | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/common/src/error.rs b/common/src/error.rs index 8563505..a31bef2 100644 --- a/common/src/error.rs +++ b/common/src/error.rs @@ -52,7 +52,7 @@ pub enum FlakeError { #[error("Instance in use by another instance, consider @NAME argument")] AlreadyRunning, - #[error("Datasync failed, for details rerun with PILOT_DEBUG=1")] + #[error("Datasync failed, for details recall with PILOT_DEBUG=1")] SyncFailed, /// OperationError pass through @@ -62,7 +62,7 @@ pub enum FlakeError { #[derive(Debug, Error)] pub enum OperationError { - #[error("Max retries for VM connection check exceeded")] + #[error("Max retries exceeded, for details recall with PILOT_DEBUG=1")] MaxTriesExceeded } diff --git a/firecracker-pilot/guestvm-tools/sci/src/defaults.rs b/firecracker-pilot/guestvm-tools/sci/src/defaults.rs index 6964271..c90e665 100644 --- a/firecracker-pilot/guestvm-tools/sci/src/defaults.rs +++ b/firecracker-pilot/guestvm-tools/sci/src/defaults.rs @@ -36,9 +36,9 @@ pub const VHOST_TRANSPORT: &str = "vmw_vsock_virtio_transport"; pub const VM_PORT: u32 = 52; pub const GUEST_CID: u32 = 3; pub const RETRIES: u32 = - 5; + 60; pub const VM_WAIT_TIMEOUT_MSEC: u64 = - 100; + 1000; pub fn debug(message: &str) { if env::var("PILOT_DEBUG").is_ok() { diff --git a/firecracker-pilot/src/firecracker.rs b/firecracker-pilot/src/firecracker.rs index 0b5e66a..1a0fca2 100644 --- a/firecracker-pilot/src/firecracker.rs +++ b/firecracker-pilot/src/firecracker.rs @@ -188,7 +188,7 @@ pub fn create(program_name: &String) -> Result<(String, String), FlakeError> { // get flake config sections let RuntimeSection { - runas, resume, force_vsock, firecracker: engine_section, .. + runas, resume, firecracker: engine_section, .. } = config().runtime(); let user = User::from(runas); @@ -204,7 +204,7 @@ pub fn create(program_name: &String) -> Result<(String, String), FlakeError> { // Check early return condition if Path::new(&vm_id_file_path).exists() && gc_meta_files( &vm_id_file_path, user, program_name, resume - )? && (resume || force_vsock) { + )? && resume { // VM exists // report ID value and its ID file name let vmid = fs::read_to_string(&vm_id_file_path)?; @@ -535,7 +535,9 @@ pub fn execute_command_at_instance( if Lookup::is_debug() { debug!("Max retries for UDS socket lookup exceeded"); } - Err(OperationError::MaxTriesExceeded)? + return Err( + FlakeError::OperationError(OperationError::MaxTriesExceeded) + ) } if Path::new(&vsock_uds_path).exists() { break