Changeset 43689 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Oct 19, 2012 10:54:01 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 81517
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/SnapshotImpl.cpp
r43677 r43689 2484 2484 } 2485 2485 2486 {/* issue 4386*/2486 {/* see @bugref{4386} */ 2487 2487 /*check available place on the storage*/ 2488 RTFOFF pcbTotal =0;2489 RTFOFF pcbFree =0;2490 uint32_t pcbBlock =0;2491 uint32_t pcbSector =0;2488 RTFOFF pcbTotal = 0; 2489 RTFOFF pcbFree = 0; 2490 uint32_t pcbBlock = 0; 2491 uint32_t pcbSector = 0; 2492 2492 std::multimap<uint32_t,uint64_t> neededStorageFreeSpace; 2493 2493 std::map<uint32_t,const char*> serialMapToStoragePath; … … 2495 2495 MediumDeleteRecList::const_iterator it_md = toDelete.begin(); 2496 2496 2497 while (it_md!=toDelete.end())2497 while (it_md != toDelete.end()) 2498 2498 { 2499 uint64_t diskSize =0;2500 uint32_t pu32Serial =0;2499 uint64_t diskSize = 0; 2500 uint32_t pu32Serial = 0; 2501 2501 ComObjPtr<Medium> pSource_local = it_md->mpSource; 2502 2502 ComObjPtr<Medium> pTarget_local = it_md->mpTarget; 2503 2503 2504 rc = RTFsQuerySerial(pTarget_local->getLocationFull().c_str(), &pu32Serial); 2505 if (FAILED(rc)) 2506 throw rc; 2507 2508 /* 0xc0ffee - some magic number from the file fs-stubs-generic.cpp. Case of using stub */ 2509 if(pu32Serial==0xc0ffee) 2504 int vrc = RTFsQuerySerial(pTarget_local->getLocationFull().c_str(), &pu32Serial); 2505 if (RT_FAILURE(vrc)) 2510 2506 { 2511 LogFlowThisFunc(("Can't find storage UID, function isn't implemented...\n")); 2512 rc = setError(VERR_NOT_IMPLEMENTED, 2513 tr(" Impossible merging with '%s'. Can't find storage UID, function isn't implemented."), 2507 rc = setError(E_FAIL, 2508 tr(" Impossible merging with '%s'. Can't get storage UID."), 2514 2509 pTarget_local->getLocationFull().c_str()); 2515 2510 throw rc; … … 2525 2520 } 2526 2521 2527 while (!neededStorageFreeSpace.empty())2522 while (!neededStorageFreeSpace.empty()) 2528 2523 { 2529 2524 std::pair<std::multimap<uint32_t,uint64_t>::iterator,std::multimap<uint32_t,uint64_t>::iterator> ret; … … 2534 2529 std::multimap<uint32_t,uint64_t>::const_iterator it_ns = ret.first; 2535 2530 2536 for (;it_ns!=ret.second;++it_ns)2531 for (; it_ns != ret.second ; ++it_ns) 2537 2532 { 2538 commonSourceStoragesSize +=it_ns->second;2533 commonSourceStoragesSize += it_ns->second; 2539 2534 } 2540 2535 2541 2536 /* find appropriate path by storage UID*/ 2542 std::map<uint32_t,const char*>::const_iterator it_sm = serialMapToStoragePath.find(it_ns->first); 2543 /* get info about storage */ 2544 rc = RTFsQuerySizes(it_sm->second, &pcbTotal, &pcbFree,&pcbBlock, &pcbSector); 2545 if (FAILED(rc)) 2537 std::map<uint32_t,const char*>::const_iterator it_sm = serialMapToStoragePath.find(ret.first->first); 2538 /* get info about a storage */ 2539 if (it_sm == serialMapToStoragePath.end()) 2540 { 2541 LogFlowThisFunc(("Path to the storage wasn't found...\n")); 2542 2543 rc = setError(E_INVALIDARG, 2544 tr(" Impossible merging with '%s'. Path to the storage wasn't found."), 2545 it_sm->second); 2546 2546 throw rc; 2547 2548 if(commonSourceStoragesSize > (uint64_t)pcbFree) 2547 } 2548 2549 int vrc = RTFsQuerySizes(it_sm->second, &pcbTotal, &pcbFree,&pcbBlock, &pcbSector); 2550 if (RT_FAILURE(vrc)) 2549 2551 { 2550 LogFlowThisFunc(("Free space on the target disk less than needed for merging ...\n")); 2551 //what is more suitable? 2552 //VERR_NO_TMP_MEMORY, VERR_NO_PHYS_MEMORY, VERR_FILE_AIO_INSUFFICIENT_RESSOURCES, VERR_FILE_AIO_LIMIT_EXCE 2553 rc = setError(VERR_FILE_AIO_INSUFFICIENT_RESSOURCES, 2554 tr(" Impossible merging with '%s'. Free space on the target disk less than needed for merging"), 2552 rc = setError(E_FAIL, 2553 tr(" Impossible merging with '%s'. Can't get the storage size."), 2554 it_sm->second); 2555 throw rc; 2556 } 2557 2558 if (commonSourceStoragesSize > (uint64_t)pcbFree) 2559 { 2560 LogFlowThisFunc(("There isn't enough space than it is needed for merging...\n")); 2561 2562 rc = setError(E_OUTOFMEMORY, 2563 tr(" Impossible merging with '%s'. " 2564 "There isn't enough space than it is needed for merging"), 2555 2565 it_sm->second); 2556 2566 throw rc; … … 2788 2798 } 2789 2799 } 2790 catch (HRESULT aRC) { rc = aRC; } 2800 catch (HRESULT aRC) { 2801 rc = aRC; 2802 } 2791 2803 2792 2804 if (FAILED(rc))
Note:
See TracChangeset
for help on using the changeset viewer.