- Timestamp:
- Jan 26, 2007 2:53:21 PM (18 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r300 r358 1188 1188 { 1189 1189 Bstr loc; 1190 hdd->COMGETTER(Location)(loc.asOutParam()); 1190 hdd->COMGETTER(Location) (loc.asOutParam()); 1191 Bstr errMsg; 1192 hdd->COMGETTER(LastAccessError) (errMsg.asOutParam()); 1191 1193 return setError (E_FAIL, 1192 tr ("VM cannot start because the hard disk '%ls' is not accessible"), 1193 loc.raw()); 1194 tr ("VM cannot start because the hard disk '%ls' is not accessible " 1195 "(%ls)"), 1196 loc.raw(), errMsg.raw()); 1194 1197 } 1195 1198 } … … 1209 1212 Bstr filePath; 1210 1213 dvdImage->COMGETTER(FilePath)(filePath.asOutParam()); 1214 /// @todo (r=dmik) grab the last access error once 1215 // IDVDImage::lastAccessError is there 1211 1216 return setError (E_FAIL, 1212 1217 tr ("VM cannot start because the DVD image '%ls' is not accessible"), … … 1229 1234 Bstr filePath; 1230 1235 floppyImage->COMGETTER(FilePath)(filePath.asOutParam()); 1236 /// @todo (r=dmik) grab the last access error once 1237 // IDVDImage::lastAccessError is there 1231 1238 return setError (E_FAIL, 1232 1239 tr ("VM cannot start because the floppy image '%ls' is not accessible"), -
trunk/src/VBox/Main/HardDiskImpl.cpp
r351 r358 1265 1265 CheckComRCBreakRC (rc); 1266 1266 1267 Assert (mId.isEmpty()); 1268 1267 1269 if (aFilePath && *aFilePath) 1268 1270 { … … 1273 1275 * it is the only way to get the UUID of the existing VDI and 1274 1276 * initialize the vital mId property. */ 1275 rc = queryInformation (NULL); 1277 Bstr errMsg; 1278 rc = queryInformation (&errMsg); 1279 if (SUCCEEDED (rc)) 1280 { 1281 /* We are constructing a new HVirtualDiskImage object. If there 1282 * is a fatal accessibility error (we cannot read image UUID), 1283 * we have to fail. We do so even on non-fatal errors as well, 1284 * because it's not worth to keep going with the inaccessible 1285 * image from the very beginning (when nothing else depends on 1286 * it yet). */ 1287 if (!errMsg.isNull()) 1288 rc = setErrorBstr (E_FAIL, errMsg); 1289 } 1276 1290 } 1277 1291 else … … 1556 1570 { 1557 1571 return queryInformation (&aAccessError); 1558 /* if we fail here, this means something like UUID mismatch.1559 * Do nothing, just return the failure (error info is already1560 * set by queryInformation()), in hope that one of subsequent1561 * attempts to check for acessibility will succeed */1562 1572 } 1563 1573 … … 2204 2214 2205 2215 Utf8Str filePath = mFilePathFull; 2216 Bstr errMsg; 2206 2217 2207 2218 do … … 2213 2224 2214 2225 if (VBOX_FAILURE (vrc)) 2215 {2216 /* mId is empty only when constructing a HVirtualDiskImage object2217 * from an existing file image which UUID is not known. If we can't2218 * read it, we have to fail. */2219 if (mId.isEmpty())2220 rc = setError (E_FAIL,2221 tr ("Could not open the hard disk image '%s' (%Vrc)"),2222 filePath.raw(), vrc);2223 2226 break; 2224 }2225 2227 2226 2228 if (!mId.isEmpty()) … … 2229 2231 if (mId != id) 2230 2232 { 2231 rc = setError (E_FAIL,2233 errMsg = Utf8StrFmt ( 2232 2234 tr ("Actual UUID {%Vuuid} of the hard disk image '%s' doesn't " 2233 2235 "match UUID {%Vuuid} stored in the registry"), … … 2248 2250 if (mParent->id() != parentId) 2249 2251 { 2250 rc = setError (E_FAIL,2252 errMsg = Utf8StrFmt ( 2251 2253 tr ("UUID {%Vuuid} of the parent image '%ls' stored in " 2252 2254 "the hard disk image file '%s' doesn't match " … … 2259 2261 else if (!parentId.isEmpty()) 2260 2262 { 2261 rc = setError (E_FAIL,2263 errMsg = Utf8StrFmt ( 2262 2264 tr ("Hard disk image '%s' is a differencing image and " 2263 2265 "cannot be opened directly"), … … 2308 2310 clearBusy(); 2309 2311 2310 if (VBOX_FAILURE (vrc) || FAILED (rc)) 2311 { 2312 Log (("HVirtualDiskImage::queryInformation(): " 2313 "WARNING: '%ls' is not accessible (%Vrc) (rc=%08X)\n", 2314 mFilePathFull.raw(), vrc, rc)); 2315 2316 if (VBOX_FAILURE (vrc) && aAccessError) 2317 *aAccessError = 2318 Utf8StrFmt ("Error accessing hard disk image '%ls' (%Vrc)", 2319 mFilePathFull.raw(), vrc); 2320 2312 if (FAILED (rc) || VBOX_FAILURE (vrc) || !errMsg.isNull()) 2313 { 2314 LogWarningFunc (("'%ls' is not accessible " 2315 "(rc=%08X, vrc=%Vrc, errMsg='%ls')\n", 2316 mFilePathFull.raw(), rc, vrc, errMsg.raw())); 2317 2318 if (aAccessError) 2319 { 2320 if (!errMsg.isNull()) 2321 *aAccessError = errMsg; 2322 else if (VBOX_FAILURE (vrc)) 2323 *aAccessError = Utf8StrFmt ( 2324 tr ("Could not access hard disk image '%ls' (%Vrc)"), 2325 mFilePathFull.raw(), vrc); 2326 } 2327 2321 2328 /* downgrade to not accessible */ 2322 2329 mState = Created; … … 2537 2544 task->vdi->mState = HVirtualDiskImage::Created; 2538 2545 /* update VDI data fields */ 2539 rc = task->vdi->queryInformation (NULL); 2540 /* complete the progress object */ 2541 task->progress->notifyComplete (rc); 2546 Bstr errMsg; 2547 rc = task->vdi->queryInformation (&errMsg); 2548 /* we want to deliver the access check result to the caller 2549 * immediately, before he calls HardDisk::GetAccssible() himself. */ 2550 if (SUCCEEDED (rc) && !errMsg.isNull()) 2551 task->progress->notifyCompleteBstr ( 2552 E_FAIL, COM_IIDOF (IVirtualDiskImage), getComponentName(), 2553 errMsg); 2554 else 2555 task->progress->notifyComplete (rc); 2542 2556 } 2543 2557 else
Note:
See TracChangeset
for help on using the changeset viewer.