VirtualBox

Changeset 22198 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Aug 12, 2009 10:56:00 AM (15 years ago)
Author:
vboxsync
Message:

Main: document XML settings versions correctly; bring back DHCP server default config with new or upgraded main settings file; add mechanism to bump machine settings version if new features are requested

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r22197 r22198  
    14191419    mHWData.backup();
    14201420    mHWData->mAccelerate2DVideoEnabled = enable;
     1421
     1422    // this feature may require an XML version bump
     1423    mData->m_pMachineConfigFile->setRequiredSettingsVersion(SettingsVersion_v1_8);
    14211424
    14221425    return S_OK;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r22173 r22198  
    346346  -->
    347347
    348   <enum
    349        name="SettingsVersion"
    350        uuid="6e151282-c338-428a-989d-5f2402d87e6f"
    351        >
    352       <desc>
    353           Settings version of VirtualBox settings files. This is written to
     348  <enum name="SettingsVersion"
     349        uuid="6e151282-c338-428a-989d-5f2402d87e6f"
     350    >
     351    <desc>Settings version of VirtualBox settings files. This is written to
    354352          the "version" attribute of the root "VirtualBox" element in the settings
    355353          file XML and indicates which VirtualBox version wrote the file.
    356       </desc>
    357 
    358       <const name="Null"    value="0">
    359           <desc>Null value, indicates invalid version.</desc>
    360       </const>
    361       <const name="v1_0"     value="1">
    362           <desc>Settings version "1.0", understood by VirtualBox 3.0 and above.</desc>
    363       </const>
    364       <const name="v1_1"     value="2">
    365           <desc>Settings version "1.7", understood by VirtualBox 3.0 and above.</desc>
    366       </const>
    367       <const name="v1_2"     value="3">
    368           <desc>Settings version "1.2", understood by VirtualBox 3.0 and above.</desc>
    369       </const>
    370       <const name="v1_3pre"  value="4">
    371           <desc>Settings version "1.3pre", understood by VirtualBox 3.0 and above.</desc>
    372       </const>
    373       <const name="v1_3"     value="5">
    374           <desc>Settings version "1.3", understood by VirtualBox 3.0 and above.</desc>
    375       </const>
    376       <const name="v1_4"     value="6">
    377           <desc>Settings version "1.4", understood by VirtualBox 3.0 and above.</desc>
    378       </const>
    379       <const name="v1_5"     value="7">
    380           <desc>Settings version "1.5", understood by VirtualBox 3.0 and above.</desc>
    381       </const>
    382       <const name="v1_6"     value="8">
    383           <desc>Settings version "1.6", understood by VirtualBox 3.0 and above.</desc>
    384       </const>
    385       <const name="v1_7"     value="9">
    386           <desc>Settings version "1.7", understood by VirtualBox 3.0 and above.</desc>
    387       </const>
    388       <const name="v1_8"     value="10">
    389           <desc>Settings version "1.8", understood by VirtualBox 3.1 and above.</desc>
    390       </const>
     354    </desc>
     355
     356    <const name="Null"    value="0">
     357      <desc>Null value, indicates invalid version.</desc>
     358    </const>
     359    <const name="v1_0"     value="1">
     360      <desc>Legacy settings version, not currently supported.</desc>
     361    </const>
     362    <const name="v1_1"     value="2">
     363      <desc>Legacy settings version, not currently supported.</desc>
     364    </const>
     365    <const name="v1_2"     value="3">
     366      <desc>Legacy settings version, not currently supported.</desc>
     367    </const>
     368    <const name="v1_3pre"  value="4">
     369      <desc>Legacy settings version, not currently supported.</desc>
     370    </const>
     371    <const name="v1_3"     value="5">
     372      <desc>Legacy settings version, not currently supported.</desc>
     373    </const>
     374    <const name="v1_4"     value="6">
     375      <desc>Legacy settings version, not currently supported.</desc>
     376    </const>
     377    <const name="v1_5"     value="7">
     378      <desc>Settings version "1.5", written by VirtualBox 2.1.x.</desc>
     379      <!-- 2008-09-04: 2.0.0 released
     380           2008-11-20: settings version 1.5 introduced
     381           2008-12-17: 2.1.0 released -->
     382    </const>
     383    <const name="v1_6"     value="8">
     384      <desc>Intermediate settings version "1.6", understood by VirtualBox 2.2 and above.</desc>
     385      <!-- 2008-12-17: 2.1.0 released
     386           2008-12-19: settings version 1.6 introduced (is in 2.2 branch)
     387           2009-04-08: 2.2.0 released -->
     388    </const>
     389    <const name="v1_7"     value="9">
     390      <desc>Settings version "1.7", written by VirtualBox 2.2.x and 3.0.x.</desc>
     391      <!-- 2008-12-17: 2.1.0 released
     392           2009-03-11: settings version 1.7 introduced (is in 2.2 branch)
     393           2009-04-08: 2.2.0 released -->
     394    </const>
     395    <const name="v1_8"     value="10">
     396      <desc>Settings version "1.8", written by VirtualBox 3.1.x.</desc>
     397    </const>
    391398  </enum>
    392399
  • trunk/src/VBox/Main/xml/Settings.cpp

    r22197 r22198  
    726726        clearDocument();
    727727    }
     728
     729    // DHCP servers were introduced with settings version 1.7; if we're loading
     730    // from an older version OR this is a fresh install, then add one DHCP server
     731    // with default settings
     732    if (    (!llDhcpServers.size())
     733         && (    (!pstrFilename)                    // empty VirtualBox.xml file
     734              || (m->sv < SettingsVersion_v1_7)     // upgrading from before 1.7
     735            )
     736       )
     737    {
     738        DHCPServer srv;
     739        srv.strNetworkName =
     740#ifdef RT_OS_WINDOWS
     741            "HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter";
     742#else
     743            "HostInterfaceNetworking-vboxnet0";
     744#endif
     745        srv.strIPAddress = "192.168.56.100";
     746        srv.strIPNetworkMask = "255.255.255.0";
     747        srv.strIPLower = "192.168.56.101";
     748        srv.strIPUpper = "192.168.56.254";
     749        srv.fEnabled = true;
     750        llDhcpServers.push_back(srv);
     751    }
    728752}
    729753
     
    19912015}
    19922016
     2017/**
     2018 * Called from Main code if settings are enabled that require a new settings
     2019 * version. For example, if someone enables 2D video acceleration, which is a
     2020 * new feature with VirtualBox 3.1 and which requires settings version 1.8,
     2021 * COMSETTER(Accelerate2DVideoEnabled) calls this method to make sure
     2022 * at least settings version 1.8 is enabled.
     2023 *
     2024 * This allows us to preserve the settings format for older machines and
     2025 * break it only if necessary, on a per-machine basis.
     2026 * @param sv
     2027 */
     2028void MachineConfigFile::setRequiredSettingsVersion(SettingsVersion_T sv)
     2029{
     2030    if (m->sv < sv)
     2031        m->sv = sv;
     2032}
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