Changeset 61138 in vbox
- Timestamp:
- May 23, 2016 6:32:40 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/settings.h
r61042 r61138 541 541 542 542 bool areGenericDriverDefaultSettings() const; 543 bool areDefaultSettings( ) const;543 bool areDefaultSettings(SettingsVersion_T sv) const; 544 544 bool areDisabledDefaultSettings() const; 545 545 … … 878 878 bool areDisplayDefaultSettings() const; 879 879 bool areVideoCaptureDefaultSettings() const; 880 bool areAllNetworkAdaptersDefaultSettings( ) const;880 bool areAllNetworkAdaptersDefaultSettings(SettingsVersion_T sv) const; 881 881 882 882 bool operator==(const Hardware&) const; -
trunk/src/VBox/Main/xml/Settings.cpp
r61115 r61138 2335 2335 type(NetworkAdapterType_Am79C973), 2336 2336 fEnabled(false), 2337 fCableConnected( true),2337 fCableConnected(false), // default for old VMs, for new ones it's true 2338 2338 ulLineSpeed(0), 2339 2339 enmPromiscModePolicy(NetworkAdapterPromiscModePolicy_Deny), … … 2356 2356 * Check if all settings have default values. 2357 2357 */ 2358 bool NetworkAdapter::areDefaultSettings() const 2359 { 2358 bool NetworkAdapter::areDefaultSettings(SettingsVersion_T sv) const 2359 { 2360 // 5.0 and earlier had a default of fCableConnected=false, which doesn't 2361 // make a lot of sense (but it's a fact). Later versions don't save the 2362 // setting if it's at the default value and thus must get it right. 2360 2363 return !fEnabled 2361 2364 && strMACAddress.isEmpty() 2362 && fCableConnected 2365 && ( (sv >= SettingsVersion_v1_16 && fCableConnected) 2366 || (sv < SettingsVersion_v1_16 && !fCableConnected)) 2363 2367 && ulLineSpeed == 0 2364 2368 && enmPromiscModePolicy == NetworkAdapterPromiscModePolicy_Deny … … 2762 2766 { 2763 2767 // 5.0 didn't save the paravirt settings if it is ParavirtProvider_Legacy, 2764 // so this default must be kept. Later versions don't save this release. Newer versionsRemember, this is the default for VMs created with 5.0, and older2765 // VMs will keep ParavirtProvider_Legacy which must be saved.2768 // so this default must be kept. Later versions don't save the setting if 2769 // it's at the default value. 2766 2770 return ( (sv >= SettingsVersion_v1_16 && paravirtProvider == ParavirtProvider_Default) 2767 || (sv == SettingsVersion_v1_15&& paravirtProvider == ParavirtProvider_Legacy))2771 || (sv < SettingsVersion_v1_16 && paravirtProvider == ParavirtProvider_Legacy)) 2768 2772 && strParavirtDebug.isEmpty(); 2769 2773 } … … 2817 2821 * Check if all Network Adapter settings have default values. 2818 2822 */ 2819 bool Hardware::areAllNetworkAdaptersDefaultSettings( ) const2823 bool Hardware::areAllNetworkAdaptersDefaultSettings(SettingsVersion_T sv) const 2820 2824 { 2821 2825 for (NetworkAdaptersList::const_iterator it = llNetworkAdapters.begin(); … … 2823 2827 ++it) 2824 2828 { 2825 if (!it->areDefaultSettings( ))2829 if (!it->areDefaultSettings(sv)) 2826 2830 return false; 2827 2831 } … … 3280 3284 NetworkAdapter nic; 3281 3285 3286 if (m->sv >= SettingsVersion_v1_16) 3287 { 3288 /* Starting with VirtualBox 5.1 the default is true, before it was 3289 * false. This needs to matched by NetworkAdapter.areDefaultSettings(). */ 3290 nic.fCableConnected = true; 3291 } 3292 3282 3293 if (!pelmAdapter->getAttributeValue("slot", nic.ulSlot)) 3283 3294 throw ConfigFileError(this, pelmAdapter, N_("Required Adapter/@slot attribute is missing")); … … 5684 5695 5685 5696 if ( hw.llNetworkAdapters.size() 5686 && !hw.areAllNetworkAdaptersDefaultSettings( ))5697 && !hw.areAllNetworkAdaptersDefaultSettings(m->sv)) 5687 5698 { 5688 5699 xml::ElementNode *pelmNetwork = pelmHardware->createChild("Network"); … … 5693 5704 const NetworkAdapter &nic = *it; 5694 5705 5695 if (!nic.areDefaultSettings( ))5706 if (!nic.areDefaultSettings(m->sv)) 5696 5707 { 5697 5708 xml::ElementNode *pelmAdapter = pelmNetwork->createChild("Adapter"); … … 5701 5712 if (!nic.strMACAddress.isEmpty()) 5702 5713 pelmAdapter->setAttribute("MACAddress", nic.strMACAddress); 5703 if (!nic.fCableConnected) 5714 if ( (m->sv >= SettingsVersion_v1_16 && !nic.fCableConnected) 5715 || (m->sv < SettingsVersion_v1_16 && nic.fCableConnected)) 5704 5716 pelmAdapter->setAttribute("cable", nic.fCableConnected); 5705 5717 if (nic.ulLineSpeed)
Note:
See TracChangeset
for help on using the changeset viewer.