diff --git a/illumos-utils/src/lib.rs b/illumos-utils/src/lib.rs index 4f5f8d5450..1d585ee786 100644 --- a/illumos-utils/src/lib.rs +++ b/illumos-utils/src/lib.rs @@ -53,8 +53,8 @@ pub enum ExecutionError { #[error("{0}")] CommandFailure(Box), - #[error("Failed to enter zone: {err}")] - ZoneEnter { err: std::io::Error }, + #[error("Failed to manipulate process contract: {err}")] + ContractFailure { err: std::io::Error }, #[error("Zone is not running")] NotRunning, diff --git a/illumos-utils/src/running_zone.rs b/illumos-utils/src/running_zone.rs index 4e84658921..dd3ac51ac3 100644 --- a/illumos-utils/src/running_zone.rs +++ b/illumos-utils/src/running_zone.rs @@ -347,7 +347,7 @@ mod zenter { let fd = unsafe { libc::open(path.as_ptr(), libc::O_RDWR) }; if fd < 0 { let err = std::io::Error::last_os_error(); - return Err(crate::ExecutionError::ZoneEnter { err }); + return Err(crate::ExecutionError::ContractFailure { err }); } // Initialize the contract template. @@ -372,7 +372,7 @@ mod zenter { || unsafe { ct_tmpl_activate(fd) } != 0 { let err = std::io::Error::last_os_error(); - return Err(crate::ExecutionError::ZoneEnter { err }); + return Err(crate::ExecutionError::ContractFailure { err }); } Ok(Self { fd }) } @@ -440,6 +440,8 @@ impl RunningZone { })?); let tmpl = std::sync::Arc::clone(&template); let mut command = std::process::Command::new(crate::PFEXEC); + let logger = self.inner.log.clone(); + let zone = self.name().to_string(); command.env_clear(); unsafe { command.pre_exec(move || { @@ -452,7 +454,13 @@ impl RunningZone { if zenter::zone_enter(id) == 0 { Ok(()) } else { - Err(std::io::Error::last_os_error()) + let err = std::io::Error::last_os_error(); + error!( + logger, + "failed to enter zone: {}", &err; + "zone" => &zone, + ); + Err(err) } }); }