VirtualBox

Changeset 91326 in vbox


Ignore:
Timestamp:
Sep 22, 2021 3:10:38 PM (3 years ago)
Author:
vboxsync
Message:

Main/NvramStore,FE/VBoxManage: Allow multiple NVRAM states (UEFI,TPM,etc.) to exist for a VM and and manage them in a central place. This allows to collect them in a single tar archive and provide a single interface to get access to the individual states (work in progress), bugref:10098

Location:
trunk
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/log.h

    r91213 r91326  
    537537    /** Main group, INetworkAdapter. */
    538538    LOG_GROUP_MAIN_NETWORKADAPTER,
     539    /** Main group, INvramStore. */
     540    LOG_GROUP_MAIN_NVRAMSTORE,
    539541    /** Main group, IParallelPort. */
    540542    LOG_GROUP_MAIN_PARALLELPORT,
     
    10371039    "MAIN_NATNETWORK", \
    10381040    "MAIN_NETWORKADAPTER", \
     1041    "MAIN_NVRAMSTORE", \
    10391042    "MAIN_PARALLELPORT", \
    10401043    "MAIN_PCIADDRESS", \
  • trunk/include/VBox/settings.h

    r91213 r91326  
    543543    int64_t         llTimeOffset;
    544544    com::Utf8Str    strLogoImagePath;
    545     com::Utf8Str    strNVRAMPath;
    546545};
    547546
     
    561560    TpmType_T       tpmType;
    562561    com::Utf8Str    strLocation;
     562};
     563
     564/**
     565 * NOTE: If you add any fields in here, you must update a) the constructor and b)
     566 * the operator== which is used by MachineConfigFile::operator==(), or otherwise
     567 * your settings might never get saved.
     568 */
     569struct NvramSettings
     570{
     571    NvramSettings();
     572
     573    bool areDefaultSettings() const;
     574
     575    bool operator==(const NvramSettings &d) const;
     576
     577    com::Utf8Str    strNvramPath;
    563578};
    564579
     
    11711186
    11721187    BIOSSettings        biosSettings;
     1188    NvramSettings       nvramSettings;
    11731189    RecordingSettings   recordingSettings;
    11741190    GraphicsAdapter     graphicsAdapter;
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r88086 r91326  
    877877    CHECK_ERROR2I_RET(machine, COMGETTER(BIOSSettings)(biosSettings.asOutParam()), hrcCheck);
    878878
     879    ComPtr<INvramStore> nvramStore;
     880    CHECK_ERROR2I_RET(machine, COMGETTER(NonVolatileStore)(nvramStore.asOutParam()), hrcCheck);
     881
    879882    BIOSBootMenuMode_T bootMenuMode;
    880883    CHECK_ERROR2I_RET(biosSettings, COMGETTER(BootMenuMode)(&bootMenuMode), hrcCheck);
     
    954957    SHOW_LONG64_PROP(biosSettings,  TimeOffset,                 "biossystemtimeoffset", "Time offset:",  "ms");
    955958    Bstr bstrNVRAMFile;
    956     CHECK_ERROR2I_RET(biosSettings, COMGETTER(NonVolatileStorageFile)(bstrNVRAMFile.asOutParam()), hrcCheck);
     959    CHECK_ERROR2I_RET(nvramStore, COMGETTER(NonVolatileStorageFile)(bstrNVRAMFile.asOutParam()), hrcCheck);
    957960    if (bstrNVRAMFile.isNotEmpty())
    958961        SHOW_BSTR_STRING("BIOS NVRAM File", "BIOS NVRAM File:", bstrNVRAMFile);
  • trunk/src/VBox/Main/Makefile.kmk

    r91312 r91326  
    552552        src-all/HashedPw.cpp \
    553553        src-all/Logging.cpp \
     554        src-all/NvramStoreImpl.cpp \
    554555        src-all/PCIDeviceAttachmentImpl.cpp \
    555556        src-all/ProgressImpl.cpp \
     
    10071008        src-all/HashedPw.cpp \
    10081009        src-all/Logging.cpp \
     1010        src-all/NvramStoreImpl.cpp \
    10091011        src-all/PCIDeviceAttachmentImpl.cpp \
    10101012        src-all/ProgressImpl.cpp \
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r91213 r91326  
    53385338  <interface
    53395339    name="IBIOSSettings" extends="$unknown"
    5340     uuid="73af4152-7e67-4144-bf34-41c38e8b4cc7"
     5340    uuid="a0a7f210-b857-4468-be26-c29f36a84345"
    53415341    wsmap="managed"
    53425342    reservedMethods="2" reservedAttributes="8"
     
    54005400        PXE debug logging flag. If set, VirtualBox will write extensive
    54015401        PXE trace information to the release log.
    5402       </desc>
    5403     </attribute>
    5404 
    5405     <attribute name="nonVolatileStorageFile" type="wstring" readonly="yes">
    5406       <desc>
    5407         The location of the file storing the non-volatile memory content when
    5408         the VM is powered off.  The file does not always exist.
    54095402      </desc>
    54105403    </attribute>
     
    58905883  </interface>
    58915884
     5885  <interface
     5886    name="INvramStore" extends="$unknown"
     5887    uuid="31283924-604c-44f5-b9d7-ac082531ffb7"
     5888    wsmap="managed"
     5889    >
     5890
     5891    <desc>
     5892      Provides access to the NVRAM store collecting all permanent states from different sources
     5893      (UEFI, TPM, etc.).
     5894    </desc>
     5895
     5896    <attribute name="nonVolatileStorageFile" type="wstring" readonly="yes">
     5897      <desc>
     5898        The location of the file storing the non-volatile memory content when
     5899        the VM is powered off.  The file does not always exist.
     5900      </desc>
     5901    </attribute>
     5902
     5903  </interface>
     5904
    58925905  <enum
    58935906    name="GraphicsControllerType"
     
    60676080  <interface
    60686081    name="IMachine" extends="$unknown"
    6069     uuid="9764b032-9f0f-4b3f-a6a3-e1630c8384bd"
     6082    uuid="8d2e6ace-0162-4985-9424-37d17fd87657"
    60706083    wsmap="managed"
    60716084    wrap-hint-server-addinterfaces="IInternalMachineControl"
     
    63286341    <attribute name="TrustedPlatformModule" type="ITrustedPlatformModule" readonly="yes">
    63296342      <desc>Object containing all TPM settings.</desc>
     6343    </attribute>
     6344
     6345    <attribute name="nonVolatileStore" type="INvramStore" readonly="yes">
     6346      <desc>Object to manipulate data in the non volatile storage file.</desc>
    63306347    </attribute>
    63316348
  • trunk/src/VBox/Main/include/BIOSSettingsImpl.h

    r90828 r91326  
    5858    void i_applyDefaults(GuestOSType *aOsType);
    5959
    60     com::Utf8Str i_getNonVolatileStorageFile();
    61     void i_updateNonVolatileStorageFile(const com::Utf8Str &aNonVolatileStorageFile);
    62 
    6360private:
    6461
     
    8481    HRESULT getPXEDebugEnabled(BOOL *enabled);
    8582    HRESULT setPXEDebugEnabled(BOOL enable);
    86     HRESULT getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile);
    8783    HRESULT getSMBIOSUuidLittleEndian(BOOL *enabled);
    8884    HRESULT setSMBIOSUuidLittleEndian(BOOL enable);
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r91312 r91326  
    6464class VMPowerUpTask;
    6565class VMPowerDownTask;
     66class NvramStore;
    6667
    6768#include <iprt/uuid.h>
     
    935936#endif
    936937    const ComObjPtr<EmulatedUSB> mEmulatedUSB;
     938    const ComObjPtr<NvramStore> mptrNvramStore;
    937939
    938940    USBDeviceList mUSBDevices;
  • trunk/src/VBox/Main/include/MachineImpl.h

    r91213 r91326  
    4242#include "BandwidthGroupImpl.h"
    4343#include "TrustedPlatformModuleImpl.h"
     44#include "NvramStoreImpl.h"
    4445#ifdef VBOX_WITH_RESOURCE_USAGE_API
    4546# include "Performance.h"
     
    473474    enum
    474475    {
    475         IsModified_MachineData           = 0x0001,
    476         IsModified_Storage               = 0x0002,
    477         IsModified_NetworkAdapters       = 0x0008,
    478         IsModified_SerialPorts           = 0x0010,
    479         IsModified_ParallelPorts         = 0x0020,
    480         IsModified_VRDEServer            = 0x0040,
    481         IsModified_AudioAdapter          = 0x0080,
    482         IsModified_USB                   = 0x0100,
    483         IsModified_BIOS                  = 0x0200,
    484         IsModified_SharedFolders         = 0x0400,
    485         IsModified_Snapshots             = 0x0800,
    486         IsModified_BandwidthControl      = 0x1000,
    487         IsModified_Recording             = 0x2000,
    488         IsModified_GraphicsAdapter       = 0x4000,
    489         IsModified_TrustedPlatformModule = 0x8000,
     476        IsModified_MachineData           = 0x000001,
     477        IsModified_Storage               = 0x000002,
     478        IsModified_NetworkAdapters       = 0x000008,
     479        IsModified_SerialPorts           = 0x000010,
     480        IsModified_ParallelPorts         = 0x000020,
     481        IsModified_VRDEServer            = 0x000040,
     482        IsModified_AudioAdapter          = 0x000080,
     483        IsModified_USB                   = 0x000100,
     484        IsModified_BIOS                  = 0x000200,
     485        IsModified_SharedFolders         = 0x000400,
     486        IsModified_Snapshots             = 0x000800,
     487        IsModified_BandwidthControl      = 0x001000,
     488        IsModified_Recording             = 0x002000,
     489        IsModified_GraphicsAdapter       = 0x004000,
     490        IsModified_TrustedPlatformModule = 0x008000,
     491        IsModified_NvramStore            = 0x010000,
    490492    };
    491493
     
    798800
    799801    const ComObjPtr<TrustedPlatformModule> mTrustedPlatformModule;
     802    const ComObjPtr<NvramStore>            mNvramStore;
    800803
    801804    typedef std::vector<ComObjPtr<NetworkAdapter> > NetworkAdapterVector;
     
    891894    HRESULT getBIOSSettings(ComPtr<IBIOSSettings> &aBIOSSettings);
    892895    HRESULT getTrustedPlatformModule(ComPtr<ITrustedPlatformModule> &aTrustedPlatformModule);
     896    HRESULT getNonVolatileStore(ComPtr<INvramStore> &aNvramStore);
    893897    HRESULT getRecordingSettings(ComPtr<IRecordingSettings> &aRecordingSettings);
    894898    HRESULT getFirmwareType(FirmwareType_T *aFirmwareType);
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r90828 r91326  
    7777#include "PCIDeviceAttachmentImpl.h"
    7878#include "EmulatedUSBImpl.h"
     79#include "NvramStoreImpl.h"
    7980
    8081#include "VBoxEvents.h"
     
    547548        AssertComRCReturnRC(rc);
    548549
     550        /* Init the NVRAM store. */
     551        ComPtr<INvramStore> pNvramStore;
     552        rc = aMachine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
     553        AssertComRCReturnRC(rc);
     554
     555        Bstr strNonVolatilePath;
     556        pNvramStore->COMGETTER(NonVolatileStorageFile)(strNonVolatilePath.asOutParam());
     557
     558        unconst(mptrNvramStore).createObject();
     559        rc = mptrNvramStore->init(this, strNonVolatilePath);
     560        AssertComRCReturnRC(rc);
     561
    549562        /* Grab global and machine shared folder lists */
    550563
     
    803816        delete mConsoleVRDPServer;
    804817        unconst(mConsoleVRDPServer) = NULL;
     818    }
     819
     820    if (mptrNvramStore)
     821    {
     822        mptrNvramStore->uninit();
     823        unconst(mptrNvramStore).setNull();
    805824    }
    806825
     
    1074910768    }
    1075010769
     10770    if (UuidCopy == COM_IIDOF(INvramStore))
     10771    {
     10772        NvramStore *pNvramStore = static_cast<NvramStore *>(pConsole->mptrNvramStore);
     10773        return pNvramStore;
     10774    }
     10775
    1075110776    if (UuidCopy == VMMDEV_OID)
    1075210777        return pConsole->m_pVMMDev;
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r91213 r91326  
    3636#include "ConsoleImpl.h"
    3737#include "DisplayImpl.h"
     38#include "NvramStoreImpl.h"
    3839#ifdef VBOX_WITH_DRAG_AND_DROP
    3940# include "GuestImpl.h"
     
    808809    ComPtr<IBIOSSettings> biosSettings;
    809810    hrc = pMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());                     H();
     811
     812    ComPtr<INvramStore> nvramStore;
     813    hrc = pMachine->COMGETTER(NonVolatileStore)(nvramStore.asOutParam());                   H();
    810814
    811815    hrc = pMachine->COMGETTER(HardwareUUID)(bstr.asOutParam());                             H();
     
    19341938
    19351939            /* Get NVRAM file name */
    1936             Bstr bstrNVRAM;
    1937             hrc = biosSettings->COMGETTER(NonVolatileStorageFile)(bstrNVRAM.asOutParam());  H();
     1940            Utf8Str strNvram = mptrNvramStore->i_getNonVolatileStorageFile();
    19381941
    19391942            BOOL fUuidLe;
     
    20042007            InsertConfigInteger(pCfg,  "UuidLe",      fUuidLe);
    20052008            InsertConfigInteger(pCfg,  "64BitEntry",  f64BitEntry); /* boolean */
    2006             InsertConfigString(pCfg,   "NvramFile",   bstrNVRAM);
     2009            InsertConfigString(pCfg,   "NvramFile",   strNvram);
    20072010            if (u32GraphicsMode != UINT32_MAX)
    20082011                InsertConfigInteger(pCfg,  "GraphicsMode",  u32GraphicsMode);
     
    20162019                InsertConfigInteger(pCfg, "DmiExposeMemoryTable", 1);
    20172020            }
     2021
     2022            /* Attach the NVRAM storage driver. */
     2023            InsertConfigNode(pInst,    "LUN#0",     &pLunL0);
     2024            InsertConfigString(pLunL0, "Driver",    "NvramStore");
    20182025        }
    20192026
     
    34203427                    InsertConfigNode(pLunL0,   "Config", &pCfg);
    34213428                    InsertConfigInteger(pCfg, "TpmVersion", enmTpmType == TpmType_v1_2 ? 1 : 2);
     3429                    InsertConfigNode(pLunL0, "AttachedDriver", &pLunL1);
     3430                    InsertConfigString(pLunL1, "Driver", "NvramStore");
    34223431                    break;
    34233432                }
  • trunk/src/VBox/Main/src-client/VBoxDriversRegister.cpp

    r82968 r91326  
    2828#include "DisplayImpl.h"
    2929#include "VMMDev.h"
     30#include "NvramStoreImpl.h"
    3031#ifdef VBOX_WITH_AUDIO_VRDE
    3132# include "DrvAudioVRDE.h"
     
    105106#endif
    106107
     108    rc = pCallbacks->pfnRegister(pCallbacks, &NvramStore::DrvReg);
     109    if (RT_FAILURE(rc))
     110        return rc;
     111
    107112    return VINF_SUCCESS;
    108113}
  • trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp

    r82968 r91326  
    153153    m->bd.attachCopy(that->m->bd);
    154154
    155     // Intentionally "forget" the NVRAM file since it must be unique and set
    156     // to the correct value before the copy of the settings makes sense.
    157     m->bd->strNVRAMPath.setNull();
    158 
    159155    autoInitSpan.setSucceeded();
    160156
     
    466462    AutoWriteLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);  // mParent is const, needs no locking
    467463    m->pMachine->i_setModified(Machine::IsModified_BIOS);
    468 
    469     return S_OK;
    470 }
    471 
    472 
    473 HRESULT BIOSSettings::getNonVolatileStorageFile(com::Utf8Str &aNonVolatileStorageFile)
    474 {
    475     Utf8Str strTmp;
    476     {
    477         AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    478         strTmp = m->bd->strNVRAMPath;
    479     }
    480 
    481     AutoReadLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
    482     if (strTmp.isEmpty())
    483         strTmp = m->pMachine->i_getDefaultNVRAMFilename();
    484     if (strTmp.isNotEmpty())
    485         m->pMachine->i_calculateFullPath(strTmp, aNonVolatileStorageFile);
    486464
    487465    return S_OK;
     
    541519    // simply copy
    542520    m->bd.assignCopy(&data);
    543 
    544     Utf8Str strTmp(m->bd->strNVRAMPath);
    545     if (strTmp.isNotEmpty())
    546         m->pMachine->i_copyPathRelativeToMachine(strTmp, m->bd->strNVRAMPath);
    547     if (   m->pMachine->i_getFirmwareType() == FirmwareType_BIOS
    548         || m->bd->strNVRAMPath == m->pMachine->i_getDefaultNVRAMFilename())
    549         m->bd->strNVRAMPath.setNull();
    550 
    551521    return S_OK;
    552522}
     
    622592    /* this will back up current data */
    623593    m->bd.assignCopy(aThat->m->bd);
    624 
    625     // Intentionally "forget" the NVRAM file since it must be unique and set
    626     // to the correct value before the copy of the settings makes sense.
    627     m->bd->strNVRAMPath.setNull();
    628 
    629594}
    630595
     
    644609}
    645610
    646 Utf8Str BIOSSettings::i_getNonVolatileStorageFile()
    647 {
    648     AutoCaller autoCaller(this);
    649     AssertComRCReturn(autoCaller.rc(), Utf8Str::Empty);
    650 
    651     Utf8Str strTmp;
    652     BIOSSettings::getNonVolatileStorageFile(strTmp);
    653     return strTmp;
    654 }
    655 
    656 void BIOSSettings::i_updateNonVolatileStorageFile(const Utf8Str &aNonVolatileStorageFile)
    657 {
    658     /* sanity */
    659     AutoCaller autoCaller(this);
    660     AssertComRCReturnVoid(autoCaller.rc());
    661 
    662     AutoReadLock mlock(m->pMachine COMMA_LOCKVAL_SRC_POS);
    663     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    664 
    665     Utf8Str strTmp(aNonVolatileStorageFile);
    666     if (strTmp == m->pMachine->i_getDefaultNVRAMFilename())
    667         strTmp.setNull();
    668 
    669     if (strTmp == m->bd->strNVRAMPath)
    670         return;
    671 
    672     m->bd.backup();
    673     m->bd->strNVRAMPath = strTmp;
    674 }
    675 
    676611/* vi: set tabstop=4 shiftwidth=4 expandtab: */
  • trunk/src/VBox/Main/src-server/MachineImpl.cpp

    r91213 r91326  
    11451145    alock.release();
    11461146
    1147     mBIOSSettings->i_updateNonVolatileStorageFile(strNVRAM);
     1147    mNvramStore->i_updateNonVolatileStorageFile(strNVRAM);
    11481148
    11491149    return S_OK;
     
    18561856}
    18571857
     1858HRESULT Machine::getNonVolatileStore(ComPtr<INvramStore> &aNvramStore)
     1859{
     1860    /* mNvramStore is constant during life time, no need to lock */
     1861    aNvramStore = mNvramStore;
     1862
     1863    return S_OK;
     1864}
     1865
    18581866HRESULT Machine::getRecordingSettings(ComPtr<IRecordingSettings> &aRecordingSettings)
    18591867{
     
    49424950        mData->llFilesToDelete.push_back(mSSData->strStateFilePath);
    49434951
    4944     Utf8Str strNVRAMFile = mBIOSSettings->i_getNonVolatileStorageFile();
     4952    Utf8Str strNVRAMFile = mNvramStore->i_getNonVolatileStorageFile();
    49454953    if (!strNVRAMFile.isEmpty() && RTFileExists(strNVRAMFile.c_str()))
    49464954        mData->llFilesToDelete.push_back(strNVRAMFile);
     
    81758183    mTrustedPlatformModule->init(this);
    81768184
     8185    /* create associated NVRAM store object */
     8186    unconst(mNvramStore).createObject();
     8187    mNvramStore->init(this);
     8188
    81778189    /* create associated record settings object */
    81788190    unconst(mRecordingSettings).createObject();
     
    83108322        mTrustedPlatformModule->uninit();
    83118323        unconst(mTrustedPlatformModule).setNull();
     8324    }
     8325
     8326    if (mNvramStore)
     8327    {
     8328        mNvramStore->uninit();
     8329        unconst(mNvramStore).setNull();
    83128330    }
    83138331
     
    88398857        /* Trusted Platform Module */
    88408858        rc = mTrustedPlatformModule->i_loadSettings(data.tpmSettings);
     8859        if (FAILED(rc)) return rc;
     8860
     8861        rc = mNvramStore->i_loadSettings(data.nvramSettings);
    88418862        if (FAILED(rc)) return rc;
    88428863
     
    96989719                    newConfigFilePrev += "-prev";
    96999720                    RTFileRename(configFilePrev.c_str(), newConfigFilePrev.c_str(), 0);
    9700                     NVRAMFile = mBIOSSettings->i_getNonVolatileStorageFile();
     9721                    NVRAMFile = mNvramStore->i_getNonVolatileStorageFile();
    97019722                    if (NVRAMFile.isNotEmpty())
    97029723                    {
     
    97389759            }
    97399760            if (newNVRAMFile.isNotEmpty())
    9740                 mBIOSSettings->i_updateNonVolatileStorageFile(newNVRAMFile);
     9761                mNvramStore->i_updateNonVolatileStorageFile(newNVRAMFile);
    97419762
    97429763            // and do the same thing for the saved state file paths of all the online snapshots and NVRAM files of all snapshots
     
    1019010211        /* Trusted Platform Module settings (required) */
    1019110212        rc = mTrustedPlatformModule->i_saveSettings(data.tpmSettings);
     10213        if (FAILED(rc)) throw rc;
     10214
     10215        /* NVRAM settings (required) */
     10216        rc = mNvramStore->i_saveSettings(data.nvramSettings);
    1019210217        if (FAILED(rc)) throw rc;
    1019310218
     
    1170911734        mTrustedPlatformModule->i_rollback();
    1171011735
     11736    if (mNvramStore)
     11737        mNvramStore->i_rollback();
     11738
    1171111739    if (mRecordingSettings && (mData->flModifications & IsModified_Recording))
    1171211740        mRecordingSettings->i_rollback();
     
    1183511863    mBIOSSettings->i_commit();
    1183611864    mTrustedPlatformModule->i_commit();
     11865    mNvramStore->i_commit();
    1183711866    mRecordingSettings->i_commit();
    1183811867    mGraphicsAdapter->i_commit();
     
    1209012119    mBIOSSettings->i_copyFrom(aThat->mBIOSSettings);
    1209112120    mTrustedPlatformModule->i_copyFrom(aThat->mTrustedPlatformModule);
     12121    mNvramStore->i_copyFrom(aThat->mNvramStore);
    1209212122    mRecordingSettings->i_copyFrom(aThat->mRecordingSettings);
    1209312123    mGraphicsAdapter->i_copyFrom(aThat->mGraphicsAdapter);
     
    1246912499    mTrustedPlatformModule->init(this, aMachine->mTrustedPlatformModule);
    1247012500
     12501    unconst(mNvramStore).createObject();
     12502    mNvramStore->init(this, aMachine->mNvramStore);
     12503
    1247112504    unconst(mRecordingSettings).createObject();
    1247212505    mRecordingSettings->init(this, aMachine->mRecordingSettings);
  • trunk/src/VBox/Main/src-server/MachineImplCloneVM.cpp

    r91312 r91326  
    244244{
    245245    Bstr bstrSrcNVRAMPath;
    246     ComPtr<IBIOSSettings> pBIOSSettings;
    247     HRESULT rc = machine->COMGETTER(BIOSSettings)(pBIOSSettings.asOutParam());
     246    ComPtr<INvramStore> pNvramStore;
     247    HRESULT rc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
    248248    if (FAILED(rc)) return rc;
    249     rc = pBIOSSettings->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
     249    rc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
    250250    if (FAILED(rc)) return rc;
    251251    if (!bstrSrcNVRAMPath.isEmpty())
     
    755755    {
    756756        if (it->uuid == id)
    757             it->hardware.biosSettings.strNVRAMPath = strFile;
     757            it->hardware.nvramSettings.strNvramPath = strFile;
    758758        else if (!it->llChildSnapshots.empty())
    759759            updateNVRAMFile(it->llChildSnapshots, id, strFile);
     
    15551555             * machine state or the snapshots. */
    15561556            if (!fct.snapshotUuid.isValid() || fct.snapshotUuid.isZero())
    1557                 trgMCF.hardwareMachine.biosSettings.strNVRAMPath = strTrgNVRAM;
     1557                trgMCF.hardwareMachine.nvramSettings.strNvramPath = strTrgNVRAM;
    15581558            else
    15591559                d->updateNVRAMFile(trgMCF.llFirstSnapshot, fct.snapshotUuid, strTrgNVRAM);
  • trunk/src/VBox/Main/src-server/MachineImplMoveVM.cpp

    r90828 r91326  
    12621262        pSnapshot->i_updateNVRAMPaths(sourcePath.c_str(),
    12631263                                      targetPath.c_str());
    1264     ComObjPtr<BIOSSettings> pBIOSSettings(m_pMachine->mBIOSSettings);
    1265     const Utf8Str NVRAMFile(pBIOSSettings->i_getNonVolatileStorageFile());
     1264    ComObjPtr<NvramStore> pNvramStore(m_pMachine->mNvramStore);
     1265    const Utf8Str NVRAMFile(pNvramStore->i_getNonVolatileStorageFile());
    12661266    if (NVRAMFile.isNotEmpty())
    12671267    {
     
    12711271        else
    12721272            newNVRAMFile = Utf8StrFmt("%s%c%s", targetPath.c_str(), RTPATH_DELIMITER, RTPathFilename(newNVRAMFile.c_str()));
    1273         pBIOSSettings->i_updateNonVolatileStorageFile(newNVRAMFile);
     1273        pNvramStore->i_updateNonVolatileStorageFile(newNVRAMFile);
    12741274    }
    12751275}
     
    15831583HRESULT MachineMoveVM::addNVRAM(const ComObjPtr<Machine> &machine)
    15841584{
    1585     ComPtr<IBIOSSettings> pBIOSSettings;
    1586     HRESULT rc = machine->COMGETTER(BIOSSettings)(pBIOSSettings.asOutParam());
     1585    ComPtr<INvramStore> pNvramStore;
     1586    HRESULT rc = machine->COMGETTER(NonVolatileStore)(pNvramStore.asOutParam());
    15871587    if (FAILED(rc)) return rc;
    15881588    Bstr bstrSrcNVRAMPath;
    1589     rc = pBIOSSettings->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
     1589    rc = pNvramStore->COMGETTER(NonVolatileStorageFile)(bstrSrcNVRAMPath.asOutParam());
    15901590    if (FAILED(rc)) return rc;
    15911591    Utf8Str strSrcNVRAMPath(bstrSrcNVRAMPath);
  • trunk/src/VBox/Main/src-server/SnapshotImpl.cpp

    r91213 r91326  
    749749    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    750750
    751     const Utf8Str path = m->pMachine->mBIOSSettings->i_getNonVolatileStorageFile();
     751    const Utf8Str path = m->pMachine->mNvramStore->i_getNonVolatileStorageFile();
    752752    LogFlowThisFunc(("Snap[%s].nvramPath={%s}\n", m->strName.c_str(), path.c_str()));
    753753
     
    757757       )
    758758    {
    759         m->pMachine->mBIOSSettings->i_updateNonVolatileStorageFile(Utf8StrFmt("%s%s",
     759        m->pMachine->mNvramStore->i_updateNonVolatileStorageFile(Utf8StrFmt("%s%s",
    760760                                                                              strNewPath.c_str(),
    761761                                                                              path.c_str() + strOldPath.length()));
    762         LogFlowThisFunc(("-> updated: {%s}\n", m->pMachine->mBIOSSettings->i_getNonVolatileStorageFile().c_str()));
     762        LogFlowThisFunc(("-> updated: {%s}\n", m->pMachine->mNvramStore->i_getNonVolatileStorageFile().c_str()));
    763763    }
    764764
     
    921921    }
    922922
    923     Utf8Str strNVRAMFile = m->pMachine->mBIOSSettings->i_getNonVolatileStorageFile();
     923    Utf8Str strNVRAMFile = m->pMachine->mNvramStore->i_getNonVolatileStorageFile();
    924924    if (strNVRAMFile.isNotEmpty() && RTFileExists(strNVRAMFile.c_str()))
    925925        llFilenames.push_back(strNVRAMFile);
     
    11511151    unconst(mTrustedPlatformModule).createObject();
    11521152    rc = mTrustedPlatformModule->initCopy(this, pMachine->mTrustedPlatformModule);
     1153    if (FAILED(rc)) return rc;
     1154
     1155    unconst(mNvramStore).createObject();
     1156    rc = mNvramStore->initCopy(this, pMachine->mNvramStore);
    11531157    if (FAILED(rc)) return rc;
    11541158
     
    12851289    unconst(mTrustedPlatformModule).createObject();
    12861290    mTrustedPlatformModule->init(this);
     1291
     1292    unconst(mNvramStore).createObject();
     1293    mNvramStore->init(this);
    12871294
    12881295    unconst(mRecordingSettings).createObject();
     
    18671874
    18681875        // Handle NVRAM file snapshotting
    1869         Utf8Str strNVRAM = mBIOSSettings->i_getNonVolatileStorageFile();
     1876        Utf8Str strNVRAM = mNvramStore->i_getNonVolatileStorageFile();
    18701877        Utf8Str strNVRAMSnap = pSnapshotMachine->i_getSnapshotNVRAMFilename();
    18711878        if (strNVRAM.isNotEmpty() && strNVRAMSnap.isNotEmpty() && RTFileExists(strNVRAM.c_str()))
     
    18811888                                   tr("Could not copy NVRAM file '%s' to '%s' (%Rrc)"),
    18821889                                   strNVRAM.c_str(), strNVRAMSnapAbs.c_str(), vrc);
    1883             pSnapshotMachine->mBIOSSettings->i_updateNonVolatileStorageFile(strNVRAMSnap);
     1890            pSnapshotMachine->mNvramStore->i_updateNonVolatileStorageFile(strNVRAMSnap);
    18841891        }
    18851892
     
    23762383                mSSData->strStateFilePath = strSnapshotStateFile;
    23772384
    2378             const Utf8Str srcNVRAM(pSnapshotMachine->mBIOSSettings->i_getNonVolatileStorageFile());
    2379             const Utf8Str dstNVRAM(mBIOSSettings->i_getNonVolatileStorageFile());
     2385            const Utf8Str srcNVRAM(pSnapshotMachine->mNvramStore->i_getNonVolatileStorageFile());
     2386            const Utf8Str dstNVRAM(mNvramStore->i_getNonVolatileStorageFile());
    23802387            if (dstNVRAM.isNotEmpty() && RTFileExists(dstNVRAM.c_str()))
    23812388                RTFileDelete(dstNVRAM.c_str());
     
    35003507        /* 3a: delete NVRAM file if present. */
    35013508        {
    3502             Utf8Str NVRAMPath = pSnapMachine->mBIOSSettings->i_getNonVolatileStorageFile();
     3509            Utf8Str NVRAMPath = pSnapMachine->mNvramStore->i_getNonVolatileStorageFile();
    35033510            if (NVRAMPath.isNotEmpty() && RTFileExists(NVRAMPath.c_str()))
    35043511                RTFileDelete(NVRAMPath.c_str());
  • trunk/src/VBox/Main/xml/Settings.cpp

    r91213 r91326  
    25842584        && apicMode == APICMode_APIC
    25852585        && llTimeOffset == 0
    2586         && strLogoImagePath.isEmpty()
    2587         && strNVRAMPath.isEmpty();
     2586        && strLogoImagePath.isEmpty();
    25882587}
    25892588
     
    26062605            && apicMode                == d.apicMode
    26072606            && llTimeOffset            == d.llTimeOffset
    2608             && strLogoImagePath        == d.strLogoImagePath
    2609             && strNVRAMPath            == d.strNVRAMPath);
     2607            && strLogoImagePath        == d.strLogoImagePath);
    26102608}
    26112609
     
    28552853            && strLocation     == g.strLocation);
    28562854}
     2855
     2856/**
     2857 * Constructor. Needs to set sane defaults which stand the test of time.
     2858 */
     2859NvramSettings::NvramSettings()
     2860{
     2861}
     2862
     2863/**
     2864 * Check if all settings have default values.
     2865 */
     2866bool NvramSettings::areDefaultSettings() const
     2867{
     2868    return strNvramPath.isEmpty();
     2869}
     2870
     2871/**
     2872 * Comparison operator. This gets called from MachineConfigFile::operator==,
     2873 * which in turn gets called from Machine::saveSettings to figure out whether
     2874 * machine settings have really changed and thus need to be written out to disk.
     2875 */
     2876bool NvramSettings::operator==(const NvramSettings &g) const
     2877{
     2878    return (this == &g)
     2879        || (strNvramPath    == g.strNvramPath);
     2880}
     2881
    28572882
    28582883/**
     
    35313556            && vrdeSettings                   == h.vrdeSettings
    35323557            && biosSettings                   == h.biosSettings
     3558            && nvramSettings                  == h.nvramSettings
    35333559            && graphicsAdapter                == h.graphicsAdapter
    35343560            && usbSettings                    == h.usbSettings
     
    49244950                pelmBIOSChild->getAttributeValue("value", hw.biosSettings.llTimeOffset);
    49254951            if ((pelmBIOSChild = pelmHwChild->findChildElement("NVRAM")))
    4926                 pelmBIOSChild->getAttributeValue("path", hw.biosSettings.strNVRAMPath);
     4952                pelmBIOSChild->getAttributeValue("path", hw.nvramSettings.strNvramPath);
    49274953            if ((pelmBIOSChild = pelmHwChild->findChildElement("SmbiosUuidLittleEndian")))
    49284954                pelmBIOSChild->getAttributeValue("enabled", hw.biosSettings.fSmbiosUuidLittleEndian);
     
    64436469        if (hw.biosSettings.fPXEDebugEnabled)
    64446470            pelmBIOS->createChild("PXEDebug")->setAttribute("enabled", hw.biosSettings.fPXEDebugEnabled);
    6445         if (!hw.biosSettings.strNVRAMPath.isEmpty())
    6446             pelmBIOS->createChild("NVRAM")->setAttribute("path", hw.biosSettings.strNVRAMPath);
     6471        if (!hw.nvramSettings.strNvramPath.isEmpty())
     6472            pelmBIOS->createChild("NVRAM")->setAttribute("path", hw.nvramSettings.strNvramPath);
    64476473        if (hw.biosSettings.fSmbiosUuidLittleEndian)
    64486474            pelmBIOS->createChild("SmbiosUuidLittleEndian")->setAttribute("enabled", hw.biosSettings.fSmbiosUuidLittleEndian);
     
    77817807    if (m->sv < SettingsVersion_v1_18)
    77827808    {
    7783         if (!hardwareMachine.biosSettings.strNVRAMPath.isEmpty())
     7809        if (!hardwareMachine.nvramSettings.strNvramPath.isEmpty())
    77847810        {
    77857811            m->sv = SettingsVersion_v1_18;
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