VirtualBox

Changeset 79605 in vbox


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.

Location:
trunk/src/VBox
Files:
2 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;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r79585 r79605  
    2601126011  <interface
    2601226012    name="ICloudClient" extends="$unknown"
    26013     uuid="361276ab-3be4-4a1a-abf2-2993048766c4"
     26013    uuid="7ec55937-3152-4e06-8192-c3828aadc7ab"
    2601426014    wsmap="managed" reservedMethods="16" reservedAttributes="8"
    2601526015    >
     
    2615726157    <method name="importInstance">
    2615826158      <desc>
    26159         Import an existing instance with passed id to the local host.
     26159        Import an existing cloud instance to the local host.
     26160        All needed parameters are passed in the description (VSD).
    2616026161      </desc>
    2616126162      <param name="description" type="IVirtualSystemDescription" dir="in">
    2616226163        <desc>VirtualSystemDescription object which is describing a machine and all required parameters.</desc>
    26163       </param>
    26164       <param name="uid" type="wstring" dir="in">
    26165         <desc>the id of instance imported from the Cloud.</desc>
    2616626164      </param>
    2616726165      <param name="virtualBox" type="IVirtualBox" dir="in">
     
    2628126279        <desc>Reference to the existing VBox image.</desc>
    2628226280      </param>
     26281      <param name="virtualBox" type="IVirtualBox" dir="in">
     26282        <desc>Reference to the server-side API root object.</desc>
     26283      </param>
     26284      <param name="parameters" type="wstring" dir="in" safearray="yes">
     26285        <desc>Each parameter in the array must be in the form "name=value".</desc>
     26286      </param>
     26287      <param name="progress" type="IProgress" dir="return">
     26288        <desc>Progress object to track the operation completion.</desc>
     26289      </param>
     26290    </method>
     26291
     26292    <method name="importImage">
     26293      <desc>
     26294        Import an existing image in the Cloud into the VirtualBox.
     26295      </desc>
    2628326296      <param name="virtualBox" type="IVirtualBox" dir="in">
    2628426297        <desc>Reference to the server-side API root object.</desc>
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