Changeset 85219 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jul 11, 2020 2:28:23 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 139196
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r84535 r85219 1223 1223 { 1224 1224 Utf8Str strBasename(pTask->locInfo.strPath); 1225 RTCList<RTCString, RTCString *> parts = strBasename.split("/" 1225 RTCList<RTCString, RTCString *> parts = strBasename.split("/"); 1226 1226 if (parts.size() != 2)//profile + instance id 1227 { 1228 return setErrorVrc(VERR_MISMATCH, tr("%s: The profile name or instance id are absent or" 1229 "contain unsupported characters.", __FUNCTION__)); 1230 } 1227 return setErrorVrc(VERR_MISMATCH, 1228 tr("%s: The profile name or instance id are absent or contain unsupported characters: %s"), 1229 __FUNCTION__, strBasename.c_str()); 1231 1230 1232 1231 //Get information about the passed cloud instance … … 1234 1233 hrc = mVirtualBox->COMGETTER(CloudProviderManager)(cpm.asOutParam()); 1235 1234 if (FAILED(hrc)) 1236 return setError Vrc(VERR_COM_OBJECT_NOT_FOUND, tr("%s: Cloud provider manager object wasn't found"), __FUNCTION__);1235 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud provider manager object wasn't found (%Rhrc)"), __FUNCTION__, hrc); 1237 1236 1238 1237 Utf8Str strProviderName = pTask->locInfo.strProvider; … … 1242 1241 1243 1242 if (FAILED(hrc)) 1244 return setError Vrc(VERR_COM_OBJECT_NOT_FOUND, tr("%s: Cloud provider object wasn't found"), __FUNCTION__);1243 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud provider object wasn't found (%Rhrc)"), __FUNCTION__, hrc); 1245 1244 1246 1245 Utf8Str profileName(parts.at(0));//profile 1247 1246 if (profileName.isEmpty()) 1248 return setError Vrc(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud user profile name wasn't found"), __FUNCTION__);1247 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud user profile name wasn't found (%Rhrc)"), __FUNCTION__, hrc); 1249 1248 1250 1249 hrc = cloudProvider->GetProfileByName(Bstr(parts.at(0)).raw(), cloudProfile.asOutParam()); 1251 1250 if (FAILED(hrc)) 1252 return setError Vrc(VERR_COM_OBJECT_NOT_FOUND, tr("%s: Cloud profile object wasn't found"), __FUNCTION__);1251 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud profile object wasn't found (%Rhrc)"), __FUNCTION__, hrc); 1253 1252 1254 1253 ComObjPtr<ICloudClient> cloudClient; 1255 1254 hrc = cloudProfile->CreateCloudClient(cloudClient.asOutParam()); 1256 1255 if (FAILED(hrc)) 1257 return setError Vrc(VERR_COM_OBJECT_NOT_FOUND, tr("%s: Cloud client object wasn't found"), __FUNCTION__);1256 return setError(VBOX_E_OBJECT_NOT_FOUND, tr("%s: Cloud client object wasn't found (%Rhrc)"), __FUNCTION__, hrc); 1258 1257 1259 1258 m->virtualSystemDescriptions.clear();//clear all for assurance before creating new … … 1264 1263 if (FAILED(hrc)) throw hrc; 1265 1264 if (requestedVSDnums != newVSDnums) 1266 throw setErrorVrc(VERR_MISMATCH, tr("%s: Requested and created numbers of VSD are differ."), __FUNCTION__); 1265 throw setErrorVrc(VERR_MISMATCH, tr("%s: Requested (%d) and created (%d) numbers of VSD are differ ."), 1266 __FUNCTION__, requestedVSDnums, newVSDnums); 1267 1267 1268 1268 hrc = getVirtualSystemDescriptions(vsdArray); … … 1279 1279 1280 1280 // set cloud profile 1281 instanceDescription->AddDescription(VirtualSystemDescriptionType_CloudProfileName, 1282 Bstr(profileName).raw(), 1283 NULL); 1281 instanceDescription->AddDescription(VirtualSystemDescriptionType_CloudProfileName, Bstr(profileName).raw(), NULL); 1284 1282 1285 1283 Utf8StrFmt strSetting("VM with id %s imported from the cloud provider %s", 1286 1284 parts.at(1).c_str(), strProviderName.c_str()); 1287 1285 // set description 1288 instanceDescription->AddDescription(VirtualSystemDescriptionType_Description, 1289 Bstr(strSetting).raw(), 1290 NULL); 1286 instanceDescription->AddDescription(VirtualSystemDescriptionType_Description, Bstr(strSetting).raw(), NULL); 1291 1287 } 1292 1288 catch (HRESULT arc) … … 1920 1916 { 1921 1917 hrc = aRc; 1922 strLastActualErrorDesc = Utf8StrFmt("%s: Processing the downloaded object was failed. "1923 "The exception (%Rrc)\n",__FUNCTION__, hrc);1918 strLastActualErrorDesc.printf("%s: Processing the downloaded object was failed. The exception (%Rhrc)\n", 1919 __FUNCTION__, hrc); 1924 1920 LogRel((strLastActualErrorDesc.c_str())); 1925 1921 } … … 1927 1923 { 1928 1924 hrc = setErrorVrc(aRc); 1929 strLastActualErrorDesc = Utf8StrFmt("%s: Processing the downloaded object was failed. "1930 "The exception (%Rrc)\n", __FUNCTION__, aRc);1925 strLastActualErrorDesc.printf("%s: Processing the downloaded object was failed. The exception (%Rrc/%Rhrc)\n", 1926 __FUNCTION__, aRc, hrc); 1931 1927 LogRel((strLastActualErrorDesc.c_str())); 1932 1928 } 1933 1929 catch (...) 1934 1930 { 1935 hrc = VERR_UNEXPECTED_EXCEPTION;1936 strLastActualErrorDesc = Utf8StrFmt("%s: Processing the downloaded object was failed. "1937 "The exception (%Rrc)\n",__FUNCTION__, hrc);1931 hrc = setErrorVrc(VERR_UNEXPECTED_EXCEPTION); 1932 strLastActualErrorDesc.printf("%s: Processing the downloaded object was failed. The exception (VERR_UNEXPECTED_EXCEPTION/%Rhrc)\n", 1933 __FUNCTION__, hrc); 1938 1934 LogRel((strLastActualErrorDesc.c_str())); 1939 1935 } … … 1955 1951 hrc = mVirtualBox->i_findHardDiskByLocation(strAbsDstPath, false, NULL); 1956 1952 if (SUCCEEDED(hrc)) 1957 throw setError (VERR_ALREADY_EXISTS, tr("The hard disk '%s' already exists."), strAbsDstPath.c_str());1953 throw setErrorVrc(VERR_ALREADY_EXISTS, tr("The hard disk '%s' already exists."), strAbsDstPath.c_str()); 1958 1954 1959 1955 /* Create an IMedium object. */ … … 1978 1974 1979 1975 hrc = pProgressImportTmp->init(mVirtualBox, 1980 static_cast<IAppliance*>(this), 1981 Utf8StrFmt(tr("Importing medium '%s'"), 1982 pszName), 1983 TRUE); 1976 static_cast<IAppliance*>(this), 1977 Utf8StrFmt(tr("Importing medium '%s'"), pszName), 1978 TRUE); 1984 1979 if (FAILED(hrc)) 1985 1980 throw hrc; … … 2016 2011 d.strHref = pTargetMedium->i_getLocationFull(); 2017 2012 d.strFormat = pTargetMedium->i_getFormat(); 2018 d.iSize = pTargetMedium->i_getSize();2013 d.iSize = (int64_t)pTargetMedium->i_getSize(); 2019 2014 d.ulSuggestedSizeMB = (uint32_t)(d.iSize/_1M); 2020 2015 … … 2071 2066 { 2072 2067 hrc = aRc; 2073 strLastActualErrorDesc = Utf8StrFmt("%s: Cloud import (local phase) failed. "2074 "The exception (%Rrc)\n",__FUNCTION__, hrc);2068 strLastActualErrorDesc.printf("%s: Cloud import (local phase) failed. The exception (%Rhrc)\n", 2069 __FUNCTION__, hrc); 2075 2070 LogRel((strLastActualErrorDesc.c_str())); 2076 2071 } … … 2078 2073 { 2079 2074 hrc = setErrorVrc(aRc); 2080 strLastActualErrorDesc = Utf8StrFmt("%s: Cloud import (local phase) failed. "2081 "The exception (%Rrc)\n", __FUNCTION__, aRc);2075 strLastActualErrorDesc.printf("%s: Cloud import (local phase) failed. The exception (%Rrc/%Rhrc)\n", 2076 __FUNCTION__, aRc, hrc); 2082 2077 LogRel((strLastActualErrorDesc.c_str())); 2083 2078 } 2084 2079 catch (...) 2085 2080 { 2086 hrc = VERR_UNRESOLVED_ERROR;2087 strLastActualErrorDesc = Utf8StrFmt("%s: Cloud import (local phase) failed. "2088 "The exception (%Rrc)\n",__FUNCTION__, hrc);2081 hrc = setErrorVrc(VERR_UNRESOLVED_ERROR); 2082 strLastActualErrorDesc.printf("%s: Cloud import (local phase) failed. The exception (VERR_UNRESOLVED_ERROR/%Rhrc)\n", 2083 __FUNCTION__, hrc); 2089 2084 LogRel((strLastActualErrorDesc.c_str())); 2090 2085 } … … 2312 2307 */ 2313 2308 char *pszNameBuf = (char *)alloca(pTask->locInfo.strPath.length() + 16); 2314 AssertReturn(pszNameBuf, VERR_NO_TMP_MEMORY);2309 AssertReturn(pszNameBuf, E_OUTOFMEMORY); 2315 2310 memcpy(pszNameBuf, pTask->locInfo.strPath.c_str(), pTask->locInfo.strPath.length() + 1); 2316 2311 RTPathStripSuffix(pszNameBuf); … … 2667 2662 const char *pszSuffix = strrchr(pszSubFileNm, '.'); 2668 2663 AssertReturn(pszSuffix, E_FAIL); 2669 strManifestName = Utf8Str(pszSubFileNm, pszSuffix - pszSubFileNm);2664 strManifestName = Utf8Str(pszSubFileNm, (size_t)(pszSuffix - pszSubFileNm)); 2670 2665 strManifestName.append(".mf"); 2671 2666 } … … 2732 2727 { 2733 2728 RTVFSIOSTREAM hVfsIosTmp; 2734 vrc = RTVfsIoStrmFromBuffer(RTFILE_O_READ, pvSignature, pszSplit - (char *)pvSignature, &hVfsIosTmp);2729 vrc = RTVfsIoStrmFromBuffer(RTFILE_O_READ, pvSignature, (size_t)(pszSplit - (char *)pvSignature), &hVfsIosTmp); 2735 2730 if (RT_SUCCESS(vrc)) 2736 2731 { … … 3920 3915 { 3921 3916 // secondary master 3922 lControllerPort = (long)1;3923 lDevice = (long)0;3917 lControllerPort = 1; 3918 lDevice = 0; 3924 3919 } 3925 3920 else // primary master 3926 3921 { 3927 lControllerPort = (long)0;3928 lDevice = (long)0;3922 lControllerPort = 0; 3923 lDevice = 0; 3929 3924 } 3930 break;3925 break; 3931 3926 3932 3927 case 1: // slave … … 3934 3929 { 3935 3930 // secondary slave 3936 lControllerPort = (long)1;3937 lDevice = (long)1;3931 lControllerPort = 1; 3932 lDevice = 1; 3938 3933 } 3939 3934 else // primary slave 3940 3935 { 3941 lControllerPort = (long)0;3942 lDevice = (long)1;3936 lControllerPort = 0; 3937 lDevice = 1; 3943 3938 } 3944 break;3939 break; 3945 3940 3946 3941 // used by older VBox exports 3947 3942 case 2: // interpret this as secondary master 3948 lControllerPort = (long)1;3949 lDevice = (long)0;3950 break;3943 lControllerPort = 1; 3944 lDevice = 0; 3945 break; 3951 3946 3952 3947 // used by older VBox exports 3953 3948 case 3: // interpret this as secondary slave 3954 lControllerPort = (long)1;3955 lDevice = (long)1;3956 break;3949 lControllerPort = 1; 3950 lDevice = 1; 3951 break; 3957 3952 3958 3953 default: 3959 3954 throw setError(VBOX_E_NOT_SUPPORTED, 3960 tr("Invalid channel %R I16specified; IDE controllers support only 0, 1 or 2"),3955 tr("Invalid channel %RU32 specified; IDE controllers support only 0, 1 or 2"), 3961 3956 ulAddressOnParent); 3962 break;3963 } 3964 break;3957 break; 3958 } 3959 break; 3965 3960 3966 3961 case ovf::HardDiskController::SATA: 3967 controllerName = "SATA";3968 lControllerPort = ( long)ulAddressOnParent;3969 lDevice = (long)0;3962 controllerName = "SATA"; 3963 lControllerPort = (int32_t)ulAddressOnParent; 3964 lDevice = 0; 3970 3965 break; 3971 3966 3972 3967 case ovf::HardDiskController::SCSI: 3973 3968 { 3974 if (hdc.strControllerType.compare("lsilogicsas")==0)3969 if (hdc.strControllerType.compare("lsilogicsas")==0) 3975 3970 controllerName = "SAS"; 3976 3971 else 3977 3972 controllerName = "SCSI"; 3978 lControllerPort = ( long)ulAddressOnParent;3979 lDevice = (long)0;3973 lControllerPort = (int32_t)ulAddressOnParent; 3974 lDevice = 0; 3980 3975 break; 3981 3976 } 3982 3977 3983 3978 case ovf::HardDiskController::VIRTIOSCSI: 3984 controllerName = "VirtioSCSI";3985 lControllerPort = ( long)ulAddressOnParent;3986 lDevice = (long)0;3979 controllerName = "VirtioSCSI"; 3980 lControllerPort = (int32_t)ulAddressOnParent; 3981 lDevice = 0; 3987 3982 break; 3988 3983
Note:
See TracChangeset
for help on using the changeset viewer.