Changeset 57996 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Oct 2, 2015 8:13:15 AM (9 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r57437 r57996 1185 1185 1186 1186 /** 1187 * Starts the worker thread for the task.1188 *1189 * @return COM status code.1190 */1191 HRESULT Appliance::TaskOVF::startThread()1192 {1193 /* Pick a thread name suitable for logging (<= 8 chars). */1194 const char *pszTaskNm;1195 switch (taskType)1196 {1197 case TaskOVF::Read: pszTaskNm = "ApplRead"; break;1198 case TaskOVF::Import: pszTaskNm = "ApplImp"; break;1199 case TaskOVF::Write: pszTaskNm = "ApplWrit"; break;1200 default: pszTaskNm = "ApplTask"; break;1201 }1202 1203 int vrc = RTThreadCreate(NULL, Appliance::i_taskThreadImportOrExport, this,1204 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, 0, pszTaskNm);1205 if (RT_SUCCESS(vrc))1206 return S_OK;1207 return Appliance::i_setErrorStatic(E_FAIL, Utf8StrFmt("Could not create OVF task thread (%Rrc)\n", vrc));1208 }1209 1210 /**1211 1187 * Thread function for the thread started in Appliance::readImpl() and Appliance::importImpl() 1212 1188 * and Appliance::writeImpl(). … … 1220 1196 DECLCALLBACK(int) Appliance::i_taskThreadImportOrExport(RTTHREAD /* aThread */, void *pvUser) 1221 1197 { 1222 std::auto_ptr<TaskOVF> task(static_cast<TaskOVF*>(pvUser));1223 AssertReturn(task .get(), VERR_GENERAL_FAILURE);1198 TaskOVF* task = static_cast<TaskOVF*>(pvUser); 1199 AssertReturn(task, VERR_GENERAL_FAILURE); 1224 1200 1225 1201 Appliance *pAppliance = task->pAppliance; … … 1234 1210 case TaskOVF::Read: 1235 1211 if (task->locInfo.storageType == VFSType_File) 1236 taskrc = pAppliance->i_readFS(task .get());1212 taskrc = pAppliance->i_readFS(task); 1237 1213 else if (task->locInfo.storageType == VFSType_S3) 1238 1214 #ifdef VBOX_WITH_S3 1239 taskrc = pAppliance->i_readS3(task .get());1215 taskrc = pAppliance->i_readS3(task); 1240 1216 #else 1241 1217 taskrc = VERR_NOT_IMPLEMENTED; … … 1245 1221 case TaskOVF::Import: 1246 1222 if (task->locInfo.storageType == VFSType_File) 1247 taskrc = pAppliance->i_importFS(task .get());1223 taskrc = pAppliance->i_importFS(task); 1248 1224 else if (task->locInfo.storageType == VFSType_S3) 1249 1225 #ifdef VBOX_WITH_S3 1250 taskrc = pAppliance->i_importS3(task .get());1226 taskrc = pAppliance->i_importS3(task); 1251 1227 #else 1252 1228 taskrc = VERR_NOT_IMPLEMENTED; … … 1256 1232 case TaskOVF::Write: 1257 1233 if (task->locInfo.storageType == VFSType_File) 1258 taskrc = pAppliance->i_writeFS(task .get());1234 taskrc = pAppliance->i_writeFS(task); 1259 1235 else if (task->locInfo.storageType == VFSType_S3) 1260 1236 #ifdef VBOX_WITH_S3 1261 taskrc = pAppliance->i_writeS3(task .get());1237 taskrc = pAppliance->i_writeS3(task); 1262 1238 #else 1263 1239 taskrc = VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r57277 r57996 28 28 #include "ApplianceImpl.h" 29 29 #include "VirtualBoxImpl.h" 30 31 30 #include "ProgressImpl.h" 32 31 #include "MachineImpl.h" … … 754 753 755 754 /* Initialize our worker task */ 756 std::auto_ptr<TaskOVF> task(new TaskOVF(this, TaskOVF::Write, aLocInfo, aProgress)); 755 TaskOVF* task = NULL; 756 try 757 { 758 task = new TaskOVF(this, TaskOVF::Write, aLocInfo, aProgress); 759 } 760 catch(...) 761 { 762 delete task; 763 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 764 tr("Could not create TaskOVF object for for writing out the OVF to disk")); 765 } 766 757 767 /* The OVF version to write */ 758 768 task->enFormat = aFormat; 759 769 760 rc = task-> startThread();770 rc = task->createThread(); 761 771 if (FAILED(rc)) throw rc; 762 772 763 /* Don't destruct on success */764 task.release();765 773 } 766 774 catch (HRESULT aRC) … … 1251 1259 pelmSystem->createChild("vssd:VirtualSystemIdentifier")->addContent(strVMName); 1252 1260 // <vssd:VirtualSystemType>vmx-4</vssd:VirtualSystemType> 1253 const char *pcszHardware = "virtualbox -2.2";1261 const char *pcszHardware = "virtualbox"; 1254 1262 if (enFormat == ovf::OVFVersion_0_9) 1255 1263 // pretend to be vmware compatible then -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r56599 r57996 874 874 875 875 /* Initialize our worker task */ 876 std::auto_ptr<TaskOVF> task(new TaskOVF(this, TaskOVF::Read, aLocInfo, aProgress)); 877 878 rc = task->startThread(); 876 TaskOVF* task = NULL; 877 try 878 { 879 task = new TaskOVF(this, TaskOVF::Read, aLocInfo, aProgress); 880 } 881 catch(...) 882 { 883 delete task; 884 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 885 tr("Could not create TaskOVF object for reading the OVF from disk")); 886 } 887 888 rc = task->createThread(); 879 889 if (FAILED(rc)) throw rc; 880 881 /* Don't destruct on success */882 task.release();883 890 884 891 return rc; … … 1371 1378 1372 1379 /* Initialize our worker task */ 1373 std::auto_ptr<TaskOVF> task(new TaskOVF(this, TaskOVF::Import, locInfo, progress)); 1374 1375 rc = task->startThread(); 1380 TaskOVF* task = NULL; 1381 try 1382 { 1383 task = new TaskOVF(this, TaskOVF::Import, locInfo, progress); 1384 } 1385 catch(...) 1386 { 1387 delete task; 1388 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 1389 tr("Could not create TaskOVF object for importing OVF data into VirtualBox")); 1390 } 1391 1392 rc = task->createThread(); 1376 1393 if (FAILED(rc)) throw rc; 1377 1378 /* Don't destruct on success */1379 task.release();1380 1394 1381 1395 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.