@@ -11,7 +11,6 @@ use illumos_utils::zpool::ZpoolName;
11
11
use nexus_sled_agent_shared:: inventory:: OmicronZoneImageSource ;
12
12
use sled_storage:: dataset:: INSTALL_DATASET ;
13
13
use sled_storage:: dataset:: M2_ARTIFACT_DATASET ;
14
- use sled_storage:: resources:: AllDisks ;
15
14
use slog:: o;
16
15
use std:: sync:: Arc ;
17
16
use std:: sync:: Mutex ;
@@ -76,10 +75,11 @@ impl ZoneImageSourceResolver {
76
75
pub fn file_source_for (
77
76
& self ,
78
77
image_source : & OmicronZoneImageSource ,
79
- all_disks : & AllDisks ,
78
+ zpools : & ZoneImageZpools < ' _ > ,
79
+ boot_zpool : Option < & ZpoolName > ,
80
80
) -> ZoneImageFileSource {
81
81
let inner = self . inner . lock ( ) . unwrap ( ) ;
82
- inner. file_source_for ( image_source, all_disks )
82
+ inner. file_source_for ( image_source, zpools , boot_zpool )
83
83
}
84
84
}
85
85
@@ -130,7 +130,8 @@ impl ResolverInner {
130
130
fn file_source_for (
131
131
& self ,
132
132
image_source : & OmicronZoneImageSource ,
133
- all_disks : & AllDisks ,
133
+ zpools : & ZoneImageZpools < ' _ > ,
134
+ boot_zpool : Option < & ZpoolName > ,
134
135
) -> ZoneImageFileSource {
135
136
let file_name = match image_source {
136
137
OmicronZoneImageSource :: InstallDataset => {
@@ -151,32 +152,30 @@ impl ResolverInner {
151
152
} ;
152
153
153
154
// If the boot disk exists, look for the image in the "install"
154
- // dataset there too .
155
- if let Some ( ( _ , boot_zpool) ) = all_disks . boot_disk ( ) {
156
- zone_image_paths. push ( boot_zpool . dataset_mountpoint (
157
- & all_disks . mount_config ( ) . root ,
158
- INSTALL_DATASET ,
159
- ) ) ;
155
+ // dataset on the boot zpool .
156
+ if let Some ( boot_zpool) = boot_zpool {
157
+ zone_image_paths. push (
158
+ boot_zpool
159
+ . dataset_mountpoint ( zpools . root , INSTALL_DATASET ) ,
160
+ ) ;
160
161
}
161
162
162
163
zone_image_paths
163
164
}
164
165
OmicronZoneImageSource :: Artifact { .. } => {
165
166
// Search both artifact datasets, but look on the boot disk first.
166
- let boot_zpool =
167
- all_disks. boot_disk ( ) . map ( |( _, boot_zpool) | boot_zpool) ;
168
167
// This iterator starts with the zpool for the boot disk (if it
169
168
// exists), and then is followed by all other zpools.
170
169
let zpool_iter = boot_zpool. into_iter ( ) . chain (
171
- all_disks
172
- . all_m2_zpools ( )
173
- . into_iter ( )
170
+ zpools
171
+ . all_m2_zpools
172
+ . iter ( )
174
173
. filter ( |zpool| Some ( zpool) != boot_zpool. as_ref ( ) ) ,
175
174
) ;
176
175
zpool_iter
177
176
. map ( |zpool| {
178
177
zpool. dataset_mountpoint (
179
- & all_disks . mount_config ( ) . root ,
178
+ zpools . root ,
180
179
M2_ARTIFACT_DATASET ,
181
180
)
182
181
} )
0 commit comments