Changeset 75766 in vbox
- Timestamp:
- Nov 27, 2018 11:00:10 AM (6 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ApplianceImpl.h
r73892 r75766 115 115 class TaskOVF; 116 116 class TaskOPC; 117 class Task OCI;117 class TaskCloud; 118 118 119 119 struct Data; // opaque, defined in ApplianceImpl.cpp 120 120 Data *m; 121 121 122 enum SetUpProgressMode { ImportFile, ImportS3, WriteFile, WriteS3, Export OCI};122 enum SetUpProgressMode { ImportFile, ImportS3, WriteFile, WriteS3, ExportCloud }; 123 123 124 124 /** @name General stuff … … 139 139 static void i_importOrExportThreadTask(TaskOVF *pTask); 140 140 static void i_exportOPCThreadTask(TaskOPC *pTask); 141 static void i_export OCIThreadTask(TaskOCI*pTask);141 static void i_exportCloudThreadTask(TaskCloud *pTask); 142 142 143 143 HRESULT i_initBackendNames(); … … 218 218 HRESULT i_writeImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress); 219 219 HRESULT i_writeOPCImpl(ovf::OVFVersion_T aFormat, const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress); 220 HRESULT i_write OCIImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress);220 HRESULT i_writeCloudImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress); 221 221 222 222 HRESULT i_writeFS(TaskOVF *pTask); … … 224 224 HRESULT i_writeFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock); 225 225 HRESULT i_writeFSOPC(TaskOPC *pTask); 226 HRESULT i_writeFS OCI(TaskOCI*pTask);226 HRESULT i_writeFSCloud(TaskCloud *pTask); 227 227 HRESULT i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase &writeLock, RTVFSFSSTREAM hVfsFssDst); 228 228 HRESULT i_writeBufferToFile(RTVFSFSSTREAM hVfsFssDst, const char *pszFilename, const void *pvContent, size_t cbContent); -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r75312 r75766 231 231 uint32_t m_cPwProvided; 232 232 233 struct OciExportData_T {233 struct CloudExportData_T { 234 234 Utf8Str strDisplayMachineName; 235 235 Utf8Str strProfileFilePath; … … 245 245 }; 246 246 247 OciExportData_T m_OciExportData;247 CloudExportData_T m_CloudExportData; 248 248 }; 249 249 … … 346 346 347 347 348 class Appliance::Task OCI: public ThreadTask348 class Appliance::TaskCloud : public ThreadTask 349 349 { 350 350 public: … … 354 354 }; 355 355 356 Task OCI(Appliance *aThat,356 TaskCloud(Appliance *aThat, 357 357 TaskType aType, 358 358 LocationInfo aLocInfo, 359 359 ComObjPtr<Progress> &aProgress) 360 : ThreadTask("Task OCI"),360 : ThreadTask("TaskCloud"), 361 361 pAppliance(aThat), 362 362 taskType(aType), … … 365 365 rc(S_OK) 366 366 { 367 m_strTaskName = " OCIExpt";368 } 369 370 ~Task OCI()367 m_strTaskName = "CloudExpt"; 368 } 369 370 ~TaskCloud() 371 371 { 372 372 } … … 383 383 void handler() 384 384 { 385 Appliance::i_export OCIThreadTask(this);385 Appliance::i_exportCloudThreadTask(this); 386 386 } 387 387 }; -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r74217 r75766 1035 1035 break; 1036 1036 } 1037 case Export OCI:1038 cOperations = 1 + 7;1037 case ExportCloud: 1038 cOperations = 1 + 9;//7 1039 1039 ulTotalOperationsWeight = 100*cOperations; 1040 1040 m->ulWeightForXmlOperation = 100; … … 1268 1268 1269 1269 /** 1270 * Worker for Task OCI::handler.1270 * Worker for TaskCloud::handler. 1271 1271 * @thread pTask The task. 1272 1272 */ 1273 1273 /* static */ 1274 void Appliance::i_export OCIThreadTask(TaskOCI*pTask)1274 void Appliance::i_exportCloudThreadTask(TaskCloud *pTask) 1275 1275 { 1276 1276 LogFlowFuncEnter(); … … 1282 1282 switch (pTask->taskType) 1283 1283 { 1284 case Task OCI::Export:1285 pTask->rc = pAppliance->i_writeFS OCI(pTask);1284 case TaskCloud::Export: 1285 pTask->rc = pAppliance->i_writeFSCloud(pTask); 1286 1286 break; 1287 1287 … … 1299 1299 1300 1300 /* static */ 1301 DECLCALLBACK(int) Appliance::Task OCI::updateProgress(unsigned uPercent, void *pvUser)1302 { 1303 Appliance::Task OCI* pTask = *(Appliance::TaskOCI**)pvUser;1301 DECLCALLBACK(int) Appliance::TaskCloud::updateProgress(unsigned uPercent, void *pvUser) 1302 { 1303 Appliance::TaskCloud* pTask = *(Appliance::TaskCloud**)pvUser; 1304 1304 1305 1305 if ( pTask … … 1335 1335 else if (strUri.startsWith("OCI://", Utf8Str::CaseInsensitive)) /* OCI service (storage or compute) */ 1336 1336 { 1337 locInfo.storageType = VFSType_ OCI;1337 locInfo.storageType = VFSType_Cloud; 1338 1338 strUri = strUri.substr(sizeof("OCI://") - 1); 1339 1339 } -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r75434 r75766 39 39 40 40 #include "ApplianceImplPrivate.h" 41 42 //#include "OCIProvider.h"43 //#include "CloudClientImpl.h"44 //#include "OCIProfile.h"45 //#include "CloudAPI.h"46 //#include "VBoxOCIApi.h"47 //#include "VBoxOCIRest.h"48 41 49 42 using namespace std; … … 666 659 * the error straight from the API call but a tiny bit later through the 667 660 * Progress object. */ 668 if (m->locInfo.storageType == VFSType_ OCI)//(isCloudDestination(aPath))661 if (m->locInfo.storageType == VFSType_Cloud)//(isCloudDestination(aPath)) 669 662 { 670 663 rc = S_OK; … … 672 665 try 673 666 { 674 switch (m->locInfo.storageType) 675 { 676 case VFSType_OCI: 677 rc = i_writeOCIImpl(m->locInfo, progress); 678 break; 679 // case VFSType_GCP: 680 // rc = i_writeGCPImpl(m->locInfo, progress); 681 // break; 682 // case VFSType_Amazon: 683 // rc = i_writeAmazonImpl(m->locInfo, progress); 684 // break; 685 // case VFSType_Azure: 686 // rc = i_writeAzureImpl(m->locInfo, progress); 687 // break; 688 default: 689 break; 690 } 691 667 rc = i_writeCloudImpl(m->locInfo, progress); 692 668 } 693 669 catch (HRESULT aRC) … … 859 835 860 836 861 HRESULT Appliance::i_write OCIImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress)837 HRESULT Appliance::i_writeCloudImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress) 862 838 { 863 839 HRESULT rc; … … 901 877 { 902 878 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 903 tr(" Strange, but nothing to export to OCIafter preparation steps"));879 tr("There are no images to export to Cloud after preparation steps")); 904 880 } 905 881 … … 910 886 vsdescThis->i_findByType(VirtualSystemDescriptionType_Name); 911 887 if (machineName.empty()) 912 throw setError(VBOX_E_FILE_ERROR, tr(" OCI: VM name wasn't found"));913 m->m_ OciExportData.strDisplayMachineName = machineName.front()->strVBoxCurrent;914 LogRel(("Exported machine name: %s\n", m->m_ OciExportData.strDisplayMachineName.c_str()));915 916 m->m_ OciExportData.strBootImageName = strBootLocation;917 LogRel(("Exported image: %s\n", m->m_ OciExportData.strBootImageName.c_str()));888 throw setError(VBOX_E_FILE_ERROR, tr("Cloud: VM name wasn't found")); 889 m->m_CloudExportData.strDisplayMachineName = machineName.front()->strVBoxCurrent; 890 LogRel(("Exported machine name: %s\n", m->m_CloudExportData.strDisplayMachineName.c_str())); 891 892 m->m_CloudExportData.strBootImageName = strBootLocation; 893 LogRel(("Exported image: %s\n", m->m_CloudExportData.strBootImageName.c_str())); 918 894 919 895 if (aLocInfo.strPath.isEmpty()) 920 896 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 921 tr(" OCI: Cloud user profile wasn't found"));922 923 m->m_ OciExportData.strProfileName = aLocInfo.strPath;924 LogRel((" OCI profile name: %s\n", m->m_OciExportData.strProfileName.c_str()));897 tr("Cloud: Cloud user profile wasn't found")); 898 899 m->m_CloudExportData.strProfileName = aLocInfo.strPath; 900 LogRel(("profile name: %s\n", m->m_CloudExportData.strProfileName.c_str())); 925 901 926 902 Utf8Str strInstanceShapeId; … … 929 905 if (shapeId.empty()) 930 906 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 931 tr(" OCI: Shape of instance wasn't found"));932 933 m->m_ OciExportData.strInstanceShapeId = shapeId.front()->strVBoxCurrent;934 LogRel((" OCI shape: %s\n", m->m_OciExportData.strInstanceShapeId.c_str()));907 tr("Cloud: Shape of instance wasn't found")); 908 909 m->m_CloudExportData.strInstanceShapeId = shapeId.front()->strVBoxCurrent; 910 LogRel(("Shape: %s\n", m->m_CloudExportData.strInstanceShapeId.c_str())); 935 911 936 912 std::list<VirtualSystemDescriptionEntry*> domainName = … … 938 914 if (domainName.empty()) 939 915 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 940 tr(" OCI: Available domain wasn't found"));941 942 m->m_ OciExportData.strDomainName = domainName.front()->strVBoxCurrent;943 LogRel((" OCI available domain name: %s\n", m->m_OciExportData.strDomainName.c_str()));916 tr("Cloud: Available domain wasn't found")); 917 918 m->m_CloudExportData.strDomainName = domainName.front()->strVBoxCurrent; 919 LogRel(("Available domain name: %s\n", m->m_CloudExportData.strDomainName.c_str())); 944 920 945 921 std::list<VirtualSystemDescriptionEntry*> bootDiskSize = … … 947 923 if (bootDiskSize.empty()) 948 924 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 949 tr(" OCI: Boot disk size wasn't found"));950 951 m->m_ OciExportData.strBootDiskSize = bootDiskSize.front()->strVBoxCurrent;952 LogRel((" OCI boot disk size: %s\n", m->m_OciExportData.strBootDiskSize.c_str()));925 tr("Cloud: Boot disk size wasn't found")); 926 927 m->m_CloudExportData.strBootDiskSize = bootDiskSize.front()->strVBoxCurrent; 928 LogRel(("Boot disk size: %s\n", m->m_CloudExportData.strBootDiskSize.c_str())); 953 929 954 930 std::list<VirtualSystemDescriptionEntry*> bucketId = … … 956 932 if (bucketId.empty()) 957 933 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 958 tr(" OCI: Bucket wasn't found"));959 960 m->m_ OciExportData.strBucketId = bucketId.front()->strVBoxCurrent;961 LogRel((" OCI bucket name: %s\n", m->m_OciExportData.strBucketId.c_str()));934 tr("Cloud: Bucket wasn't found")); 935 936 m->m_CloudExportData.strBucketId = bucketId.front()->strVBoxCurrent; 937 LogRel(("bucket name: %s\n", m->m_CloudExportData.strBucketId.c_str())); 962 938 963 939 std::list<VirtualSystemDescriptionEntry*> subnet = … … 965 941 if (subnet.empty()) 966 942 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 967 tr(" OCI: Subnet wasn't found"));968 969 m->m_ OciExportData.strSubnet = subnet.front()->strVBoxCurrent;970 LogRel((" OCI Subnet name: %s\n", m->m_OciExportData.strSubnet.c_str()));943 tr("Cloud: Subnet wasn't found")); 944 945 m->m_CloudExportData.strSubnet = subnet.front()->strVBoxCurrent; 946 LogRel(("Subnet name: %s\n", m->m_CloudExportData.strSubnet.c_str())); 971 947 972 948 std::list<VirtualSystemDescriptionEntry*> publicIP = … … 974 950 if (publicIP.empty()) 975 951 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 976 tr(" OCI: Public IP setting wasn't found"));977 978 m->m_ OciExportData.fPublicIP = (publicIP.front()->strVBoxCurrent == "true") ? true : false;979 LogRel((" OCI public IP: %s\n", m->m_OciExportData.fPublicIP ? "yes" : "no"));952 tr("Cloud: Public IP setting wasn't found")); 953 954 m->m_CloudExportData.fPublicIP = (publicIP.front()->strVBoxCurrent == "true") ? true : false; 955 LogRel(("public IP: %s\n", m->m_CloudExportData.fPublicIP ? "yes" : "no")); 980 956 } 981 957 … … 984 960 985 961 // Initialize our worker task 986 Task OCI* task = NULL;962 TaskCloud* task = NULL; 987 963 try 988 964 { 989 task = new Appliance::Task OCI(this, TaskOCI::Export, aLocInfo, aProgress);965 task = new Appliance::TaskCloud(this, TaskCloud::Export, aLocInfo, aProgress); 990 966 } 991 967 catch(...) 992 968 { 993 969 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 994 tr("Could not create Task OCI object for exporting to OCI"));970 tr("Could not create TaskCloud object for exporting to Cloud")); 995 971 } 996 972 … … 2343 2319 * instance with this image in the OCI Compute service. 2344 2320 */ 2345 HRESULT Appliance::i_writeFS OCI(TaskOCI*pTask)2321 HRESULT Appliance::i_writeFSCloud(TaskCloud *pTask) 2346 2322 { 2347 LogRel(("Appliance::i_writeFSOCI\n"));2348 2323 LogFlowFuncEnter(); 2349 2324 … … 2352 2327 hrc = mVirtualBox->COMGETTER(CloudProviderManager)(cpm.asOutParam()); 2353 2328 Utf8Str strProviderName("OCI"); 2354 ComPtr<ICloudProvider> ociProvider;2355 hrc = cpm->GetProviderByShortName(Bstr(strProviderName.c_str()).raw(), ociProvider.asOutParam());2356 ComPtr<ICloudProfile> ociProfile;2357 hrc = ociProvider->GetProfileByName(Bstr(m->m_OciExportData.strProfileName.c_str()).raw(), ociProfile.asOutParam());2329 ComPtr<ICloudProvider> cloudProvider; 2330 hrc = cpm->GetProviderByShortName(Bstr(strProviderName.c_str()).raw(), cloudProvider.asOutParam()); 2331 ComPtr<ICloudProfile> cloudProfile; 2332 hrc = cloudProvider->GetProfileByName(Bstr(m->m_CloudExportData.strProfileName.c_str()).raw(), cloudProfile.asOutParam()); 2358 2333 ComObjPtr<ICloudClient> cloudClient; 2359 hrc = ociProfile->CreateCloudClient(cloudClient.asOutParam());2334 hrc = cloudProfile->CreateCloudClient(cloudClient.asOutParam()); 2360 2335 2361 2336 if (SUCCEEDED(hrc)) 2362 2337 { 2363 LogRel(("Appliance::i_writeFSOCI(): calling OCICloudClient::exportVM\n")); 2364 2365 /// @todo that's to be moved to ExpTack, but we need to have that method 2366 /// exposed in .xidl 2338 LogRel(("Appliance::i_writeFSCloud(): calling CloudClient::ExportLaunchVM\n")); 2339 2367 2340 if (m->virtualSystemDescriptions.size() == 1) { 2368 2341 ComPtr<IVirtualBox> VBox(mVirtualBox); 2369 2342 2370 2343 pTask->pProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 2371 Bstr("Exporting VM to OCI...").raw(),2344 Bstr("Exporting VM to Cloud...").raw(), 2372 2345 TRUE /* aCancelable */, 2373 2346 5, // ULONG cOperations, 2374 2347 1000, // ULONG ulTotalOperationsWeight, 2375 Bstr("Exporting VM to OCI...").raw(), // aFirstOperationDescription2348 Bstr("Exporting VM to Cloud...").raw(), // aFirstOperationDescription 2376 2349 10); // ULONG ulFirstOperationWeight, 2377 2350
Note:
See TracChangeset
for help on using the changeset viewer.