File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
bin/propolis-standalone/src Expand file tree Collapse file tree 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(
136136 log : & slog:: Logger ,
137137) -> ( Arc < dyn block:: Backend > , String ) {
138138 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+ } ;
140142 let opts = block:: BackendOpts {
141143 block_size : be. block_opts . block_size ,
142144 read_only : be. block_opts . read_only ,
@@ -149,7 +151,14 @@ pub fn block_backend(
149151
150152 // Check if raw device is being used and gripe if it isn't
151153 let meta = std:: fs:: metadata ( & parsed. path )
154+ . with_context ( || {
155+ format ! (
156+ "opening {} for block device \" {}\" " ,
157+ parsed. path, backend_name
158+ )
159+ } )
152160 . expect ( "file device path is valid" ) ;
161+
153162 if meta. file_type ( ) . is_block_device ( ) {
154163 slog:: warn!( log, "Block backend using standard device rather than raw" ;
155164 "path" => & parsed. path) ;
You can’t perform that action at this time.
0 commit comments