VirtualBox

Ignore:
Timestamp:
Sep 8, 2021 2:24:32 PM (3 years ago)
Author:
vboxsync
Message:

VBoxManage: Make "cloud showvminfo" (parallel to "showvminfo" for
local vms) a synonym for "cloud machine info". bugref:10065.

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h

    r91154 r91157  
    349349/* VBoxManageCloudMachine.cpp */
    350350RTEXITCODE handleCloudMachine(HandlerArg *a, int iFirst,
    351                               const char *pszProviderName,
    352                               const char *pszProfileName);
     351                              const char *pcszProviderName,
     352                              const char *pcszProfileName);
    353353RTEXITCODE listCloudMachines(HandlerArg *a, int iFirst,
    354                               const char *pszProviderName,
    355                               const char *pszProfileName);
     354                              const char *pcszProviderName,
     355                              const char *pcszProfileName);
     356RTEXITCODE handleCloudShowVMInfo(HandlerArg *a, int iFirst,
     357                                 const char *pcszProviderName,
     358                                 const char *pcszProfileName);
    356359
    357360/* VBoxManageUpdateCheck.cpp */
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloud.cpp

    r91154 r91157  
    28242824        kCloud_Network,
    28252825        kCloud_Object,
     2826        kCloud_ShowVMInfo,
    28262827        kCloud_Volume,
    28272828    };
     
    28392840        { "network",          kCloud_Network,       RTGETOPT_REQ_NOTHING },
    28402841        { "object",           kCloud_Object,        RTGETOPT_REQ_NOTHING },
     2842        { "showvminfo",       kCloud_ShowVMInfo,    RTGETOPT_REQ_NOTHING },
    28412843        { "volume",           kCloud_Volume,        RTGETOPT_REQ_NOTHING },
    28422844    };
     
    28792881#endif /* VBOX_WITH_CLOUD_NET */
    28802882
     2883            /* "cloud machine ..." handling is in VBoxManageCloudMachine.cpp */
    28812884            case kCloud_Machine:
    28822885                return handleCloudMachine(a, GetState.iNext,
     
    28842887                                          commonOpts.profile.pszProfileName);
    28852888
     2889            /* ... including aliases that mimic the local vm commands */
     2890            case kCloud_ShowVMInfo:
     2891                return handleCloudShowVMInfo(a, GetState.iNext,
     2892                                             commonOpts.provider.pszProviderName,
     2893                                             commonOpts.profile.pszProfileName);
     2894
    28862895            case VINF_GETOPT_NOT_OPTION:
    28872896                return errorUnknownSubcommand(ValueUnion.psz);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageCloudMachine.cpp

    r91156 r91157  
    7070 * in handleCloud).
    7171 */
     72static int
     73getCloudProfile(ComPtr<ICloudProfile> &aProfile,
     74                HandlerArg *a,
     75                const char *pcszProviderName,
     76                const char *pcszProfileName)
     77{
     78    int rc;
     79
     80    ComPtr<ICloudProvider> pProvider;
     81    rc = selectCloudProvider(pProvider, a->virtualBox, pcszProviderName);
     82    if (RT_FAILURE(rc))
     83        return rc;
     84
     85    ComPtr<ICloudProfile> pProfile;
     86    rc = selectCloudProfile(pProfile, pProvider, pcszProfileName);
     87    if (RT_FAILURE(rc))
     88        return rc;
     89
     90    aProfile = pProfile;
     91    return VINF_SUCCESS;
     92}
     93
     94
    7295RTEXITCODE
    7396handleCloudMachine(HandlerArg *a, int iFirst,
     
    7598                   const char *pcszProfileName)
    7699{
    77     int rc;
    78 
    79     ComPtr<ICloudProvider> pProvider;
    80     rc = selectCloudProvider(pProvider, a->virtualBox, pcszProviderName);
    81     if (RT_FAILURE(rc))
    82         return RTEXITCODE_FAILURE;
    83 
    84100    ComPtr<ICloudProfile> pProfile;
    85     rc = selectCloudProfile(pProfile, pProvider, pcszProfileName);
     101    int rc = getCloudProfile(pProfile, a, pcszProviderName, pcszProfileName);
    86102    if (RT_FAILURE(rc))
    87103        return RTEXITCODE_FAILURE;
     
    528544
    529545/*
     546 * cloud showvminfo "id"
     547 *
     548 * Alias for "cloud machine info" that tries to match the local vm
     549 * counterpart.
     550 */
     551RTEXITCODE
     552handleCloudShowVMInfo(HandlerArg *a, int iFirst,
     553                      const char *pcszProviderName,
     554                      const char *pcszProfileName)
     555{
     556    ComPtr<ICloudProfile> pProfile;
     557    int rc = getCloudProfile(pProfile, a, pcszProviderName, pcszProfileName);
     558    if (RT_FAILURE(rc))
     559        return RTEXITCODE_FAILURE;
     560
     561    return handleCloudMachineInfo(a, iFirst, pProfile);
     562}
     563
     564
     565/*
    530566 * cloud machine info "id" ...
    531567 */
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