Skip to content

Commit

Permalink
Remove unused zone code
Browse files Browse the repository at this point in the history
  • Loading branch information
smklein committed Jul 1, 2024
1 parent 17db428 commit 32596df
Showing 1 changed file with 0 additions and 143 deletions.
143 changes: 0 additions & 143 deletions illumos-utils/src/running_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,60 +102,6 @@ pub enum EnsureAddressError {
OpteGatewayConfig(#[from] RunCommandError),
}

/// Errors returned from [`RunningZone::get`].
#[derive(thiserror::Error, Debug)]
pub enum GetZoneError {
#[error("While looking up zones with prefix '{prefix}', could not get zones: {err}")]
GetZones {
prefix: String,
#[source]
err: crate::zone::AdmError,
},

#[error("Invalid Utf8 path: {0}")]
FromPathBuf(#[from] camino::FromPathBufError),

#[error("Zone with prefix '{prefix}' not found")]
NotFound { prefix: String },

#[error("Cannot get zone '{name}': it is in the {state:?} state instead of running")]
NotRunning { name: String, state: zone::State },

#[error(
"Cannot get zone '{name}': Failed to acquire control interface {err}"
)]
ControlInterface {
name: String,
#[source]
err: crate::zone::GetControlInterfaceError,
},

#[error("Cannot get zone '{name}': Failed to create addrobj: {err}")]
AddrObject {
name: String,
#[source]
err: crate::addrobj::ParseError,
},

#[error(
"Cannot get zone '{name}': Failed to ensure address exists: {err}"
)]
EnsureAddress {
name: String,
#[source]
err: crate::zone::EnsureAddressError,
},

#[error(
"Cannot get zone '{name}': Incorrect bootstrap interface access {err}"
)]
BootstrapInterface {
name: String,
#[source]
err: crate::zone::GetBootstrapInterfaceError,
},
}

#[cfg(target_os = "illumos")]
static REAPER_THREAD: OnceLock<thread::JoinHandle<()>> = OnceLock::new();

Expand Down Expand Up @@ -803,95 +749,6 @@ impl RunningZone {
Ok(())
}

/// Looks up a running zone based on the `zone_prefix`, if one already exists.
///
/// - If the zone was found, is running, and has a network interface, it is
/// returned.
/// - If the zone was not found `Error::NotFound` is returned.
/// - If the zone was found, but not running, `Error::NotRunning` is
/// returned.
/// - Other errors may be returned attempting to look up and accessing an
/// address on the zone.
// pub async fn get(
// log: &Logger,
// vnic_allocator: &VnicAllocator<Etherstub>,
// zone_prefix: &str,
// addrtype: AddressRequest,
// ) -> Result<Self, GetZoneError> {
// let zone_info = Zones::get()
// .await
// .map_err(|err| GetZoneError::GetZones {
// prefix: zone_prefix.to_string(),
// err,
// })?
// .into_iter()
// .find(|zone_info| zone_info.name().starts_with(&zone_prefix))
// .ok_or_else(|| GetZoneError::NotFound {
// prefix: zone_prefix.to_string(),
// })?;
//
// if zone_info.state() != zone::State::Running {
// return Err(GetZoneError::NotRunning {
// name: zone_info.name().to_string(),
// state: zone_info.state(),
// });
// }
//
// let zone_name = zone_info.name();
// let vnic_name =
// Zones::get_control_interface(zone_name).map_err(|err| {
// GetZoneError::ControlInterface {
// name: zone_name.to_string(),
// err,
// }
// })?;
// let addrobj = AddrObject::new_control(&vnic_name).map_err(|err| {
// GetZoneError::AddrObject { name: zone_name.to_string(), err }
// })?;
// Zones::ensure_address(Some(zone_name), &addrobj, addrtype).map_err(
// |err| GetZoneError::EnsureAddress {
// name: zone_name.to_string(),
// err,
// },
// )?;
//
// let control_vnic = vnic_allocator
// .wrap_existing(vnic_name)
// .expect("Failed to wrap valid control VNIC");
//
// // The bootstrap address for a running zone never changes,
// // so there's no need to call `Zones::ensure_address`.
// // Currently, only the switch zone has a bootstrap interface.
// let bootstrap_vnic = Zones::get_bootstrap_interface(zone_name)
// .map_err(|err| GetZoneError::BootstrapInterface {
// name: zone_name.to_string(),
// err,
// })?
// .map(|name| {
// vnic_allocator
// .wrap_existing(name)
// .expect("Failed to wrap valid bootstrap VNIC")
// });
//
// Ok(Self {
// id: zone_info.id().map(|x| {
// x.try_into().expect("zoneid_t is expected to be an i32")
// }),
// inner: InstalledZone {
// log: log.new(o!("zone" => zone_name.to_string())),
// zonepath: zone_info.path().to_path_buf().try_into()?,
// name: zone_name.to_string(),
// control_vnic,
// // TODO(https://github.com/oxidecomputer/omicron/issues/725)
// //
// // Re-initialize guest_vnic state by inspecting the zone.
// opte_ports: vec![],
// links: vec![],
// bootstrap_vnic,
// },
// })
// }

/// Return references to the OPTE ports for this zone.
pub fn opte_ports(&self) -> impl Iterator<Item = &Port> {
self.inner.opte_ports()
Expand Down

0 comments on commit 32596df

Please sign in to comment.