Changeset 28150 in vbox for trunk/src/VBox/Main
- Timestamp:
- Apr 9, 2010 3:58:10 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImplExport.cpp
r28149 r28150 318 318 strLocation = bstrLocation; 319 319 320 Bstr bstrName; 321 rc = pMedium->COMGETTER(Name)(bstrName.asOutParam()); 322 if (FAILED(rc)) throw rc; 323 324 strTargetVmdkName = bstrName; 325 strTargetVmdkName.stripExt(); 326 strTargetVmdkName.append(".vmdk"); 327 328 // we need the size of the image so we can give it to addEntry(); 329 // later, on export, the progress weight will be based on this. 330 // pMedium can be a differencing image though; in that case, we 331 // need to use the size of the base instead. 320 // find the source's base medium for two things: 321 // 1) we'll use its name to determine the name of the target disk, which is readable, 322 // as opposed to the UUID filename of a differencing image, if pMedium is one 323 // 2) we need the size of the base image so we can give it to addEntry(), and later 324 // on export, the progress will be based on that (and not the diff image) 332 325 ComPtr<IMedium> pBaseMedium; 333 326 rc = pMedium->COMGETTER(Base)(pBaseMedium.asOutParam()); 334 327 // returns pMedium if there are no diff images 335 328 if (FAILED(rc)) throw rc; 329 330 Bstr bstrBaseName; 331 rc = pBaseMedium->COMGETTER(Name)(bstrBaseName.asOutParam()); 332 if (FAILED(rc)) throw rc; 333 334 strTargetVmdkName = bstrBaseName; 335 strTargetVmdkName.stripExt(); 336 strTargetVmdkName.append(".vmdk"); 336 337 337 338 // force reading state, or else size will be returned as 0 … … 1407 1408 strSrcFilePath.c_str()); 1408 1409 1410 // clone the disk: 1411 ComPtr<IMedium> pSourceDisk; 1412 ComPtr<IMedium> pTargetDisk; 1413 ComPtr<IProgress> pProgress2; 1414 1415 Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw())); 1416 rc = mVirtualBox->FindHardDisk(bstrSrcFilePath, pSourceDisk.asOutParam()); 1417 if (FAILED(rc)) throw rc; 1418 1419 Bstr uuidSource; 1420 rc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam()); 1421 if (FAILED(rc)) throw rc; 1422 Guid guidSource(uuidSource); 1423 1409 1424 // output filename 1410 1425 const Utf8Str &strTargetFileNameOnly = pDiskEntry->strOvf; … … 1415 1430 strTargetFilePath.append(strTargetFileNameOnly); 1416 1431 1417 // clone the disk:1418 ComPtr<IMedium> pSourceDisk;1419 ComPtr<IMedium> pTargetDisk;1420 ComPtr<IProgress> pProgress2;1421 1422 Log(("Finding source disk \"%ls\"\n", bstrSrcFilePath.raw()));1423 rc = mVirtualBox->FindHardDisk(bstrSrcFilePath, pSourceDisk.asOutParam());1424 if (FAILED(rc)) throw rc;1425 1426 Bstr uuidSource;1427 rc = pSourceDisk->COMGETTER(Id)(uuidSource.asOutParam());1428 if (FAILED(rc)) throw rc;1429 Guid guidSource(uuidSource);1430 1431 1432 // We are always exporting to VMDK stream optimized for now 1432 1433 Bstr bstrSrcFormat = L"VMDK"; … … 1447 1448 // advance to the next operation 1448 1449 if (!pProgress.isNull()) 1449 pProgress->SetNextOperation(BstrFmt(tr("Exporting virtual disk image '%s'"), strSrcFilePath.c_str()),1450 pProgress->SetNextOperation(BstrFmt(tr("Exporting to disk image '%s'"), strTargetFilePath.c_str()), 1450 1451 pDiskEntry->ulSizeMB); // operation's weight, as set up with the IProgress originally); 1451 1452
Note:
See TracChangeset
for help on using the changeset viewer.