Changeset 73929 in vbox
- Timestamp:
- Aug 28, 2018 6:00:59 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
include/iprt/err.h (modified) (1 diff)
-
src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp (modified) (1 diff)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (5 diffs)
-
src/VBox/Main/include/ApplianceImplPrivate.h (modified) (1 diff)
-
src/VBox/Main/src-server/ApplianceImplExport.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/err.h
r73769 r73929 1837 1837 /** @name HTTP status codes 1838 1838 * @{ */ 1839 /** HTTP Internal Server Error. */ 1840 #define VERR_HTTP_STATUS_SERVER_ERROR (-884) 1839 1841 /** HTTP initialization failed. */ 1840 1842 #define VERR_HTTP_INIT_FAILED (-885) -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
r73217 r73929 917 917 case VirtualSystemDescriptionType_CloudOCIVCN: 918 918 case VirtualSystemDescriptionType_CloudOCIPublicIP: 919 case VirtualSystemDescriptionType_CloudOCIProfilePath: 920 case VirtualSystemDescriptionType_CloudOCISubnet: 919 921 case VirtualSystemDescriptionType_Miscellaneous: 920 922 /** @todo VirtualSystemDescriptionType_Miscellaneous? */ -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r73804 r73929 3536 3536 <enum 3537 3537 name="VirtualSystemDescriptionType" 3538 uuid=" e43225cb-09fc-4e70-a56c-6dad3bcb48a6"3538 uuid="99870ce5-c613-4a49-8ac8-bdad54565c54" 3539 3539 > 3540 3540 <desc>Used with <link to="IVirtualSystemDescription" /> to describe the type of … … 3587 3587 <const name="CloudOCIVCN" value="31" /> 3588 3588 <const name="CloudOCIPublicIP" value="32" /> 3589 <const name="CloudOCIProfilePath" value="33" /> 3590 <const name="CloudOCISubnet" value="34" /> 3589 3591 </enum> 3590 3592 … … 24875 24877 24876 24878 <enum 24879 name="CloudProviderId" 24880 uuid="c3856743-aa5d-404d-847d-14b6cf523677" 24881 > 24882 <const name="Unknown" value="0"/> 24883 <const name="OCI" value="1"/> 24884 <const name="GCP" value="2"/> 24885 <const name="AWS" value="3"/> 24886 <const name="MicrosoftAzure" value="4"/> 24887 <const name="IBMCloud" value="5"/> 24888 <const name="DigitalOcean" value="6"/> 24889 </enum> 24890 24891 <enum 24877 24892 name="CloudCommand" 24878 24893 uuid="1c5cfa19-7754-4071-bf3e-6d21ad432655" … … 24884 24899 <const name="stopInstance" value="0x4"/> 24885 24900 <const name="deleteInstance" value="0x5"/> 24886 <const name="getInstance Properties" value="0x6"/>24901 <const name="getInstance" value="0x6"/> 24887 24902 <const name="listInstances" value="0x7"/> 24888 <const name="importImage" value="0x8"/> 24889 24890 <const name="uploadFile" value="0x10"/> 24891 <const name="downloadObject" value="0x11"/> 24892 <const name="deleteObject" value="0x12"/> 24893 <const name="getObjectProperties" value="0x13"/> 24894 <const name="listObjects" value="0x14"/> 24895 <const name="listBuckets" value="0x15"/> 24896 <const name="listNetworks" value="0x16"/> 24897 <const name="listShapes" value="0x17"/> 24898 <const name="listRegions" value="0x18"/> 24899 <const name="listAvailabilityDomains" value="0x19"/> 24900 <const name="listCompartments" value="0x20"/> 24901 <const name="getNamespace" value="0x21"/> 24903 24904 <const name="createImage" value="0x10"/> 24905 <const name="getImage" value="0x11"/> 24906 <const name="importImage" value="0x12"/> 24907 <const name="exportImage" value="0x13"/> 24908 <const name="deleteImage" value="0x14"/> 24909 <const name="updateImage" value="0x15"/> 24910 <const name="listImages" value="0x16"/> 24911 24912 <const name="listNetworks" value="0x20"/> 24913 <const name="getNetwork" value="0x21"/> 24914 <const name="createNetwork" value="0x22"/> 24915 <const name="deleteNetwork" value="0x23"/> 24916 <const name="upateNetwork" value="0x24"/> 24917 24918 <const name="getNetworkCard" value="0x30"/> 24919 <const name="updateNetworkCard" value="0x31"/> 24920 24921 <const name="listNetworkCardAttachements" value="0x32"/> 24922 <const name="getNetworkCardAttachement" value="0x33"/> 24923 <const name="detachNetworkCard" value="0x34"/> 24924 <const name="attachNetworkCard" value="0x35"/> 24925 24926 <const name="listSubnets" value="0x40"/> 24927 <const name="getSubnet" value="0x41"/> 24928 <const name="createSubnet" value="0x42"/> 24929 <const name="deleteSubnet" value="0x43"/> 24930 <const name="updateSubnet" value="0x44"/> 24931 24932 <const name="listInternetGateways" value="0x50"/> 24933 <const name="getInternetGateway" value="0x51"/> 24934 <const name="createInternetGateway" value="0x52"/> 24935 <const name="deleteInternetGateway" value="0x53"/> 24936 <const name="updateInternetGateway" value="0x54"/> 24937 24938 <const name="listRouteTables" value="0x60"/> 24939 <const name="getRouteTable" value="0x61"/> 24940 <const name="createRouteTable" value="0x62"/> 24941 <const name="deleteRouteTable" value="0x63"/> 24942 <const name="updateRouteTable" value="0x64"/> 24943 24944 <const name="listShapes" value="0x70"/> 24945 24946 <const name="uploadFile" value="0x100"/> 24947 <const name="downloadObject" value="0x101"/> 24948 <const name="deleteObject" value="0x102"/> 24949 <const name="getObject" value="0x103"/> 24950 <const name="listObjects" value="0x104"/> 24951 24952 <const name="listBuckets" value="0x110"/> 24953 24954 <const name="getNamespace" value="0x120"/> 24955 24956 <const name="listRegions" value="0x200"/> 24957 <const name="listAvailabilityDomains" value="0x210"/> 24958 <const name="listCompartments" value="0x220"/> 24959 24902 24960 </enum> 24903 24961 … … 24961 25019 </param> 24962 25020 <param name="result" type="CloudCommandResult" dir="return"> 25021 </param> 25022 </method> 25023 25024 <method name="runSeveralCommands"> 25025 <desc> 25026 Runs a set of prepared cloud operations by their ids 25027 </desc> 25028 <param name="commandIdList" type="wstring" safearray="yes" dir="in"> 25029 <desc> 25030 The list of UUID of the operations. 25031 </desc> 25032 </param> 25033 <param name="parameterNames" type="wstring" safearray="yes" dir="in"> 25034 <desc>Initial set of parameter names.</desc> 25035 </param> 25036 <param name="parameterValues" type="wstring" safearray="yes" dir="in"> 25037 <desc>Initial set of parameter values.</desc> 24963 25038 </param> 24964 25039 </method> -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r73892 r73929 230 230 /** Number of passwords provided. */ 231 231 uint32_t m_cPwProvided; 232 233 struct OciExportData_T { 234 Utf8Str strDisplayMachineName; 235 Utf8Str strProfileFilePath; 236 Utf8Str strProfileName; 237 Utf8Str strInstanceShapeId; 238 Utf8Str strDomainName; 239 Utf8Str strBootDiskSize; 240 Utf8Str strBucketId; 241 Utf8Str strVCN; 242 bool fPublicIP; 243 Utf8Str strUserId; 244 Utf8Str strBootImageName; 245 }; 246 247 OciExportData_T m_OciExportData; 232 248 }; 233 249 -
trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp
r73903 r73929 31 31 #include "MachineImpl.h" 32 32 #include "MediumImpl.h" 33 #include "Global.h" 33 34 #include "MediumFormatImpl.h" 34 #include "Global.h"35 35 #include "SystemPropertiesImpl.h" 36 36 … … 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" 41 48 42 49 using namespace std; … … 867 874 skipped = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage); 868 875 itSkipped = skipped.begin(); 876 877 ComObjPtr<Medium> ptrSourceDisk; 869 878 while (itSkipped != skipped.end()) 870 879 { … … 872 881 // Locate the Medium object for this entry (by location/path). 873 882 Log(("Finding source disk \"%s\"\n", path.c_str())); 874 ComObjPtr<Medium> ptrSourceDisk;875 883 rc = mVirtualBox->i_findHardDiskByLocation(path, true , &ptrSourceDisk); 884 if (SUCCEEDED(rc)) 885 break; 886 else 887 ++itSkipped; 888 } 889 890 ComPtr<IMedium> pBootableBaseMedium; 891 // returns pBootableMedium if there are no diff images 892 rc = ptrSourceDisk->COMGETTER(Base)(pBootableBaseMedium.asOutParam()); 893 if (FAILED(rc)) 894 throw rc; 895 896 //Get base bootable disk location 897 Bstr bstrBootLocation; 898 rc = pBootableBaseMedium->COMGETTER(Location)(bstrBootLocation.asOutParam()); 899 if (FAILED(rc)) throw rc; 900 Utf8Str strBootLocation = bstrBootLocation; 901 902 skipped = vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage); 903 itSkipped = skipped.begin(); 904 while (itSkipped != skipped.end()) 905 { 906 Utf8Str path = (*itSkipped)->strVBoxCurrent; 907 // Locate the Medium object for this entry (by location/path). 908 Log(("Finding disk \"%s\"\n", path.c_str())); 909 rc = mVirtualBox->i_findHardDiskByLocation(path, true , &ptrSourceDisk); 910 if (FAILED(rc)) 911 throw rc; 912 913 if (!path.equalsIgnoreCase(strBootLocation)) 914 (*itSkipped)->skipIt = true; 915 876 916 ++itSkipped; 877 917 } 918 919 //just in case 920 if (vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskImage).empty()) 921 { 922 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 923 tr("Strange, but nothing to export to OCI after preparation steps")); 924 } 925 926 /* 927 * Fills out the OCI settings 928 */ 929 std::list<VirtualSystemDescriptionEntry*> machineName = 930 vsdescThis->i_findByType(VirtualSystemDescriptionType_Name); 931 if (machineName.empty()) 932 throw setError(VBOX_E_FILE_ERROR, tr("OCI: VM name wasn't found")); 933 m->m_OciExportData.strDisplayMachineName = machineName.front()->strVBoxCurrent; 934 LogRel(("Exported machine name: %s\n", m->m_OciExportData.strDisplayMachineName.c_str())); 935 936 m->m_OciExportData.strBootImageName = strBootLocation; 937 LogRel(("Exported image: %s\n", m->m_OciExportData.strBootImageName.c_str())); 938 939 if (aLocInfo.strPath.isEmpty()) 940 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 941 tr("OCI: Cloud user profile wasn't found")); 942 943 m->m_OciExportData.strProfileName = aLocInfo.strPath; 944 LogRel(("OCI profile name: %s\n", m->m_OciExportData.strProfileName.c_str())); 945 946 Utf8Str strInstanceShapeId; 947 std::list<VirtualSystemDescriptionEntry*> shapeId = 948 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIInstanceShape); 949 if (shapeId.empty()) 950 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 951 tr("OCI: Shape of instance wasn't found")); 952 953 m->m_OciExportData.strInstanceShapeId = shapeId.front()->strVBoxCurrent; 954 LogRel(("OCI shape: %s\n", m->m_OciExportData.strInstanceShapeId.c_str())); 955 956 std::list<VirtualSystemDescriptionEntry*> domainName = 957 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIDomain); 958 if (domainName.empty()) 959 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 960 tr("OCI: Available domain wasn't found")); 961 962 m->m_OciExportData.strDomainName = domainName.front()->strVBoxCurrent; 963 LogRel(("OCI available domain name: %s\n", m->m_OciExportData.strDomainName.c_str())); 964 965 std::list<VirtualSystemDescriptionEntry*> bootDiskSize = 966 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIBootDiskSize); 967 if (bootDiskSize.empty()) 968 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 969 tr("OCI: Boot disk size wasn't found")); 970 971 m->m_OciExportData.strBootDiskSize = bootDiskSize.front()->strVBoxCurrent; 972 LogRel(("OCI boot disk size: %s\n", m->m_OciExportData.strBootDiskSize.c_str())); 973 974 std::list<VirtualSystemDescriptionEntry*> bucketId = 975 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIBucket); 976 if (bucketId.empty()) 977 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 978 tr("OCI: Bucket wasn't found")); 979 980 m->m_OciExportData.strBucketId = bucketId.front()->strVBoxCurrent; 981 LogRel(("OCI bucket name: %s\n", m->m_OciExportData.strBucketId.c_str())); 982 983 std::list<VirtualSystemDescriptionEntry*> vcn = 984 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIVCN); 985 if (vcn.empty()) 986 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 987 tr("OCI: VCN wasn't found")); 988 989 m->m_OciExportData.strVCN = vcn.front()->strVBoxCurrent; 990 LogRel(("OCI VCN name: %s\n", m->m_OciExportData.strVCN.c_str())); 991 992 std::list<VirtualSystemDescriptionEntry*> publicIP = 993 vsdescThis->i_findByType(VirtualSystemDescriptionType_CloudOCIPublicIP); 994 if (publicIP.empty()) 995 throw rc = setError(VBOX_E_OBJECT_NOT_FOUND, 996 tr("OCI: Public IP setting wasn't found")); 997 998 m->m_OciExportData.fPublicIP = (publicIP.front()->strVBoxCurrent == "true") ? true : false; 999 LogRel(("OCI public IP: %s\n", m->m_OciExportData.fPublicIP ? "yes" : "no")); 878 1000 } 879 1001 … … 2248 2370 HRESULT Appliance::i_writeFSOCI(TaskOCI *pTask) 2249 2371 { 2372 RT_NOREF(pTask); // XXX 2250 2373 LogFlowFuncEnter(); 2251 RT_NOREF(pTask);2252 2374 HRESULT hrc = S_OK; 2253 2375 //int vrc = VINF_SUCCESS; 2376 ComPtr<ICloudProviderManager> cpm; 2377 hrc = mVirtualBox->COMGETTER(CloudProviderManager)(cpm.asOutParam()); 2378 2379 Utf8Str strProviderName("OCI"); 2380 ComPtr<ICloudProvider> ociProfile; 2381 hrc = cpm->GetProviderByShortName(Bstr(strProviderName.c_str()).raw(), ociProfile.asOutParam()); 2382 // initNew(VirtualBox *aVirtualBox, 2383 // OCIProvider *aParent, 2384 // const com::Utf8Str &aProfileName, 2385 // const std::vector<com::Utf8Str> &aNames, 2386 // const std::vector<com::Utf8Str> &aValues) 2387 2388 // hrc = cpm.i_getProfilesByProvider("OCI", ociProfiles); 2389 // if (FAILED(hrc) || ociProfiles.isNull()) 2390 // return hrc; 2391 2392 //fills by values from m->m_OciExportData 2393 //mostly all names(keys) come from official OCI API documentation (see LaunchInstance description) 2394 std::map<Utf8Str, Utf8Str> paramNameValueMap; 2395 paramNameValueMap.insert(make_pair("displayName", m->m_OciExportData.strDisplayMachineName)); 2396 paramNameValueMap.insert(make_pair("objectName", m->m_OciExportData.strBootImageName)); 2397 paramNameValueMap.insert(make_pair("vcnId", m->m_OciExportData.strVCN)); 2398 paramNameValueMap.insert(make_pair("bucketName", m->m_OciExportData.strBucketId)); 2399 paramNameValueMap.insert(make_pair("bootVolumeSizeInGBs", m->m_OciExportData.strBootDiskSize)); 2400 paramNameValueMap.insert(make_pair("availabilityDomain", m->m_OciExportData.strDomainName)); 2401 paramNameValueMap.insert(make_pair("shape", m->m_OciExportData.strInstanceShapeId)); 2402 paramNameValueMap.insert(make_pair("profileName", m->m_OciExportData.strProfileName)); 2403 paramNameValueMap.insert(make_pair("assignPublicIp", (m->m_OciExportData.fPublicIP == true) ? "true" : "false")); 2404 2405 com::SafeArray<CloudCommand_T> commandList; 2406 /* 2407 ComObjPtr<ICloudClient> aCloudClient; 2408 hrc = ociProfiles->CreateCloudClient(Bstr(m->m_OciExportData.strProfileName).raw(), aCloudClient.asOutParam()); 2409 2410 if (SUCCEEDED(hrc)) 2411 { 2412 try 2413 { 2414 CloudClient *client = static_cast<CloudClient*>(aCloudClient.operator->()); 2415 2416 hrc = aCloudClient->GetCommandsForOperation(CloudOperation_exportVM, false, 2417 ComSafeArrayAsOutParam(commandList)); 2418 if (SUCCEEDED(hrc)) 2419 { 2420 std::vector<com::Guid> commandIdList; 2421 2422 for (ULONG i = 0; i < commandList.size(); i++) 2423 { 2424 CloudCommand_T cmd = commandList[i]; 2425 Bstr bStrId; 2426 hrc = aCloudClient->CreateCommand(cmd, bStrId.asOutParam()); 2427 2428 if (SUCCEEDED(hrc)) 2429 { 2430 com::Guid cId(bStrId); 2431 //set conditions 2432 { 2433 CloudCommandCl *cc = NULL; 2434 vrc = client->i_getCommandById(cId, &cc); 2435 if (RT_SUCCESS(vrc)) 2436 { 2437 switch(cmd) 2438 { 2439 case CloudCommand_getImage: 2440 case CloudCommand_getSubnet: 2441 vrc = cc->setCondition(new oci::LifecycleStateCondition(Utf8Str("AVAILABLE"))); 2442 break; 2443 case CloudCommand_getInstance: 2444 vrc = cc->setCondition(new oci::LifecycleStateCondition(Utf8Str("RUNNING"))); 2445 break; 2446 default: 2447 break; 2448 } 2449 if (RT_FAILURE(vrc)) 2450 { 2451 hrc = E_FAIL; 2452 break; 2453 } 2454 2455 } 2456 else 2457 { 2458 hrc = E_FAIL; 2459 break; 2460 } 2461 } 2462 2463 commandIdList.push_back(cId);//fills the Id list 2464 } 2465 } 2466 2467 if (SUCCEEDED(hrc)) 2468 vrc = client->i_runSeveralCommands(commandIdList, paramNameValueMap); 2469 } 2470 } 2471 catch (HRESULT arc) 2472 { 2473 hrc = arc; 2474 } 2475 catch (...) 2476 { 2477 LogRel(("Appliance::i_writeFSOCI(): get cought unknown exception\n")); 2478 } 2479 2480 aCloudClient.setNull(); 2481 } 2482 */ 2483 LogFlowFuncLeave(); 2254 2484 return hrc; 2255 2485 }
Note:
See TracChangeset
for help on using the changeset viewer.

