VirtualBox

Changeset 49038 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 10, 2013 6:21:26 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
89815
Message:

Main/Appliance: change API of IAppliance::write, allowing easy handling of multiple options, needed for making the DVD image export optional
Frontends/VirtualBox+VBoxManage: corresponding adaptions
doc/SDKRef: mention incompatible API change

Location:
trunk/src/VBox
Files:
7 edited

Legend:

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

    r46658 r49038  
    10511051            break;
    10521052
     1053        com::SafeArray<ExportOptions_T> options;
     1054        if (fManifest)
     1055            options.push_back(ExportOptions_CreateManifest);
     1056
    10531057        ComPtr<IProgress> progress;
    10541058        CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOvfFormat).raw(),
    1055                                             fManifest,
     1059                                            ComSafeArrayAsInParam(options),
    10561060                                            Bstr(pszAbsFilePath).raw(),
    10571061                                            progress.asOutParam()));
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp

    r45424 r49038  
    77
    88/*
    9  * Copyright (C) 2009-2012 Oracle Corporation
     9 * Copyright (C) 2009-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    139139{
    140140    /* Write the appliance: */
    141     CProgress progress = appliance.Write(field("format").toString(), field("manifestSelected").toBool() /* fManifest */, uri());
     141    QVector<KExportOptions> options;
     142    if (field("manifestSelected").toBool())
     143        options.append(KExportOptions_CreateManifest);
     144    CProgress progress = appliance.Write(field("format").toString(), options, uri());
    142145    bool fResult = appliance.isOk();
    143146    if (fResult)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r49007 r49038  
    27972797  </enum>
    27982798
     2799  <enum
     2800    name="ExportOptions"
     2801    uuid="8f45eb08-fd34-41ee-af95-a880bdee5554"
     2802    >
     2803
     2804    <desc>
     2805    Export options, used with <link to="IAppliance::write" />.
     2806    </desc>
     2807
     2808    <const name="CreateManifest"    value="1">
     2809      <desc>Write the optional manifest file (.mf) which is used for integrity
     2810      checks prior import.</desc>
     2811    </const>
     2812    <const name="ExportDVDImages"   value="2">
     2813      <desc>Export DVD images. Default is not to export them as it is rarely
     2814      needed for typical VMs.</desc>
     2815    </const>
     2816
     2817  </enum>
     2818
    27992819
    28002820  <!--
     
    30393059        </desc>
    30403060      </param>
    3041       <param name="manifest" type="boolean" dir="in">
    3042         <desc>
    3043             Indicate if the optional manifest file (.mf) should be written. The manifest file
    3044             is used for integrity checks prior import.
    3045         </desc>
     3061      <param name="options" type="ExportOptions" dir="in" safearray="yes">
     3062        <desc>Options for the exporting operation.</desc>
    30463063      </param>
    30473064      <param name="path" type="wstring" dir="in">
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r48955 r49038  
    77
    88/*
    9  * Copyright (C) 2006-2012 Oracle Corporation
     9 * Copyright (C) 2006-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    104104    /* Export methods */
    105105    STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer);
    106     STDMETHOD(Write)(IN_BSTR format, BOOL fManifest, IN_BSTR path, IProgress **aProgress);
     106    STDMETHOD(Write)(IN_BSTR format, ComSafeArrayIn(ExportOptions_T, options), IN_BSTR path, IProgress **aProgress);
    107107
    108108    STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r48955 r49038  
    55
    66/*
    7  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2013 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7979    Utf8Str             strOVFSHADigest;//SHA digest of OVf file. It is stored here after reading OVF file (before import)
    8080
    81     RTCList<ImportOptions_T> optList;
     81    RTCList<ImportOptions_T> optListImport;
     82    RTCList<ExportOptions_T> optListExport;
    8283
    8384    ovf::OVFReader      *pReader;
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r48955 r49038  
    579579 * Public method implementation.
    580580 * @param format
     581 * @param options
    581582 * @param path
    582583 * @param aProgress
    583584 * @return
    584585 */
    585 STDMETHODIMP Appliance::Write(IN_BSTR format, BOOL fManifest, IN_BSTR path, IProgress **aProgress)
     586STDMETHODIMP Appliance::Write(IN_BSTR format, ComSafeArrayIn(ImportOptions_T, options), IN_BSTR path, IProgress **aProgress)
    586587{
    587588    if (!path) return E_POINTER;
     
    592593
    593594    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     595
     596    if (options != NULL)
     597        m->optListExport = com::SafeArray<ExportOptions_T>(ComSafeArrayInArg(options)).toList();
     598
     599    AssertReturn(!(m->optListExport.contains(ExportOptions_CreateManifest) && m->optListExport.contains(ExportOptions_ExportDVDImages)), E_INVALIDARG);
    594600
    595601    // do not allow entering this method if the appliance is busy reading or writing
     
    604610                        tr("Appliance file must have .ovf or .ova extension"));
    605611
    606     m->fManifest = !!fManifest;
     612    m->fManifest = m->optListExport.contains(ExportOptions_CreateManifest);
    607613    Utf8Str strFormat(format);
    608614
     
    886892        {
    887893            rc = mVirtualBox->OpenMedium(bstrSrcFilePath.raw(),
    888                                                  DeviceType_HardDisk,
    889                                                  AccessMode_ReadWrite,
    890                                                  FALSE /* fForceNewUuid */,
    891                                                  pSourceDisk.asOutParam());
     894                                         DeviceType_HardDisk,
     895                                         AccessMode_ReadWrite,
     896                                         FALSE /* fForceNewUuid */,
     897                                         pSourceDisk.asOutParam());
    892898            if (FAILED(rc))
    893899                throw rc;
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r48955 r49038  
    770770    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    771771
     772    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     773
    772774    if (options != NULL)
    773         m->optList = com::SafeArray<ImportOptions_T>(ComSafeArrayInArg(options)).toList();
    774 
    775     AssertReturn(!(m->optList.contains(ImportOptions_KeepAllMACs) && m->optList.contains(ImportOptions_KeepNATMACs)), E_INVALIDARG);
    776 
    777     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     775        m->optListImport = com::SafeArray<ImportOptions_T>(ComSafeArrayInArg(options)).toList();
     776
     777    AssertReturn(!(m->optListImport.contains(ImportOptions_KeepAllMACs) && m->optListImport.contains(ImportOptions_KeepNATMACs)), E_INVALIDARG);
    778778
    779779    // do not allow entering this method if the appliance is busy reading or writing
     
    33403340    /* First disable all network cards, they will be enabled below again. */
    33413341    settings::NetworkAdaptersList::iterator it1;
    3342     bool fKeepAllMACs = m->optList.contains(ImportOptions_KeepAllMACs);
    3343     bool fKeepNATMACs = m->optList.contains(ImportOptions_KeepNATMACs);
     3342    bool fKeepAllMACs = m->optListImport.contains(ImportOptions_KeepAllMACs);
     3343    bool fKeepNATMACs = m->optListImport.contains(ImportOptions_KeepNATMACs);
    33443344    for (it1 = llNetworkAdapters.begin(); it1 != llNetworkAdapters.end(); ++it1)
    33453345    {
Note: See TracChangeset for help on using the changeset viewer.

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