Skip to content

Commit b6d5220

Browse files
authored
[illumos-utils] add RunningZone::image_path (#8307)
1 parent 2e3a662 commit b6d5220

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

illumos-utils/src/running_zone.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,11 @@ impl RunningZone {
361361
&self.inner.zonepath.pool
362362
}
363363

364+
/// Returns the zone's image path.
365+
pub fn image_path(&self) -> &Utf8Path {
366+
&self.inner.image_path
367+
}
368+
364369
/// Return the name of a bootstrap VNIC in the zone, if any.
365370
pub fn bootstrap_vnic_name(&self) -> Option<&str> {
366371
self.inner.get_bootstrap_vnic_name()
@@ -900,6 +905,9 @@ pub struct InstalledZone {
900905
// Filesystem path of the zone
901906
zonepath: PathInPool,
902907

908+
// The path to the zone's image source.
909+
image_path: Utf8PathBuf,
910+
903911
// Name of the Zone.
904912
name: String,
905913

@@ -1210,8 +1218,9 @@ impl<'a> ZoneBuilder<'a> {
12101218
let fake_cfg = self.fake_cfg.unwrap();
12111219
let temp_dir = fake_cfg.temp_dir;
12121220
(|| {
1221+
let zone_type = self.zone_type?;
12131222
let full_zone_name = InstalledZone::get_zone_name(
1214-
self.zone_type?,
1223+
zone_type,
12151224
self.unique_name,
12161225
);
12171226
let mut zonepath = self.zone_root_path?;
@@ -1223,6 +1232,7 @@ impl<'a> ZoneBuilder<'a> {
12231232
let iz = InstalledZone {
12241233
log: self.log?,
12251234
zonepath,
1235+
image_path: Utf8PathBuf::from(format!("/fake/image/path/{zone_type}.tar.gz")),
12261236
name: full_zone_name,
12271237
control_vnic,
12281238
bootstrap_vnic: self.bootstrap_vnic,
@@ -1338,6 +1348,7 @@ impl<'a> ZoneBuilder<'a> {
13381348
Ok(InstalledZone {
13391349
log: log.new(o!("zone" => full_zone_name.clone())),
13401350
zonepath: zone_root_path,
1351+
image_path: zone_image_path,
13411352
name: full_zone_name,
13421353
control_vnic,
13431354
bootstrap_vnic,

0 commit comments

Comments
 (0)