Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid early exit condition #42

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions firecracker-pilot/guestvm-tools/sci/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
8 changes: 5 additions & 3 deletions firecracker-pilot/src/firecracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)?;
Expand Down Expand Up @@ -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
Expand Down
Loading