Changeset 42038 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 6, 2012 12:54:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r41783 r42038 1233 1233 HRESULT rc = S_OK; 1234 1234 1235 PVDINTERFACEIO pShaIo = 0;1236 PVDINTERFACEIO pFileIo = 0;1237 void *pvMfBuf = 0;1235 PVDINTERFACEIO pShaIo = NULL; 1236 PVDINTERFACEIO pFileIo = NULL; 1237 void *pvMfBuf = NULL; 1238 1238 writeLock.release(); 1239 1239 try 1240 1240 { 1241 1241 /* Create the necessary file access interfaces. */ 1242 pShaIo = ShaCreateInterface();1243 if (!pShaIo)1244 throw setError(E_OUTOFMEMORY);1245 1242 pFileIo = FileCreateInterface(); 1246 1243 if (!pFileIo) 1247 1244 throw setError(E_OUTOFMEMORY); 1248 1245 1249 SHASTORAGE storage;1250 RT_ZERO(storage);1251 storage.fCreateDigest = true;1252 int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile",1253 VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO),1254 &storage.pVDImageIfaces);1255 if (RT_FAILURE(vrc))1256 throw setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc);1257 1258 size_t cbMfSize = 0;1259 1246 Utf8Str strMfFile = Utf8Str(pTask->locInfo.strPath).stripExt().append(".mf"); 1260 1247 /* Create the import stack for the rollback on errors. */ 1261 1248 ImportStack stack(pTask->locInfo, m->pReader->m_mapDisks, pTask->pProgress); 1262 /* Do we need the digest information? */ 1263 storage.fCreateDigest = RTFileExists(strMfFile.c_str()); 1264 /* Now import the appliance. */ 1265 importMachines(stack, pShaIo, &storage); 1266 /* Read & verify the manifest file, if there is one. */ 1267 if (storage.fCreateDigest) 1268 { 1249 1250 if (RTFileExists(strMfFile.c_str())) 1251 { 1252 SHASTORAGE storage; 1253 RT_ZERO(storage); 1254 1255 pShaIo = ShaCreateInterface(); 1256 if (!pShaIo) 1257 throw setError(E_OUTOFMEMORY); 1258 1259 storage.fCreateDigest = true; 1260 int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile", 1261 VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO), 1262 &storage.pVDImageIfaces); 1263 if (RT_FAILURE(vrc)) 1264 throw setError(VBOX_E_IPRT_ERROR, "Creation of the VD interface failed (%Rrc)", vrc); 1265 1266 size_t cbMfSize = 0; 1267 storage.fCreateDigest = true; 1268 /* Now import the appliance. */ 1269 importMachines(stack, pShaIo, &storage); 1270 /* Read & verify the manifest file. */ 1269 1271 /* Add the ovf file to the digest list. */ 1270 1272 stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHADigest)); … … 1274 1276 if (FAILED(rc)) throw rc; 1275 1277 } 1278 else 1279 importMachines(stack, pFileIo, NULL); 1276 1280 } 1277 1281 catch (HRESULT rc2) … … 1912 1916 /* Add the newly create disk path + a corresponding digest the our list for 1913 1917 * later manifest verification. */ 1914 stack.llSrcDisksDigest.push_back(STRPAIR(strSrcFilePath, pStorage ->strDigest));1918 stack.llSrcDisksDigest.push_back(STRPAIR(strSrcFilePath, pStorage ? pStorage->strDigest : "")); 1915 1919 } 1916 1920
Note:
See TracChangeset
for help on using the changeset viewer.