Changeset 93072 in vbox for trunk/src/VBox
- Timestamp:
- Dec 24, 2021 12:34:26 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r92786 r93072 1357 1357 * uses only the previously locally declared variable names 1358 1358 * set hrc as the result of operation 1359 * 1360 * What the above description fail to say is that this returns: 1361 * - retTypes 1362 * - aRefs 1363 * - aOvfValues 1364 * - aVBoxValues 1365 * - aExtraConfigValues 1359 1366 */ 1360 #define GET_VSD_DESCRIPTION_BY_TYPE(aParamType) \ 1361 retTypes.setNull(); \ 1362 aRefs.setNull(); \ 1363 aOvfValues.setNull(); \ 1364 aVBoxValues.setNull(); \ 1365 aExtraConfigValues.setNull(); \ 1366 vsd->GetDescriptionByType(aParamType, \ 1367 ComSafeArrayAsOutParam(retTypes), \ 1368 ComSafeArrayAsOutParam(aRefs), \ 1369 ComSafeArrayAsOutParam(aOvfValues), \ 1370 ComSafeArrayAsOutParam(aVBoxValues), \ 1371 ComSafeArrayAsOutParam(aExtraConfigValues)); \ 1372 1373 1374 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudProfileName) 1367 /** @todo r=bird: The setNull calls here are implicit in ComSafeArraySasOutParam, 1368 * so we're doing twice here for no good reason! Btw. very untidy to not wrap 1369 * this in do { } while (0) and require ';' when used. */ 1370 #define GET_VSD_DESCRIPTION_BY_TYPE(aParamType) do { \ 1371 retTypes.setNull(); \ 1372 aRefs.setNull(); \ 1373 aOvfValues.setNull(); \ 1374 aVBoxValues.setNull(); \ 1375 aExtraConfigValues.setNull(); \ 1376 vsd->GetDescriptionByType(aParamType, \ 1377 ComSafeArrayAsOutParam(retTypes), \ 1378 ComSafeArrayAsOutParam(aRefs), \ 1379 ComSafeArrayAsOutParam(aOvfValues), \ 1380 ComSafeArrayAsOutParam(aVBoxValues), \ 1381 ComSafeArrayAsOutParam(aExtraConfigValues)); \ 1382 } while (0) 1383 1384 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudProfileName); 1375 1385 if (aVBoxValues.size() == 0) 1376 1386 return setErrorVrc(VERR_NOT_FOUND, tr("%s: Cloud user profile name wasn't found"), __FUNCTION__); … … 1398 1408 { 1399 1409 VBOXOSTYPE guestOsType = VBOXOSTYPE_Unknown; 1400 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_OS) //aVBoxValues is set in this #define1410 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_OS); //aVBoxValues is set in this #define 1401 1411 if (aVBoxValues.size() != 0) 1402 1412 { … … 1443 1453 1444 1454 { 1445 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Name) //aVBoxValues is set in this #define1455 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Name); //aVBoxValues is set in this #define 1446 1456 if (aVBoxValues.size() != 0)//paranoia but anyway... 1447 1457 strVMName = aVBoxValues[0]; … … 1506 1516 1507 1517 if (counter > 0) 1508 { 1509 return setErrorVrc(VERR_ALREADY_EXISTS, tr("The target folder %s has already contained some" 1510 " files (%d items). Clear the folder from the files or choose another folder"), 1511 strMachineFolder.c_str(), counter); 1512 } 1518 return setErrorVrc(VERR_ALREADY_EXISTS, 1519 tr("The target folder %s has already contained some files (%d items). Clear the folder from the files or choose another folder"), 1520 strMachineFolder.c_str(), counter); 1513 1521 } 1514 1522 } 1515 1523 1516 Utf8Str strInsId; 1517 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define 1524 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId); //aVBoxValues is set in this #define 1518 1525 if (aVBoxValues.size() == 0) 1519 1526 return setErrorVrc(VERR_NOT_FOUND, "%s: Cloud Instance Id wasn't found", __FUNCTION__); 1520 1527 1521 strInsId = aVBoxValues[0];1522 1523 LogRel (("%s: calling CloudClient::ImportInstance\n", __FUNCTION__));1528 Utf8Str strInsId = aVBoxValues[0]; 1529 1530 LogRelFunc(("calling CloudClient::ImportInstance\n")); 1524 1531 1525 1532 /* Here it's strongly supposed that cloud import produces ONE object on the disk. … … 1528 1535 * must be combined together into one object by cloud client. 1529 1536 * The most simple way is to create a TAR archive. */ 1530 hrc = cloudClient->ImportInstance(m->virtualSystemDescriptions.front(), 1531 pProgress); 1537 hrc = cloudClient->ImportInstance(m->virtualSystemDescriptions.front(), pProgress); 1532 1538 if (FAILED(hrc)) 1533 1539 { 1534 LogRel(("%s: Cloud import (cloud phase) failed. " 1535 "Used cloud instance is \'%s\'\n", __FUNCTION__, strInsId.c_str())); 1536 hrc = setError(hrc, tr("%s: Cloud import (cloud phase) failed. " 1537 "Used cloud instance is \'%s\'\n"), __FUNCTION__, strInsId.c_str()); 1540 LogRelFunc(("Cloud import (cloud phase) failed. Used cloud instance is \'%s\'\n", strInsId.c_str())); 1541 hrc = setError(hrc, tr("%s: Cloud import (cloud phase) failed. Used cloud instance is \'%s\'\n"), 1542 __FUNCTION__, strInsId.c_str()); 1538 1543 break; 1539 1544 } … … 1555 1560 HRESULT const hrcSaved = hrc; 1556 1561 1557 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId) //aVBoxValues is set in this #define1562 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId); //aVBoxValues is set in this #define 1558 1563 if (aVBoxValues.size() == 0) 1559 1564 hrc = setErrorVrc(VERR_NOT_FOUND, tr("%s: Cloud cleanup action - the instance wasn't found"), __FUNCTION__); … … 1614 1619 /* small explanation here, the image here points out to the whole downloaded object (not to the image only) 1615 1620 * filled during the first cloud import stage (in the ICloudClient::importInstance()) */ 1616 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage) //aVBoxValues is set in this #define1621 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage); //aVBoxValues is set in this #define 1617 1622 if (aVBoxValues.size() == 0) 1618 1623 hrc = setErrorVrc(VERR_NOT_FOUND, pszGeneralRollBackErrorMessage); … … 1662 1667 /* Small explanation here, the image here points out to the whole downloaded object (not to the image only) 1663 1668 * filled during the first cloud import stage (in the ICloudClient::importInstance()) */ 1664 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage) //aVBoxValues is set in this #define1669 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage); //aVBoxValues is set in this #define 1665 1670 if (aVBoxValues.size() == 0) 1666 1671 throw setErrorVrc(VERR_NOT_FOUND, "%s: The description of the downloaded object wasn't found", __FUNCTION__); … … 1692 1697 * The downloaded images should be converted to VDI/VMDK if they have another format */ 1693 1698 Utf8Str strInstId("default cloud instance id"); 1694 { 1695 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId)//aVBoxValues is set in this #define 1696 if (aVBoxValues.size() != 0)//paranoia but anyway... 1697 strInstId = aVBoxValues[0]; 1698 LogRel(("%s: Importing cloud instance %s\n", __FUNCTION__, strInstId.c_str())); 1699 } 1699 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CloudInstanceId); //aVBoxValues is set in this #define 1700 if (aVBoxValues.size() != 0)//paranoia but anyway... 1701 strInstId = aVBoxValues[0]; 1702 LogRel(("%s: Importing cloud instance %s\n", __FUNCTION__, strInstId.c_str())); 1700 1703 1701 1704 /* Processing the downloaded object (prepare for the local import) */ … … 1719 1722 uint32_t cpus = 1; 1720 1723 { 1721 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CPU) //aVBoxValues is set in this #define1724 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_CPU); //aVBoxValues is set in this #define 1722 1725 if (aVBoxValues.size() != 0) 1723 1726 { … … 1732 1735 pGuestOSType->COMGETTER(RecommendedRAM)(&memory); 1733 1736 { 1734 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory) //aVBoxValues is set in this #define1737 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Memory); //aVBoxValues is set in this #define 1735 1738 if (aVBoxValues.size() != 0) 1736 1739 { … … 1744 1747 1745 1748 { 1746 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Description) //aVBoxValues is set in this #define1749 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_Description); //aVBoxValues is set in this #define 1747 1750 if (aVBoxValues.size() != 0) 1748 1751 { … … 1754 1757 1755 1758 { 1756 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_OS) //aVBoxValues is set in this #define1759 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_OS); //aVBoxValues is set in this #define 1757 1760 if (aVBoxValues.size() != 0) 1758 1761 strOsType = aVBoxValues[0]; … … 1763 1766 ovf::EthernetAdapter ea; 1764 1767 { 1765 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_NetworkAdapter) //aVBoxValues is set in this #define1768 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_NetworkAdapter); //aVBoxValues is set in this #define 1766 1769 if (aVBoxValues.size() != 0) 1767 1770 { … … 1788 1791 hdc.strIdController = "0"; 1789 1792 1790 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskControllerSATA) //aVBoxValues is set in this #define1793 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskControllerSATA); //aVBoxValues is set in this #define 1791 1794 if (aVBoxValues.size() != 0) 1792 1795 hdc.strControllerType = (Utf8Str)(aVBoxValues[0]); … … 1807 1810 1808 1811 { 1809 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_SoundCard) //aVBoxValues is set in this #define1812 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_SoundCard); //aVBoxValues is set in this #define 1810 1813 if (aVBoxValues.size() != 0) 1811 1814 vsys.strSoundCardType = (Utf8Str)(aVBoxValues[0]); … … 2092 2095 * But it was the first record added into the list, so aVBoxValues[0] should be correct here. 2093 2096 */ 2094 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage) //aVBoxValues is set in this #define2097 GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskImage); //aVBoxValues is set in this #define 2095 2098 if (!fKeepDownloadedObject) 2096 2099 {
Note:
See TracChangeset
for help on using the changeset viewer.