VirtualBox

Changeset 79605 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 8, 2019 7:02:42 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
131907
Message:

bugre:9481. Added the API function ICloudClient::importImage(). Removed parameter uid from the function ICloudClient::importInstance(). The instance id must be presented in the VSD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloud.cpp

    r79583 r79605  
    982982    static const RTGETOPTDEF s_aOptions[] =
    983983    {
    984         { "--compartment-id", 'c', RTGETOPT_REQ_STRING },
     984        { "--image-id",       'i', RTGETOPT_REQ_STRING },
    985985        { "--bucket-name",    'b', RTGETOPT_REQ_STRING },
    986         { "--object-name",    'o', RTGETOPT_REQ_STRING },
    987         { "--display-name",   'd', RTGETOPT_REQ_STRING }
    988     };
    989     RTGETOPTSTATE GetState;
    990     RTGETOPTUNION ValueUnion;
    991     int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0);
    992     AssertRCReturn(vrc, RTEXITCODE_FAILURE);
    993 
     986        { "--object-name",    'o', RTGETOPT_REQ_STRING }
     987    };
     988    RTGETOPTSTATE GetState;
     989    RTGETOPTUNION ValueUnion;
     990    int vrc = RTGetOptInit(&GetState, a->argc, a->argv, s_aOptions, RT_ELEMENTS(s_aOptions), iFirst, 0);
     991    AssertRCReturn(vrc, RTEXITCODE_FAILURE);
     992
     993    Utf8Str strImageId;
    994994    Utf8Str strCompartmentId;
    995995    Utf8Str strBucketName;
     
    10031003        switch (c)
    10041004        {
    1005             case 'c':
    1006                 strCompartmentId=ValueUnion.psz;
    1007                 Bstr(Utf8Str("compartment-id=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());
     1005            case 'i':
     1006                strImageId=ValueUnion.psz;
     1007                Bstr(Utf8Str("image-id=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());
    10081008                break;
    10091009            case 'b':
     
    10151015                Bstr(Utf8Str("object-name=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());
    10161016                break;
    1017             case 'd':
    1018                 strDisplayName=ValueUnion.psz;
    1019                 Bstr(Utf8Str("display-name=").append(ValueUnion.psz)).detachTo(parameters.appendedRaw());
    1020                 break;
    10211017            case VINF_GETOPT_NOT_OPTION:
    10221018                return errorUnknownSubcommand(ValueUnion.psz);
     
    10301026    pCloudProfile->COMGETTER(Name)(bstrProfileName.asOutParam());
    10311027
     1028    ComPtr<IVirtualBox> pVirtualBox = a->virtualBox;
     1029    Bstr bstrImageId;
    10321030    ComObjPtr<ICloudClient> oCloudClient;
    10331031    CHECK_ERROR2_RET(hrc, pCloudProfile,
    10341032                     CreateCloudClient(oCloudClient.asOutParam()),
    10351033                     RTEXITCODE_FAILURE);
    1036     RTPrintf("Creating cloud image \'%s\' from an object \'%s\'...\n", strDisplayName.c_str(), strObjectName.c_str());
     1034    RTPrintf("Creating an object \'%s\' from the cloud image \'%s\'...\n", strObjectName.c_str(), strImageId.c_str());
    10371035
    10381036    ComPtr<IProgress> progress;
    10391037    CHECK_ERROR2_RET(hrc, oCloudClient,
    1040                      CreateImage(ComSafeArrayAsInParam(parameters), progress.asOutParam()),
     1038                     ImportImage(pVirtualBox, ComSafeArrayAsInParam(parameters), progress.asOutParam()),
    10411039                     RTEXITCODE_FAILURE);
    10421040    hrc = showProgress(progress);
    1043     CHECK_PROGRESS_ERROR_RET(progress, ("Cloud image creation failed"), RTEXITCODE_FAILURE);
     1041    CHECK_PROGRESS_ERROR_RET(progress, ("Cloud image import failed"), RTEXITCODE_FAILURE);
    10441042
    10451043    if (SUCCEEDED(hrc))
    1046         RTPrintf("Cloud image was created successfully\n");
     1044    {
     1045        RTPrintf("Cloud image was imported successfully. Find the downloaded object with the name %s "
     1046                 "in the system temp folder (find the possible environment variables like TEMP, TMP and etc.)\n",
     1047                 strObjectName.c_str());
     1048    }
    10471049
    10481050    return SUCCEEDED(hrc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette