Changeset 75920 in vbox for trunk/src/VBox
- Timestamp:
- Dec 3, 2018 6:17:11 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp
r74778 r75920 917 917 case VirtualSystemDescriptionType_CloudOCIVCN: 918 918 case VirtualSystemDescriptionType_CloudOCIPublicIP: 919 case VirtualSystemDescriptionType_CloudOCIProfile Path:919 case VirtualSystemDescriptionType_CloudOCIProfileName: 920 920 case VirtualSystemDescriptionType_CloudOCISubnet: 921 921 case VirtualSystemDescriptionType_CloudOCIKeepObject: … … 1028 1028 { "--eulafile", 'E', RTGETOPT_REQ_STRING }, 1029 1029 { "--options", 'O', RTGETOPT_REQ_STRING }, 1030 { "--cloud", 'C', RTGETOPT_REQ_UINT32 }, 1031 { "--cloudshape", 'S', RTGETOPT_REQ_STRING }, 1032 { "--clouddomain", 'D', RTGETOPT_REQ_STRING }, 1033 { "--clouddisksize", 'R', RTGETOPT_REQ_STRING }, 1034 { "--cloudbucket", 'B', RTGETOPT_REQ_STRING }, 1035 { "--cloudocivcn", 'Q', RTGETOPT_REQ_STRING }, 1036 { "--cloudpublicip", 'A', RTGETOPT_REQ_STRING }, 1037 { "--cloudprofile", 'F', RTGETOPT_REQ_STRING }, 1038 { "--cloudocisubnet", 'T', RTGETOPT_REQ_STRING }, 1039 { "--cloudkeepobject", 'K', RTGETOPT_REQ_STRING }, 1040 { "--cloudlaunchinstance", 'L', RTGETOPT_REQ_STRING }, 1030 1041 }; 1042 1043 enum 1044 { 1045 NOT_SET, LOCAL, CLOUD 1046 } exportType; 1031 1047 1032 1048 RTEXITCODE handleExportAppliance(HandlerArg *a) … … 1037 1053 Utf8Str strOvfFormat("ovf-1.0"); // the default export version 1038 1054 bool fManifest = false; // the default 1055 bool fCloud = false; // the default 1056 exportType = NOT_SET; 1039 1057 bool fExportISOImages = false; // the default 1040 1058 com::SafeArray<ExportOptions_T> options; … … 1091 1109 1092 1110 case 's': // --vsys 1111 if (fCloud == false && exportType == NOT_SET) 1112 exportType = LOCAL; 1113 1114 if (exportType != LOCAL) 1115 return errorSyntax(USAGE_EXPORTAPPLIANCE, 1116 "Option \"%s\" can't be used together with \"--cloud\" argument.", 1117 GetState.pDef->pszLong); 1118 1093 1119 ulCurVsys = ValueUnion.u32; 1094 1120 break; 1095 1121 1096 1122 case 'V': // --vmname 1097 if ( ulCurVsys == (uint32_t)-1)1123 if (exportType == NOT_SET || ulCurVsys == (uint32_t)-1) 1098 1124 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1099 1125 mapArgsMapsPerVsys[ulCurVsys]["vmname"] = ValueUnion.psz; … … 1101 1127 1102 1128 case 'p': // --product 1103 if ( ulCurVsys == (uint32_t)-1)1129 if (exportType != LOCAL) 1104 1130 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1105 1131 mapArgsMapsPerVsys[ulCurVsys]["product"] = ValueUnion.psz; … … 1107 1133 1108 1134 case 'P': // --producturl 1109 if ( ulCurVsys == (uint32_t)-1)1135 if (exportType != LOCAL) 1110 1136 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1111 1137 mapArgsMapsPerVsys[ulCurVsys]["producturl"] = ValueUnion.psz; … … 1113 1139 1114 1140 case 'n': // --vendor 1115 if ( ulCurVsys == (uint32_t)-1)1141 if (exportType != LOCAL) 1116 1142 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1117 1143 mapArgsMapsPerVsys[ulCurVsys]["vendor"] = ValueUnion.psz; … … 1119 1145 1120 1146 case 'N': // --vendorurl 1121 if ( ulCurVsys == (uint32_t)-1)1147 if (exportType != LOCAL) 1122 1148 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1123 1149 mapArgsMapsPerVsys[ulCurVsys]["vendorurl"] = ValueUnion.psz; … … 1125 1151 1126 1152 case 'v': // --version 1127 if ( ulCurVsys == (uint32_t)-1)1153 if (exportType != LOCAL) 1128 1154 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1129 1155 mapArgsMapsPerVsys[ulCurVsys]["version"] = ValueUnion.psz; … … 1131 1157 1132 1158 case 'd': // --description 1133 if ( ulCurVsys == (uint32_t)-1)1159 if (exportType != LOCAL) 1134 1160 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1135 1161 mapArgsMapsPerVsys[ulCurVsys]["description"] = ValueUnion.psz; … … 1137 1163 1138 1164 case 'e': // --eula 1139 if ( ulCurVsys == (uint32_t)-1)1165 if (exportType != LOCAL) 1140 1166 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1141 1167 mapArgsMapsPerVsys[ulCurVsys]["eula"] = ValueUnion.psz; … … 1143 1169 1144 1170 case 'E': // --eulafile 1145 if ( ulCurVsys == (uint32_t)-1)1171 if (exportType != LOCAL) 1146 1172 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --vsys argument.", GetState.pDef->pszLong); 1147 1173 mapArgsMapsPerVsys[ulCurVsys]["eulafile"] = ValueUnion.psz; … … 1151 1177 if (RT_FAILURE(parseExportOptions(ValueUnion.psz, &options))) 1152 1178 return errorArgument("Invalid export options '%s'\n", ValueUnion.psz); 1179 break; 1180 1181 /*--cloud and --vsys are orthogonal, only one must be presented*/ 1182 case 'C': // --cloud 1183 if (fCloud == false && exportType == NOT_SET) 1184 { 1185 fCloud = true; 1186 exportType = CLOUD; 1187 } 1188 1189 if (exportType != CLOUD) 1190 return errorSyntax(USAGE_EXPORTAPPLIANCE, 1191 "Option \"%s\" can't be used together with \"--vsys\" argument.", 1192 GetState.pDef->pszLong); 1193 1194 ulCurVsys = ValueUnion.u32; 1195 break; 1196 1197 /* Cloud export settings */ 1198 case 'S': // --cloudshape 1199 if (exportType != CLOUD) 1200 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1201 GetState.pDef->pszLong); 1202 mapArgsMapsPerVsys[ulCurVsys]["cloudshape"] = ValueUnion.psz; 1203 break; 1204 1205 case 'D': // --clouddomain 1206 if (exportType != CLOUD) 1207 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1208 GetState.pDef->pszLong); 1209 mapArgsMapsPerVsys[ulCurVsys]["clouddomain"] = ValueUnion.psz; 1210 break; 1211 1212 case 'R': // --clouddisksize 1213 if (exportType != CLOUD) 1214 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1215 GetState.pDef->pszLong); 1216 mapArgsMapsPerVsys[ulCurVsys]["clouddisksize"] = ValueUnion.psz; 1217 break; 1218 1219 case 'B': // --cloudbucket 1220 if (exportType != CLOUD) 1221 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1222 GetState.pDef->pszLong); 1223 mapArgsMapsPerVsys[ulCurVsys]["cloudbucket"] = ValueUnion.psz; 1224 break; 1225 1226 case 'Q': // --cloudocivcn 1227 if (exportType != CLOUD) 1228 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1229 GetState.pDef->pszLong); 1230 mapArgsMapsPerVsys[ulCurVsys]["cloudocivcn"] = ValueUnion.psz; 1231 break; 1232 1233 case 'A': // --cloudpublicip 1234 if (exportType != CLOUD) 1235 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1236 GetState.pDef->pszLong); 1237 mapArgsMapsPerVsys[ulCurVsys]["cloudpublicip"] = ValueUnion.psz; 1238 break; 1239 1240 case 'F': // --cloudprofile 1241 if (exportType != CLOUD) 1242 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1243 GetState.pDef->pszLong); 1244 mapArgsMapsPerVsys[ulCurVsys]["cloudprofile"] = ValueUnion.psz; 1245 break; 1246 1247 case 'T': // --cloudocisubnet 1248 if (exportType != CLOUD) 1249 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1250 GetState.pDef->pszLong); 1251 mapArgsMapsPerVsys[ulCurVsys]["cloudocisubnet"] = ValueUnion.psz; 1252 break; 1253 1254 case 'K': // --cloudkeepobject 1255 if (exportType != CLOUD) 1256 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1257 GetState.pDef->pszLong); 1258 mapArgsMapsPerVsys[ulCurVsys]["cloudkeepobject"] = ValueUnion.psz; 1259 break; 1260 1261 case 'L': // --cloudlaunchinstance 1262 if (exportType != CLOUD) 1263 return errorSyntax(USAGE_EXPORTAPPLIANCE, "Option \"%s\" requires preceding --cloud argument.", 1264 GetState.pDef->pszLong); 1265 mapArgsMapsPerVsys[ulCurVsys]["cloudlaunchinstance"] = ValueUnion.psz; 1153 1266 break; 1154 1267 … … 1213 1326 if (strOutputFile.startsWith("S3://", RTCString::CaseInsensitive) || 1214 1327 strOutputFile.startsWith("SunCloud://", RTCString::CaseInsensitive) || 1215 strOutputFile.startsWith("webdav://", RTCString::CaseInsensitive)) 1328 strOutputFile.startsWith("webdav://", RTCString::CaseInsensitive) || 1329 strOutputFile.startsWith("OCI://", RTCString::CaseInsensitive)) 1216 1330 pszAbsFilePath = RTStrDup(strOutputFile.c_str()); 1217 1331 else … … 1227 1341 ComPtr<IVirtualSystemDescription> pVSD; 1228 1342 CHECK_ERROR_BREAK(pMachine, ExportTo(pAppliance, Bstr(pszAbsFilePath).raw(), pVSD.asOutParam())); 1343 1229 1344 // Add additional info to the virtual system description if the user wants so 1230 1345 ArgsMap *pmapArgs = NULL; … … 1240 1355 { 1241 1356 if (itD->first == "vmname") 1357 { 1358 //remove default value if user has specified new name (default value is set in the ExportTo()) 1359 pVSD->RemoveDescriptionByType(VirtualSystemDescriptionType_Name); 1242 1360 pVSD->AddDescription(VirtualSystemDescriptionType_Name, 1243 1361 Bstr(itD->second).raw(), 1244 1362 Bstr(itD->second).raw()); 1363 } 1245 1364 else if (itD->first == "product") 1246 1365 pVSD->AddDescription(VirtualSystemDescriptionType_Product, … … 1292 1411 } 1293 1412 } 1413 /* add cloud export settings */ 1414 else if (itD->first == "cloudshape") 1415 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIInstanceShape, 1416 Bstr(itD->second).raw(), 1417 Bstr(itD->second).raw()); 1418 else if (itD->first == "clouddomain") 1419 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIDomain, 1420 Bstr(itD->second).raw(), 1421 Bstr(itD->second).raw()); 1422 else if (itD->first == "clouddisksize") 1423 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIBootDiskSize, 1424 Bstr(itD->second).raw(), 1425 Bstr(itD->second).raw()); 1426 else if (itD->first == "cloudbucket") 1427 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIBucket, 1428 Bstr(itD->second).raw(), 1429 Bstr(itD->second).raw()); 1430 else if (itD->first == "cloudocivcn") 1431 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIVCN, 1432 Bstr(itD->second).raw(), 1433 Bstr(itD->second).raw()); 1434 else if (itD->first == "cloudpublicip") 1435 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIPublicIP, 1436 Bstr(itD->second).raw(), 1437 Bstr(itD->second).raw()); 1438 else if (itD->first == "cloudprofile") 1439 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIProfileName, 1440 Bstr(itD->second).raw(), 1441 Bstr(itD->second).raw()); 1442 else if (itD->first == "cloudocisubnet") 1443 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCISubnet, 1444 Bstr(itD->second).raw(), 1445 Bstr(itD->second).raw()); 1446 else if (itD->first == "cloudkeepobject") 1447 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCIKeepObject, 1448 Bstr(itD->second).raw(), 1449 Bstr(itD->second).raw()); 1450 else if (itD->first == "cloudlaunchinstance") 1451 pVSD->AddDescription(VirtualSystemDescriptionType_CloudOCILaunchInstance, 1452 Bstr(itD->second).raw(), 1453 Bstr(itD->second).raw()); 1294 1454 } 1295 1455 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r75918 r75920 774 774 " [--eula <license text>]\n" 775 775 " [--eulafile <filename>]\n" 776 " [--cloud <number of virtual system>]\n" 777 " [--vmname <name>]\n" 778 " [--cloudprofile <cloud profile name>]\n" 779 " [--cloudshape <shape>]\n" 780 " [--clouddomain <domain>]\n" 781 " [--clouddisksize <disk size>]\n" 782 " [--cloudbucket <bucket name>]\n" 783 " [--cloudocivcn <OCI vcn id>]\n" 784 " [--cloudocisubnet <OCI subnet id>]\n" 785 " [--cloudkeepobject <true/false>]\n" 786 " [--cloudlaunchinstance <true/false>]\n" 787 " [--cloudpublicip <true/false>]\n" 776 788 "\n", SEP); 777 789 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r75919 r75920 3646 3646 <const name="CloudOCIVCN" value="31" /> 3647 3647 <const name="CloudOCIPublicIP" value="32" /> 3648 <const name="CloudOCIProfile Path" value="33" />3648 <const name="CloudOCIProfileName" value="33" /> 3649 3649 <const name="CloudOCISubnet" value="34" /> 3650 3650 <const name="CloudOCIKeepObject" value="35" /> … … 3852 3852 </method> 3853 3853 3854 <method name="removeDescriptionByType"> 3855 <desc>Delete all records which are equal to the passed type from the list</desc> 3856 3857 <param name="type" type="VirtualSystemDescriptionType" dir="in"> 3858 <desc></desc> 3859 </param> 3860 </method> 3861 3854 3862 <method name="getValuesByType"> 3855 3863 <desc>This is the same as <link to="#getDescriptionByType" /> except that you can specify which -
trunk/src/VBox/Main/include/ApplianceImpl.h
r75766 r75920 320 320 const com::Utf8Str &aVBoxValue, 321 321 const com::Utf8Str &aExtraConfigValue); 322 HRESULT removeDescriptionByType(VirtualSystemDescriptionType_T aType); 322 323 void i_removeByType(VirtualSystemDescriptionType_T aType); 323 324 -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r75766 r75920 54 54 : storageType(VFSType_File) {} 55 55 VFSType_T storageType; /* Which type of storage should be handled */ 56 Utf8Str strProvider; /* cloud provider name in case of export/import to Cloud */ 56 57 Utf8Str strPath; /* File path for the import/export */ 57 58 Utf8Str strHostname; /* Hostname on remote storage locations (could be empty) */ … … 230 231 /** Number of passwords provided. */ 231 232 uint32_t m_cPwProvided; 232 233 struct CloudExportData_T {234 Utf8Str strDisplayMachineName;235 Utf8Str strProfileFilePath;236 Utf8Str strProfileName;237 Utf8Str strInstanceShapeId;238 Utf8Str strDomainName;239 Utf8Str strBootDiskSize;240 Utf8Str strBucketId;241 Utf8Str strSubnet;242 bool fPublicIP;243 Utf8Str strUserId;244 Utf8Str strBootImageName;245 };246 247 CloudExportData_T m_CloudExportData;248 233 }; 249 234 -
trunk/src/VBox/Main/src-server/ApplianceImpl.cpp
r75766 r75920 1336 1336 { 1337 1337 locInfo.storageType = VFSType_Cloud; 1338 locInfo.strProvider = "OCI"; 1338 1339 strUri = strUri.substr(sizeof("OCI://") - 1); 1339 1340 } … … 1628 1629 } 1629 1630 1631 HRESULT VirtualSystemDescription::removeDescriptionByType(VirtualSystemDescriptionType_T aType) 1632 { 1633 std::vector<VirtualSystemDescriptionEntry>::iterator it = m->maDescriptions.begin(); 1634 while (it != m->maDescriptions.end()) 1635 { 1636 if (it->type == aType) 1637 it = m->maDescriptions.erase(it); 1638 else 1639 ++it; 1640 } 1641 1642 return S_OK; 1643 } 1644 1630 1645 /* Private method; delete all records from the list 1631 1646 * m->llDescriptions that match the given type.
Note:
See TracChangeset
for help on using the changeset viewer.