VirtualBox

Changeset 86153 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 17, 2020 12:35:47 PM (4 years ago)
Author:
vboxsync
Message:

OCI: (bugref:9693) Fixed VBoxManage cloud network backslash issue on Unix platforms. Added --compartment-id parameter.

File:
1 edited

Legend:

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

    r85650 r86153  
    21882188}
    21892189
     2190static HRESULT localGatewayImagePath(const Bstr &aDefaultMachineFolder, Bstr &aLgwImage)
     2191{
     2192    com::Utf8Str strPath(aDefaultMachineFolder);
     2193    int rc = RTPathAppendCxx(strPath, "gateways");
     2194    if (RT_SUCCESS(rc))
     2195        rc = RTPathAppendCxx(strPath, "lgw.vdi");
     2196    if (RT_SUCCESS(rc))
     2197        aLgwImage = strPath;
     2198
     2199    return rc;
     2200}
     2201
    21902202static HRESULT createLocalGatewayImage(ComPtr<IVirtualBox> virtualBox, const Bstr& aGatewayIso, const Bstr& aGuestAdditionsIso, const Bstr& aProxy)
    21912203{
     
    22592271        guestAdditionsISO = aGuestAdditionsIso;
    22602272
    2261     BstrFmt strGatewayImage("%ls\\gateways\\lgw.vdi", defaultMachineFolder.raw());
     2273    Bstr strGatewayImage;
     2274    int rc = localGatewayImagePath(defaultMachineFolder, strGatewayImage);
     2275    if (RT_FAILURE(rc))
     2276    {
     2277        RTStrmPrintf(g_pStdErr, "Failed to compose a path to the local gateway image (%Rrc)", rc);
     2278        RTStrmFlush(g_pStdErr);
     2279        return E_FAIL;
     2280    }
    22622281    hrc = virtualBox->OpenMedium(strGatewayImage.raw(), DeviceType_HardDisk, AccessMode_ReadWrite, FALSE, hd.asOutParam());
    22632282    /* If the image is already in place, there is nothing for us to do. */
     
    25652584        { "--guest-additions-iso",  'a', RTGETOPT_REQ_STRING },
    25662585        { "--local-gateway-iso",    'l', RTGETOPT_REQ_STRING },
    2567         { "--proxy",                'p', RTGETOPT_REQ_STRING }
     2586        { "--proxy",                'p', RTGETOPT_REQ_STRING },
     2587        { "--compartment-id",       'c', RTGETOPT_REQ_STRING }
    25682588    };
    25692589    RTGETOPTSTATE GetState;
     
    25802600    Bstr strGuestAdditionsIso;
    25812601    Bstr strProxy;
     2602    Bstr strCompartmentId;
    25822603
    25832604    int c;
     
    26092630            case 'p':
    26102631                strProxy=ValueUnion.psz;
     2632                break;
     2633            case 'c':
     2634                strCompartmentId=ValueUnion.psz;
    26112635                break;
    26122636            case VINF_GETOPT_NOT_OPTION:
     
    26342658
    26352659    ComPtr<ICloudProfile> pCloudProfile = pCommonOpts->profile.pCloudProfile;
     2660
     2661    /* Use user-specified profile instead of default one. */
     2662    if (strCompartmentId.isNotEmpty())
     2663    {
     2664        CHECK_ERROR2_RET(hrc, pCloudProfile,
     2665                         SetProperty(Bstr("compartment").raw(), Bstr(strCompartmentId).raw()),
     2666                         RTEXITCODE_FAILURE);
     2667    }
    26362668
    26372669    ComObjPtr<ICloudClient> oCloudClient;
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