File tree 1 file changed +10
-1
lines changed
bin/propolis-standalone/src 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,9 @@ pub fn block_backend(
136
136
log : & slog:: Logger ,
137
137
) -> ( Arc < dyn block:: Backend > , String ) {
138
138
let backend_name = dev. options . get ( "block_dev" ) . unwrap ( ) . as_str ( ) . unwrap ( ) ;
139
- let be = config. block_devs . get ( backend_name) . unwrap ( ) ;
139
+ let Some ( be) = config. block_devs . get ( backend_name) else {
140
+ panic ! ( "No configured block device named \" {}\" " , backend_name) ;
141
+ } ;
140
142
let opts = block:: BackendOpts {
141
143
block_size : be. block_opts . block_size ,
142
144
read_only : be. block_opts . read_only ,
@@ -149,7 +151,14 @@ pub fn block_backend(
149
151
150
152
// Check if raw device is being used and gripe if it isn't
151
153
let meta = std:: fs:: metadata ( & parsed. path )
154
+ . with_context ( || {
155
+ format ! (
156
+ "opening {} for block device \" {}\" " ,
157
+ parsed. path, backend_name
158
+ )
159
+ } )
152
160
. expect ( "file device path is valid" ) ;
161
+
153
162
if meta. file_type ( ) . is_block_device ( ) {
154
163
slog:: warn!( log, "Block backend using standard device rather than raw" ;
155
164
"path" => & parsed. path) ;
You can’t perform that action at this time.
0 commit comments