VirtualBox

Ignore:
Timestamp:
Jun 10, 2019 11:38:45 AM (6 years ago)
Author:
vboxsync
Message:

bugre:9404. Added parameter '--state' for the 'VBoxManage cloud list images' command. 3 general states are possible: available, disabled, deleted.

File:
1 edited

Legend:

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

    r79057 r79062  
    141141    if (strState.isNotEmpty())
    142142    {
    143         if (strState.equals("run"))
     143        if (strState.equals("running"))
    144144            machimeStates.push_back(CloudMachineState_Running);
    145         else if (strState.equals("stop"))
     145        else if (strState.equals("paused"))
    146146            machimeStates.push_back(CloudMachineState_Stopped);
    147         else if (strState.equals("terminate"))
     147        else if (strState.equals("terminated"))
    148148            machimeStates.push_back(CloudMachineState_Terminated);
    149149    }
     
    247247    static const RTGETOPTDEF s_aOptions[] =
    248248    {
    249         { "--compartment-id", 'c', RTGETOPT_REQ_STRING }
     249        { "--compartment-id", 'c', RTGETOPT_REQ_STRING },
     250        { "--state",          's', RTGETOPT_REQ_STRING }
    250251    };
    251252    RTGETOPTSTATE GetState;
     
    255256
    256257    Utf8Str strCompartmentId;
     258    Utf8Str strState;
    257259    int c;
    258260    while ((c = RTGetOpt(&GetState, &ValueUnion)) != 0)
     
    261263        {
    262264            case 'c':
    263                     strCompartmentId = ValueUnion.psz;
     265                strCompartmentId = ValueUnion.psz;
     266                break;
     267            case 's':
     268                strState = ValueUnion.psz;
    264269                break;
    265270            case VINF_GETOPT_NOT_OPTION:
     
    268273                return errorGetOpt(c, &ValueUnion);
    269274        }
     275    }
     276
     277    com::SafeArray<CloudImageState_T> imageStates;
     278    if (strState.isNotEmpty())
     279    {
     280        if (strState.equals("available"))
     281            imageStates.push_back(CloudImageState_Available);
     282        else if (strState.equals("disabled"))
     283            imageStates.push_back(CloudImageState_Disabled);
     284        else if (strState.equals("deleted"))
     285            imageStates.push_back(CloudImageState_Deleted);
    270286    }
    271287
     
    324340    RTPrintf("Reply is in the form \'image name\' = \'image id\'\n");
    325341    CHECK_ERROR2_RET(hrc, oCloudClient,
    326                      ListImages(CloudImageState_Available,
     342                     ListImages(ComSafeArrayAsInParam(imageStates),
    327343                                pVMNamesHolder.asOutParam(),
    328344                                pVMIdsHolder.asOutParam(),
     
    339355            RTEXITCODE_FAILURE);
    340356
    341     RTPrintf("List of available images for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
     357    RTPrintf("List of images for the cloud profile \'%ls\' \nand compartment \'%s\':\n",
    342358             bstrProfileName.raw(), strCompartmentId.c_str());
    343359    size_t cNames = arrayVMNames.size();
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