VirtualBox

Changeset 79033 in vbox for trunk


Ignore:
Timestamp:
Jun 7, 2019 9:22:06 AM (6 years ago)
Author:
vboxsync
Message:

bugref:9404. Changed the command \'list instances\'. Now the requested states can be combined together in the array.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r78841 r79033  
    183183    com::SafeArray<BSTR> arrayVMIds;
    184184    ComPtr<IProgress> pProgress;
    185 
    186     RTPrintf("Getting a list of available cloud instances...\n");
     185    com::SafeArray<CloudMachineState_T> machimeStates;
     186
    187187    RTPrintf("Reply is in the form \'instance name\' = \'instance id\'\n");
     188
    188189    CHECK_ERROR2_RET(hrc, oCloudClient,
    189                      ListInstances(CloudMachineState_Running,
     190                     ListInstances(ComSafeArrayAsInParam(machimeStates),
    190191                                   pVMNamesHolder.asOutParam(),
    191192                                   pVMIdsHolder.asOutParam(),
     
    202203            RTEXITCODE_FAILURE);
    203204
    204     RTPrintf("List of running instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
     205    RTPrintf("List of instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
    205206             bstrProfileName.raw(), strCompartmentId.c_str());
    206207    size_t cIds = arrayVMIds.size();
     
    212213            value = arrayVMIds[k];
    213214        RTPrintf("\t%ls = %ls\n", arrayVMNames[k], value.raw());
    214     }
    215 
    216     pVMNamesHolder.setNull();
    217     pVMIdsHolder.setNull();
    218     arrayVMNames.setNull();
    219     arrayVMIds.setNull();
    220     pProgress.setNull();
    221     CHECK_ERROR2_RET(hrc, oCloudClient,
    222                      ListInstances(CloudMachineState_Stopped,
    223                                    pVMNamesHolder.asOutParam(),
    224                                    pVMIdsHolder.asOutParam(),
    225                                    pProgress.asOutParam()),
    226                      RTEXITCODE_FAILURE);
    227     showProgress(pProgress);
    228     CHECK_PROGRESS_ERROR_RET(pProgress, ("Failed to list instances"), RTEXITCODE_FAILURE);
    229 
    230     CHECK_ERROR2_RET(hrc,
    231         pVMNamesHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMNames)),
    232             RTEXITCODE_FAILURE);
    233     CHECK_ERROR2_RET(hrc,
    234         pVMIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMIds)),
    235             RTEXITCODE_FAILURE);
    236 
    237     RTPrintf("List of paused instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
    238              bstrProfileName.raw(), strCompartmentId.c_str());
    239     cNames = arrayVMNames.size();
    240     cIds = arrayVMIds.size();
    241     for (size_t k = 0; k < cNames; k++)
    242     {
    243         Bstr value;
    244         if (k < cIds)
    245             value = arrayVMIds[k];
    246         RTPrintf("\t%ls=%ls\n", arrayVMNames[k], value.raw());
    247215    }
    248216
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp

    r78892 r79033  
    321321
    322322            /* Stopped VM names and ids: */
    323             CStringArray comNamesStopped;
    324             CStringArray comIDsStopped;
    325 
    326             /* Ask for Stopped cloud VMs: */
    327             CProgress comProgressStopped = m_comCloudClient.ListInstances(KCloudMachineState_Stopped, comNamesStopped, comIDsStopped);
     323            CStringArray comNames;
     324            CStringArray comIDs;
     325            QVector<KCloudMachineState> comCloudMachineState;
     326
     327            CProgress comProgress= m_comCloudClient.ListInstances(comCloudMachineState, comNames, comIDs);
    328328            if (!m_comCloudClient.isOk())
    329329            {
     
    333333
    334334            /* Show "Acquire cloud instances" progress: */
    335             msgCenter().showModalProgressDialog(comProgressStopped, UIWizardImportApp::tr("Acquire stopped cloud instances..."),
     335            msgCenter().showModalProgressDialog(comProgress, UIWizardImportApp::tr("Acquire cloud instances..."),
    336336                                                ":/progress_reading_appliance_90px.png", 0, 0);
    337             if (!comProgressStopped.isOk() || comProgressStopped.GetResultCode() != 0)
    338             {
    339                 msgCenter().cannotAcquireCloudClientParameter(comProgressStopped);
    340                 break;
    341             }
    342 
    343             /* Running VM names and ids: */
    344             CStringArray comNamesRunning;
    345             CStringArray comIDsRunning;
    346 
    347             /* Ask for Running cloud VMs: */
    348             CProgress comProgressRunning = m_comCloudClient.ListInstances(KCloudMachineState_Running, comNamesRunning, comIDsRunning);
    349             if (!m_comCloudClient.isOk())
    350             {
    351                 msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient);
    352                 break;
    353             }
    354 
    355             /* Show "Acquire cloud instances" progress: */
    356             msgCenter().showModalProgressDialog(comProgressRunning, UIWizardImportApp::tr("Acquire running cloud instances..."),
    357                                                 ":/progress_reading_appliance_90px.png", 0, 0);
    358             if (!comProgressRunning.isOk() || comProgressRunning.GetResultCode() != 0)
    359             {
    360                 msgCenter().cannotAcquireCloudClientParameter(comProgressRunning);
     337            if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     338            {
     339                msgCenter().cannotAcquireCloudClientParameter(comProgress);
    361340                break;
    362341            }
    363342
    364343            /* Push acquired names to list rows: */
    365             const QVector<QString> names = comNamesStopped.GetValues() + comNamesRunning.GetValues();
    366             const QVector<QString> ids = comIDsStopped.GetValues() + comIDsRunning.GetValues();
     344            const QVector<QString> names = comNames.GetValues();
     345            const QVector<QString> ids = comIDs.GetValues();
    367346            for (int i = 0; i < names.size(); ++i)
    368347            {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r78996 r79033  
    2596125961  <interface
    2596225962    name="ICloudClient" extends="$unknown"
    25963     uuid="d1ac0b72-861a-11e9-a0cf-b38ea8ea9e63"
     25963    uuid="17a5ade9-d9ad-4723-8004-8f47d5d7a2cc"
    2596425964    wsmap="managed" reservedMethods="13" reservedAttributes="8"
    2596525965    >
     
    2603926039        Returns the list of the instances in the Cloud.
    2604026040      </desc>
    26041       <param name="machineState" type="CloudMachineState" dir="in"/>
     26041      <param name="machineState" type="CloudMachineState" dir="in" safearray="yes"/>
    2604226042      <param name="returnNames" type="IStringArray" dir="out">
    2604326043        <desc>VM names.</desc>
Note: See TracChangeset for help on using the changeset viewer.

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