Changeset 78755 in vbox for trunk/src/VBox/Main
- Timestamp:
- May 26, 2019 2:49:29 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r78754 r78755 830 830 HRESULT Appliance::i_writeCloudImpl(const LocationInfo &aLocInfo, ComObjPtr<Progress> &aProgress) 831 831 { 832 HRESULT rc;833 834 832 for (list<ComObjPtr<VirtualSystemDescription> >::const_iterator 835 833 it = m->virtualSystemDescriptions.begin(); … … 862 860 //just in case 863 861 if (vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage).empty()) 864 { 865 return setError(VBOX_E_OBJECT_NOT_FOUND, 866 tr("There are no images to export to Cloud after preparation steps")); 867 } 862 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("There are no images to export to Cloud after preparation steps")); 868 863 869 864 /* 870 865 * Fills out the OCI settings 871 */872 std::list<VirtualSystemDescriptionEntry*> profileName =873 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudProfileName);866 */ 867 std::list<VirtualSystemDescriptionEntry*> profileName 868 = vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudProfileName); 874 869 if (profileName.size() > 1) 875 return setError(VBOX_E_OBJECT_NOT_FOUND, 876 tr("Cloud: More than one profile name was found.")); 877 else if (profileName.empty()) 878 return setError(VBOX_E_OBJECT_NOT_FOUND, 879 tr("Cloud: Profile name wasn't specified.")); 870 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("Cloud: More than one profile name was found.")); 871 if (profileName.empty()) 872 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("Cloud: Profile name wasn't specified.")); 880 873 881 874 if (profileName.front()->strVBoxCurrent.isEmpty()) 882 return setError(VBOX_E_OBJECT_NOT_FOUND, 883 tr("Cloud: Cloud user profile name is empty")); 875 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("Cloud: Cloud user profile name is empty")); 884 876 885 877 LogRel(("profile name: %s\n", profileName.front()->strVBoxCurrent.c_str())); 886 887 878 } 888 879 889 880 // we need to do that as otherwise Task won't be created successfully 890 aProgress.createObject(); 891 if (aLocInfo.strProvider.equals("OCI")) 892 { 893 aProgress->init(mVirtualBox, static_cast<IAppliance*>(this), 894 Bstr("Exporting VM to Cloud...").raw(), 895 TRUE /* aCancelable */, 896 5, // ULONG cOperations, 897 1000, // ULONG ulTotalOperationsWeight, 898 Bstr("Exporting VM to Cloud...").raw(), // aFirstOperationDescription 899 10); // ULONG ulFirstOperationWeight 900 } 901 else 902 return setErrorVrc(VBOX_E_NOT_SUPPORTED, 903 tr("Only \"OCI\" cloud provider is supported for now. \"%s\" isn't supported."), 904 aLocInfo.strProvider.c_str()); 905 // Initialize our worker task 906 TaskCloud* task = NULL; 907 try 908 { 909 task = new Appliance::TaskCloud(this, TaskCloud::Export, aLocInfo, aProgress); 910 911 } 912 catch(...) 913 { 914 return setError(VBOX_E_OBJECT_NOT_FOUND, 915 tr("Could not create TaskCloud object for exporting to Cloud")); 916 } 917 918 rc = task->createThread(); 919 920 return rc; 881 /// @todo r=bird: What's 'that' here exactly? 882 HRESULT hrc = aProgress.createObject(); 883 if (SUCCEEDED(hrc)) 884 { 885 if (aLocInfo.strProvider.equals("OCI")) 886 { 887 hrc = aProgress->init(mVirtualBox, static_cast<IAppliance *>(this), 888 Utf8Str(tr("Exporting VM to Cloud...")), 889 TRUE /* aCancelable */, 890 5, // ULONG cOperations, 891 1000, // ULONG ulTotalOperationsWeight, 892 Utf8Str(tr("Exporting VM to Cloud...")), // aFirstOperationDescription 893 10); // ULONG ulFirstOperationWeight 894 } 895 else 896 hrc = setErrorVrc(VBOX_E_NOT_SUPPORTED, 897 tr("Only \"OCI\" cloud provider is supported for now. \"%s\" isn't supported."), 898 aLocInfo.strProvider.c_str()); 899 if (SUCCEEDED(hrc)) 900 { 901 /* Initialize the worker task: */ 902 TaskCloud *pTask = NULL; 903 try 904 { 905 pTask = new Appliance::TaskCloud(this, TaskCloud::Export, aLocInfo, aProgress); 906 } 907 catch (std::bad_alloc &) 908 { 909 pTask = NULL; 910 hrc = E_OUTOFMEMORY; 911 } 912 if (SUCCEEDED(hrc)) 913 { 914 /* Kick off the worker task: */ 915 hrc = pTask->createThread(); 916 pTask = NULL; 917 } 918 } 919 } 920 return hrc; 921 921 } 922 922
Note:
See TracChangeset
for help on using the changeset viewer.