VirtualBox

Changeset 78148 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 16, 2019 4:48:18 PM (6 years ago)
Author:
vboxsync
Message:

OCI: Change ICloudClient::listImages and listInstances signatures to
return a progress. Since we cannot asynchronously update by-value
string arrays, introduce a wrapper IStringArray interface and use it.
Adapt VBoxManage to that API change.

Ifdef out the single use of listInstances in GUI. Ok dsen, he will
adapt the GUI code.

Since extpack cannot directly use code from Main and since
IStringArray implementation is really trivial, just do one in the
extpack at least for now so that this change is not bogged down in
technicalities.

The actual implementation of list methods is still synchronous and
just returns completed progress at the end. It will be made
asynchronous in a separate commit.

Location:
trunk/src/VBox
Files:
3 edited

Legend:

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

    r77886 r78148  
    128128                     RTEXITCODE_FAILURE);
    129129
     130    ComPtr<IStringArray> pVMNamesHolder;
     131    ComPtr<IStringArray> pVMIdsHolder;
    130132    com::SafeArray<BSTR> arrayVMNames;
    131133    com::SafeArray<BSTR> arrayVMIds;
     134    ComPtr<IProgress> pProgress;
     135
    132136    RTPrintf("Getting a list of available cloud instances...\n");
    133137    RTPrintf("Reply is in the form \'instance name\' = \'instance id\'\n");
    134138    CHECK_ERROR2_RET(hrc, oCloudClient,
    135139                     ListInstances(CloudMachineState_Running,
    136                                    ComSafeArrayAsOutParam(arrayVMNames),
    137                                    ComSafeArrayAsOutParam(arrayVMIds)),
    138                      RTEXITCODE_FAILURE);
     140                                   pVMNamesHolder.asOutParam(),
     141                                   pVMIdsHolder.asOutParam(),
     142                                   pProgress.asOutParam()),
     143                     RTEXITCODE_FAILURE);
     144    showProgress(pProgress);
     145    CHECK_PROGRESS_ERROR_RET(pProgress, ("Failed to list instances"), RTEXITCODE_FAILURE);
     146
     147    CHECK_ERROR2_RET(hrc,
     148        pVMNamesHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMNames)),
     149            RTEXITCODE_FAILURE);
     150    CHECK_ERROR2_RET(hrc,
     151        pVMIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMIds)),
     152            RTEXITCODE_FAILURE);
     153
    139154    RTPrintf("List of available instances for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
    140155             bstrProfileName.raw(), strCompartmentId.c_str());
     
    148163        RTPrintf("\t%ls = %ls\n", arrayVMNames[k], value.raw());
    149164    }
     165
     166    pVMNamesHolder.setNull();
     167    pVMIdsHolder.setNull();
     168    arrayVMNames.setNull();
     169    arrayVMIds.setNull();
     170    pProgress.setNull();
    150171    CHECK_ERROR2_RET(hrc, oCloudClient,
    151172                     ListInstances(CloudMachineState_Stopped,
    152                                    ComSafeArrayAsOutParam(arrayVMNames),
    153                                    ComSafeArrayAsOutParam(arrayVMIds)),
    154                      RTEXITCODE_FAILURE);
     173                                   pVMNamesHolder.asOutParam(),
     174                                   pVMIdsHolder.asOutParam(),
     175                                   pProgress.asOutParam()),
     176                     RTEXITCODE_FAILURE);
     177    showProgress(pProgress);
     178    CHECK_PROGRESS_ERROR_RET(pProgress, ("Failed to list instances"), RTEXITCODE_FAILURE);
     179
     180    CHECK_ERROR2_RET(hrc,
     181        pVMNamesHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMNames)),
     182            RTEXITCODE_FAILURE);
     183    CHECK_ERROR2_RET(hrc,
     184        pVMIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMIds)),
     185            RTEXITCODE_FAILURE);
     186
    155187    cNames = arrayVMNames.size();
    156188    cIds = arrayVMIds.size();
     
    243275                     CreateCloudClient(oCloudClient.asOutParam()),
    244276                     RTEXITCODE_FAILURE);
     277
     278    ComPtr<IStringArray> pVMNamesHolder;
     279    ComPtr<IStringArray> pVMIdsHolder;
    245280    com::SafeArray<BSTR> arrayVMNames;
    246281    com::SafeArray<BSTR> arrayVMIds;
     282    ComPtr<IProgress> pProgress;
     283
    247284    RTPrintf("Getting a list of available cloud images...\n");
    248285    RTPrintf("Reply is in the form \'image name\' = \'image id\'\n");
    249286    CHECK_ERROR2_RET(hrc, oCloudClient,
    250287                     ListImages(CloudImageState_Available,
    251                                 ComSafeArrayAsOutParam(arrayVMNames),
    252                                 ComSafeArrayAsOutParam(arrayVMIds)),
    253                      RTEXITCODE_FAILURE);
     288                                pVMNamesHolder.asOutParam(),
     289                                pVMIdsHolder.asOutParam(),
     290                                pProgress.asOutParam()),
     291                     RTEXITCODE_FAILURE);
     292    showProgress(pProgress);
     293    CHECK_PROGRESS_ERROR_RET(pProgress, ("Failed to list images"), RTEXITCODE_FAILURE);
     294
     295    CHECK_ERROR2_RET(hrc,
     296        pVMNamesHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMNames)),
     297            RTEXITCODE_FAILURE);
     298    CHECK_ERROR2_RET(hrc,
     299        pVMIdsHolder, COMGETTER(Values)(ComSafeArrayAsOutParam(arrayVMIds)),
     300            RTEXITCODE_FAILURE);
     301
    254302    RTPrintf("List of available images for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
    255303             bstrProfileName.raw(), strCompartmentId.c_str());
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic1.cpp

    r78127 r78148  
    278278        else
    279279        {
     280#if 0
    280281            /* Read Cloud Client instances: */
    281282            QVector<QString> vmNames;
     
    299300                }
    300301            }
     302#else  // XXX: uwe
     303            msgCenter().cannotAcquireCloudClientParameter(m_comCloudClient);
     304#endif
    301305        }
    302306    }
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r78124 r78148  
    2553725537
    2553825538  <!--
     25539  // Auxiliary containers
     25540  //////////////////////////////////////////////////////////////////////////
     25541  -->
     25542
     25543  <interface name="IStringArray" extends="$unknown"
     25544             uuid="3890b2c8-604d-11e9-92d3-53cb473db9fb"
     25545             wsmap="managed"
     25546             reservedMethods="4">
     25547    <desc>
     25548      When you need to return an array of strings asynchronously
     25549      (under a progress) you cannot use by-value out parameter
     25550      <tt>type=&quot;wstring&quot; safearray=&quot;yes&quot;
     25551      dir=&quot;out&quot;</tt>, hence this wrapper.
     25552    </desc>
     25553    <attribute name="values" type="wstring" safearray="yes" readonly="yes"/>
     25554  </interface>
     25555
     25556
     25557  <!--
    2553925558  // IForm
    2554025559  //////////////////////////////////////////////////////////////////////////
     
    2568425703  <interface
    2568525704    name="ICloudClient" extends="$unknown"
    25686     uuid="07c04464-981c-4418-8fcf-5ad12aed7c38"
     25705    uuid="7acc426a-5f8f-11e9-9032-1b0da54759a8"
    2568725706    wsmap="managed" reservedMethods="13" reservedAttributes="8"
    2568825707    >
     
    2573625755      </desc>
    2573725756      <param name="machineState" type="CloudMachineState" dir="in"/>
    25738       <param name="returnNames" type="wstring" safearray="yes" dir="out">
     25757      <param name="returnNames" type="IStringArray" dir="out">
    2573925758        <desc>VM names.</desc>
    2574025759      </param>
    25741       <param name="returnIds" type="wstring" safearray="yes" dir="return">
     25760      <param name="returnIds" type="IStringArray" dir="out">
    2574225761        <desc>VM ids.</desc>
    2574325762      </param>
     25763      <param name="progress" type="IProgress" dir="return">
     25764        <desc>
     25765          Progress object to track the operation completion.
     25766        </desc>
     25767      </param>
    2574425768    </method>
    2574525769
     
    2574925773      </desc>
    2575025774      <param name="imageState" type="CloudImageState" dir="in"/>
    25751       <param name="returnNames" type="wstring" safearray="yes" dir="out">
     25775      <param name="returnNames" type="IStringArray" dir="out">
    2575225776        <desc>Images names.</desc>
    2575325777      </param>
    25754       <param name="returnIds" type="wstring" safearray="yes" dir="return">
     25778      <param name="returnIds" type="IStringArray" dir="out">
    2575525779        <desc>Images ids.</desc>
     25780      </param>
     25781      <param name="progress" type="IProgress" dir="return">
     25782        <desc>
     25783          Progress object to track the operation completion.
     25784        </desc>
    2575625785      </param>
    2575725786    </method>
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