Changeset 75766 in vbox for trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
- Timestamp:
- Nov 27, 2018 11:00:10 AM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 126968
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.