Changeset 72883 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 4, 2018 3:22:02 PM (7 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp
r72509 r72883 1250 1250 srcLock.release(); 1251 1251 rc = pLMedium->i_cloneToEx(pTarget, 1252 srcVar,1252 (MediumVariant_T)srcVar, 1253 1253 pNewParent, 1254 1254 progress2.asOutParam(), -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r72703 r72883 38 38 #include <iprt/memsafer.h> 39 39 #include <iprt/base64.h> 40 #include <iprt/vfs.h> 41 #include <iprt/fsvfs.h> 40 42 41 43 #include <VBox/vd.h> … … 2594 2596 m->strFormat.c_str()); 2595 2597 2598 if ( (mediumVariantFlags & MediumVariant_Formatted) 2599 && i_getDeviceType() != DeviceType_Floppy) 2600 throw setError(VBOX_E_NOT_SUPPORTED, 2601 tr("Medium variant 'formatted' applies to floppy images only")); 2602 2596 2603 if (m->state != MediumState_NotCreated) 2597 2604 throw i_setStateError(); … … 2610 2617 pTask = new Medium::CreateBaseTask(this, pProgress, aLogicalSize, 2611 2618 (MediumVariant_T)mediumVariantFlags); 2612 //(MediumVariant_T)aVariant);2613 2619 rc = pTask->rc(); 2614 2620 AssertComRC(rc); … … 2749 2755 } 2750 2756 2757 if (mediumVariantFlags & MediumVariant_Formatted) 2758 { 2759 delete pMediumLockList; 2760 return setError(VBOX_E_NOT_SUPPORTED, 2761 tr("Medium variant 'formatted' applies to floppy images only")); 2762 } 2763 2751 2764 rc = i_createDiffStorage(diff, (MediumVariant_T)mediumVariantFlags, pMediumLockList, 2752 2765 &pProgress, false /* aWait */); … … 2915 2928 for (size_t i = 0; i < aVariant.size(); i++) 2916 2929 mediumVariantFlags |= (ULONG)aVariant[i]; 2930 } 2931 2932 if (mediumVariantFlags & MediumVariant_Formatted) 2933 { 2934 delete pSourceMediumLockList; 2935 delete pTargetMediumLockList; 2936 throw setError(VBOX_E_NOT_SUPPORTED, 2937 tr("Medium variant 'formatted' applies to floppy images only")); 2917 2938 } 2918 2939 … … 6227 6248 false /* fMoveByRename */, 6228 6249 0 /* cbSize */, 6229 aVariant & ~ MediumVariant_NoCreateDir,6250 aVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted), 6230 6251 NULL /* pDstUuid */, 6231 6252 VD_OPEN_FLAGS_NORMAL | VD_OPEN_FLAGS_SEQUENTIAL, … … 6376 6397 * @return 6377 6398 */ 6378 HRESULT Medium::i_cloneToEx(const ComObjPtr<Medium> &aTarget, ULONGaVariant,6399 HRESULT Medium::i_cloneToEx(const ComObjPtr<Medium> &aTarget, MediumVariant_T aVariant, 6379 6400 const ComObjPtr<Medium> &aParent, IProgress **aProgress, 6380 6401 uint32_t idxSrcImageSame, uint32_t idxDstImageSame) … … 6480 6501 6481 6502 /* setup task object to carry out the operation asynchronously */ 6482 pTask = new Medium::CloneTask(this, pProgress, aTarget, 6483 (MediumVariant_T)aVariant, 6503 pTask = new Medium::CloneTask(this, pProgress, aTarget, aVariant, 6484 6504 aParent, idxSrcImageSame, 6485 6505 idxDstImageSame, pSourceMediumLockList, … … 8187 8207 location.c_str(), 8188 8208 task.mSize, 8189 task.mVariant & ~ MediumVariant_NoCreateDir,8209 task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted), 8190 8210 NULL, 8191 8211 &geo, … … 8204 8224 throw setError(VBOX_E_FILE_ERROR, 8205 8225 tr("Could not create the medium storage unit '%s'%s"), 8226 location.c_str(), i_vdError(vrc).c_str()); 8227 } 8228 8229 if (task.mVariant & MediumVariant_Formatted) 8230 { 8231 RTVFSFILE hVfsFile; 8232 vrc = RTVfsFileOpenNormal(location.c_str(), RTFILE_O_READWRITE | RTFILE_O_OPEN | RTFILE_O_DENY_ALL, &hVfsFile); 8233 if (RT_FAILURE(vrc)) 8234 throw setError(VBOX_E_FILE_ERROR, 8235 tr("Opening medium storage unit '%s' failed%s"), 8236 location.c_str(), i_vdError(vrc).c_str()); 8237 vrc = RTFsFatVolFormat(hVfsFile, 0 /* offVol */, 0 /* cbVol */, RTFSFATVOL_FMT_F_QUICK, 8238 0 /* cbSector */, 0 /* cbSectorPerCluster */, RTFSFATTYPE_INVALID, 8239 0 /* cHeads */, 0 /* cSectorsPerTrack*/, 0 /* bMedia */, 8240 0 /* cRootDirEntries */, 0 /* cHiddenSectors */, 8241 NULL /* pErrInfo */); 8242 RTVfsFileRelease(hVfsFile); 8243 if (RT_FAILURE(vrc)) 8244 throw setError(VBOX_E_FILE_ERROR, 8245 tr("Formatting medium storage unit '%s' failed%s"), 8206 8246 location.c_str(), i_vdError(vrc).c_str()); 8207 8247 } … … 8379 8419 targetFormat.c_str(), 8380 8420 targetLocation.c_str(), 8381 (task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_VmdkESX)) | VD_IMAGE_FLAGS_DIFF, 8421 (task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted | MediumVariant_VmdkESX)) 8422 | VD_IMAGE_FLAGS_DIFF, 8382 8423 NULL, 8383 8424 targetId.raw(), … … 8975 9016 false /* fMoveByRename */, 8976 9017 0 /* cbSize */, 8977 task.mVariant & ~ MediumVariant_NoCreateDir,9018 task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted), 8978 9019 targetId.raw(), 8979 9020 VD_OPEN_FLAGS_NORMAL | m->uOpenFlagsDef, … … 8993 9034 task.midxSrcImageSame, 8994 9035 task.midxDstImageSame, 8995 task.mVariant & ~ MediumVariant_NoCreateDir,9036 task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted), 8996 9037 targetId.raw(), 8997 9038 VD_OPEN_FLAGS_NORMAL | m->uOpenFlagsDef, … … 9864 9905 false /* fMoveByRename */, 9865 9906 0 /* cbSize */, 9866 task.mVariant & ~ MediumVariant_NoCreateDir,9907 task.mVariant & ~(MediumVariant_NoCreateDir | MediumVariant_Formatted), 9867 9908 targetId.raw(), 9868 9909 VD_OPEN_FLAGS_NORMAL,
Note:
See TracChangeset
for help on using the changeset viewer.