|
@@ -150,6 +150,13 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
|
150
|
150
|
root_path = NULL;
|
151
|
151
|
}
|
152
|
152
|
|
|
153
|
+ /* Check that we have something to boot */
|
|
154
|
+ if ( ! ( filename || root_path ) ) {
|
|
155
|
+ rc = -ENOENT_BOOT;
|
|
156
|
+ printf ( "Nothing to boot: %s\n", strerror ( rc ) );
|
|
157
|
+ goto err_no_boot;
|
|
158
|
+ }
|
|
159
|
+
|
153
|
160
|
/* Hook SAN device, if applicable */
|
154
|
161
|
if ( root_path ) {
|
155
|
162
|
drive = san_hook ( root_path, 0 );
|
|
@@ -171,12 +178,19 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
|
171
|
178
|
goto err_san_describe;
|
172
|
179
|
}
|
173
|
180
|
|
174
|
|
- /* Attempt filename or SAN boot as applicable */
|
|
181
|
+ /* Allow a root-path-only boot with skip-san enabled to succeed */
|
|
182
|
+ rc = 0;
|
|
183
|
+
|
|
184
|
+ /* Attempt filename boot if applicable */
|
175
|
185
|
if ( filename ) {
|
176
|
186
|
if ( ( rc = imgdownload ( image, filename,
|
177
|
187
|
register_and_autoexec_image ) ) !=0){
|
178
|
188
|
printf ( "\nCould not chain image: %s\n",
|
179
|
189
|
strerror ( rc ) );
|
|
190
|
+ /* Fall through to (possibly) attempt a SAN boot
|
|
191
|
+ * as a fallback. If no SAN boot is attempted,
|
|
192
|
+ * our status will become the return status.
|
|
193
|
+ */
|
180
|
194
|
} else {
|
181
|
195
|
/* Always print an extra newline, because we
|
182
|
196
|
* don't know where the NBP may have left the
|
|
@@ -184,7 +198,10 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
|
184
|
198
|
*/
|
185
|
199
|
printf ( "\n" );
|
186
|
200
|
}
|
187
|
|
- } else if ( root_path ) {
|
|
201
|
+ }
|
|
202
|
+
|
|
203
|
+ /* Attempt SAN boot if applicable */
|
|
204
|
+ if ( root_path ) {
|
188
|
205
|
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) == 0 ) {
|
189
|
206
|
printf ( "Booting from SAN device %#02x\n", drive );
|
190
|
207
|
rc = san_boot ( drive );
|
|
@@ -193,11 +210,10 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
|
193
|
210
|
} else {
|
194
|
211
|
printf ( "Skipping boot from SAN device %#02x\n",
|
195
|
212
|
drive );
|
196
|
|
- rc = 0;
|
|
213
|
+ /* Avoid overwriting a possible failure status
|
|
214
|
+ * from a filename boot.
|
|
215
|
+ */
|
197
|
216
|
}
|
198
|
|
- } else {
|
199
|
|
- rc = -ENOENT_BOOT;
|
200
|
|
- printf ( "Nothing to boot: %s\n", strerror ( rc ) );
|
201
|
217
|
}
|
202
|
218
|
|
203
|
219
|
err_san_describe:
|
|
@@ -212,6 +228,7 @@ int uriboot ( struct uri *filename, struct uri *root_path ) {
|
212
|
228
|
}
|
213
|
229
|
}
|
214
|
230
|
err_san_hook:
|
|
231
|
+ err_no_boot:
|
215
|
232
|
image_put ( image );
|
216
|
233
|
err_alloc_image:
|
217
|
234
|
return rc;
|