summaryrefslogtreecommitdiff
path: root/src/VBox/Main/xml/Settings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/xml/Settings.cpp')
-rw-r--r--src/VBox/Main/xml/Settings.cpp375
1 files changed, 273 insertions, 102 deletions
diff --git a/src/VBox/Main/xml/Settings.cpp b/src/VBox/Main/xml/Settings.cpp
index 5fab71d07..4fe0af5d9 100644
--- a/src/VBox/Main/xml/Settings.cpp
+++ b/src/VBox/Main/xml/Settings.cpp
@@ -1,4 +1,4 @@
-/* $Id: Settings.cpp $ */
+/* $Id: Settings.cpp 37927 2011-07-13 15:48:41Z vboxsync $ */
/** @file
* Settings File Manipulation API.
*
@@ -90,7 +90,7 @@ using namespace settings;
#define VBOX_XML_NAMESPACE "http://www.innotek.de/VirtualBox-settings"
/** VirtualBox XML settings version number substring ("x.y") */
-#define VBOX_XML_VERSION "1.11"
+#define VBOX_XML_VERSION "1.12"
/** VirtualBox XML settings version platform substring */
#if defined (RT_OS_DARWIN)
@@ -141,7 +141,7 @@ struct ConfigFileBase::Data
cleanup();
}
- iprt::MiniString strFilename;
+ RTCString strFilename;
bool fFileExists;
xml::Document *pDoc;
@@ -319,13 +319,15 @@ ConfigFileBase::ConfigFileBase(const com::Utf8Str *pstrFilename)
m->sv = SettingsVersion_v1_10;
else if (ulMinor == 11)
m->sv = SettingsVersion_v1_11;
- else if (ulMinor > 11)
+ else if (ulMinor == 12)
+ m->sv = SettingsVersion_v1_12;
+ else if (ulMinor > 12)
m->sv = SettingsVersion_Future;
}
else if (ulMajor > 1)
m->sv = SettingsVersion_Future;
- LogRel(("Parsed settings version %d.%d to enum value %d\n", ulMajor, ulMinor, m->sv));
+ Log(("Parsed settings version %d.%d to enum value %d\n", ulMajor, ulMinor, m->sv));
}
if (m->sv == SettingsVersion_Null)
@@ -339,10 +341,18 @@ ConfigFileBase::ConfigFileBase(const com::Utf8Str *pstrFilename)
{
// creating new settings file:
m->strSettingsVersionFull = VBOX_XML_VERSION_FULL;
- m->sv = SettingsVersion_v1_11;
+ m->sv = SettingsVersion_v1_12;
}
}
+ConfigFileBase::ConfigFileBase(const ConfigFileBase &other)
+ : m(new Data)
+{
+ copyBaseFrom(other);
+ m->strFilename = "";
+ m->fFileExists = false;
+}
+
/**
* Clean up.
*/
@@ -691,7 +701,7 @@ void ConfigFileBase::readMedium(MediaType t,
// DVD and floppy images before 1.11 had no format attribute. assign the default.
med.strFormat = "RAW";
}
-
+
if (t == DVDImage)
med.hdType = MediumType_Readonly;
else if (t == FloppyImage)
@@ -818,18 +828,22 @@ void ConfigFileBase::setVersionAttribute(xml::ElementNode &elm)
pcszVersion = "1.11";
break;
+ case SettingsVersion_v1_12:
+ pcszVersion = "1.12";
+ break;
+
case SettingsVersion_Future:
// can be set if this code runs on XML files that were created by a future version of VBox;
// in that case, downgrade to current version when writing since we can't write future versions...
- pcszVersion = "1.11";
- m->sv = SettingsVersion_v1_11;
- break;
+ pcszVersion = "1.12";
+ m->sv = SettingsVersion_v1_12;
+ break;
default:
// silently upgrade if this is less than 1.7 because that's the oldest we can write
pcszVersion = "1.7";
m->sv = SettingsVersion_v1_7;
- break;
+ break;
}
elm.setAttribute("version", Utf8StrFmt("%s-%s",
@@ -846,7 +860,7 @@ void ConfigFileBase::setVersionAttribute(xml::ElementNode &elm)
* Before calling this, it is the responsibility of the caller to
* set the "sv" member to the required settings version that is to
* be written. For newly created files, the settings version will be
- * the latest (1.11); for files read in from disk earlier, it will be
+ * the latest (1.12); for files read in from disk earlier, it will be
* the settings version indicated in the file. However, this method
* will silently make sure that the settings version is always
* at least 1.7 and change it if necessary, since there is no write
@@ -1462,19 +1476,23 @@ bool USBController::operator==(const USBController &u) const
bool NetworkAdapter::operator==(const NetworkAdapter &n) const
{
return ( (this == &n)
- || ( (ulSlot == n.ulSlot)
- && (type == n.type)
- && (fEnabled == n.fEnabled)
- && (strMACAddress == n.strMACAddress)
- && (fCableConnected == n.fCableConnected)
- && (ulLineSpeed == n.ulLineSpeed)
- && (fTraceEnabled == n.fTraceEnabled)
- && (strTraceFile == n.strTraceFile)
- && (mode == n.mode)
- && (nat == n.nat)
- && (strName == n.strName)
- && (ulBootPriority == n.ulBootPriority)
- && (fHasDisabledNAT == n.fHasDisabledNAT)
+ || ( (ulSlot == n.ulSlot)
+ && (type == n.type)
+ && (fEnabled == n.fEnabled)
+ && (strMACAddress == n.strMACAddress)
+ && (fCableConnected == n.fCableConnected)
+ && (ulLineSpeed == n.ulLineSpeed)
+ && (enmPromiscModePolicy == n.enmPromiscModePolicy)
+ && (fTraceEnabled == n.fTraceEnabled)
+ && (strTraceFile == n.strTraceFile)
+ && (mode == n.mode)
+ && (nat == n.nat)
+ && (strBridgedName == n.strBridgedName)
+ && (strHostOnlyName == n.strHostOnlyName)
+ && (strInternalNetworkName == n.strInternalNetworkName)
+ && (strGenericDriver == n.strGenericDriver)
+ && (genericProperties == n.genericProperties)
+ && (ulBootPriority == n.ulBootPriority)
)
);
}
@@ -1657,6 +1675,7 @@ bool Hardware::operator==(const Hardware& h) const
&& (llGuestProperties == h.llGuestProperties)
&& (strNotificationPatterns == h.strNotificationPatterns)
&& (ioSettings == h.ioSettings)
+ && (pciAttachments == h.pciAttachments)
)
);
}
@@ -1671,6 +1690,8 @@ bool AttachedDevice::operator==(const AttachedDevice &a) const
return ( (this == &a)
|| ( (deviceType == a.deviceType)
&& (fPassThrough == a.fPassThrough)
+ && (fTempEject == a.fTempEject)
+ && (fNonRotational == a.fNonRotational)
&& (lPort == a.lPort)
&& (lDevice == a.lDevice)
&& (uuid == a.uuid)
@@ -1934,10 +1955,24 @@ void MachineConfigFile::readNetworkAdapters(const xml::ElementNode &elmNetwork,
pelmAdapter->getAttributeValue("MACAddress", nic.strMACAddress);
pelmAdapter->getAttributeValue("cable", nic.fCableConnected);
pelmAdapter->getAttributeValue("speed", nic.ulLineSpeed);
+
+ if (pelmAdapter->getAttributeValue("promiscuousModePolicy", strTemp))
+ {
+ if (strTemp == "Deny")
+ nic.enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_Deny;
+ else if (strTemp == "AllowNetwork")
+ nic.enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowNetwork;
+ else if (strTemp == "AllowAll")
+ nic.enmPromiscModePolicy = NetworkAdapterPromiscModePolicy_AllowAll;
+ else
+ throw ConfigFileError(this, pelmAdapter,
+ N_("Invalid value '%s' in Adapter/@promiscuousModePolicy attribute"), strTemp.c_str());
+ }
+
pelmAdapter->getAttributeValue("trace", nic.fTraceEnabled);
pelmAdapter->getAttributeValue("tracefile", nic.strTraceFile);
pelmAdapter->getAttributeValue("bootPriority", nic.ulBootPriority);
- pelmAdapter->getAttributeValue("bandwidthLimit", nic.ulBandwidthLimit);
+ pelmAdapter->getAttributeValue("bandwidthGroup", nic.strBandwidthGroup);
xml::ElementNodesList llNetworkModes;
pelmAdapter->getChildElements(llNetworkModes);
@@ -1974,13 +2009,12 @@ void MachineConfigFile::readNetworkAdapters(const xml::ElementNode &elmNetwork,
void MachineConfigFile::readAttachedNetworkMode(const xml::ElementNode &elmMode, bool fEnabled, NetworkAdapter &nic)
{
+ NetworkAttachmentType_T enmAttachmentType = NetworkAttachmentType_Null;
+
if (elmMode.nameEquals("NAT"))
{
- if (fEnabled)
- nic.mode = NetworkAttachmentType_NAT;
+ enmAttachmentType = NetworkAttachmentType_NAT;
- nic.fHasDisabledNAT = (nic.mode != NetworkAttachmentType_NAT && !fEnabled);
- elmMode.getAttributeValue("network", nic.nat.strNetwork); // optional network name
elmMode.getAttributeValue("hostip", nic.nat.strBindIP);
elmMode.getAttributeValue("mtu", nic.nat.u32Mtu);
elmMode.getAttributeValue("sockrcv", nic.nat.u32SockRcv);
@@ -2025,36 +2059,62 @@ void MachineConfigFile::readAttachedNetworkMode(const xml::ElementNode &elmMode,
nic.nat.llRules.push_back(rule);
}
}
- else if ( fEnabled
- && ( (elmMode.nameEquals("HostInterface"))
- || (elmMode.nameEquals("BridgedInterface")))
- )
+ else if ( (elmMode.nameEquals("HostInterface"))
+ || (elmMode.nameEquals("BridgedInterface")))
{
- nic.mode = NetworkAttachmentType_Bridged;
- elmMode.getAttributeValue("name", nic.strName); // optional host interface name
+ enmAttachmentType = NetworkAttachmentType_Bridged;
+
+ elmMode.getAttributeValue("name", nic.strBridgedName); // optional bridged interface name
}
- else if ( fEnabled
- && elmMode.nameEquals("InternalNetwork"))
+ else if (elmMode.nameEquals("InternalNetwork"))
{
- nic.mode = NetworkAttachmentType_Internal;
- if (!elmMode.getAttributeValue("name", nic.strName)) // required network name
+ enmAttachmentType = NetworkAttachmentType_Internal;
+
+ if (!elmMode.getAttributeValue("name", nic.strInternalNetworkName)) // required network name
throw ConfigFileError(this, &elmMode, N_("Required InternalNetwork/@name element is missing"));
}
- else if ( fEnabled
- && elmMode.nameEquals("HostOnlyInterface"))
+ else if (elmMode.nameEquals("HostOnlyInterface"))
{
- nic.mode = NetworkAttachmentType_HostOnly;
- if (!elmMode.getAttributeValue("name", nic.strName)) // required network name
+ enmAttachmentType = NetworkAttachmentType_HostOnly;
+
+ if (!elmMode.getAttributeValue("name", nic.strHostOnlyName)) // required network name
throw ConfigFileError(this, &elmMode, N_("Required HostOnlyInterface/@name element is missing"));
}
-#if defined(VBOX_WITH_VDE)
- else if ( fEnabled
- && elmMode.nameEquals("VDE"))
+ else if (elmMode.nameEquals("GenericInterface"))
+ {
+ enmAttachmentType = NetworkAttachmentType_Generic;
+
+ elmMode.getAttributeValue("driver", nic.strGenericDriver); // optional network attachment driver
+
+ // get all properties
+ xml::NodesLoop nl(elmMode);
+ const xml::ElementNode *pelmModeChild;
+ while ((pelmModeChild = nl.forAllNodes()))
+ {
+ if (pelmModeChild->nameEquals("Property"))
+ {
+ Utf8Str strPropName, strPropValue;
+ if ( (pelmModeChild->getAttributeValue("name", strPropName))
+ && (pelmModeChild->getAttributeValue("value", strPropValue))
+ )
+ nic.genericProperties[strPropName] = strPropValue;
+ else
+ throw ConfigFileError(this, pelmModeChild, N_("Required GenericInterface/Property/@name or @value attribute is missing"));
+ }
+ }
+ }
+ else if (elmMode.nameEquals("VDE"))
{
- nic.mode = NetworkAttachmentType_VDE;
- elmMode.getAttributeValue("network", nic.strName); // optional network name
+ enmAttachmentType = NetworkAttachmentType_Generic;
+
+ com::Utf8Str strVDEName;
+ elmMode.getAttributeValue("network", strVDEName); // optional network name
+ nic.strGenericDriver = "VDE";
+ nic.genericProperties["network"] = strVDEName;
}
-#endif
+
+ if (fEnabled && enmAttachmentType != NetworkAttachmentType_Null)
+ nic.mode = enmAttachmentType;
}
/**
@@ -2728,6 +2788,29 @@ void MachineConfigFile::readHardware(const xml::ElementNode &elmHardware,
hw.ioSettings.llBandwidthGroups.push_back(gr);
}
}
+ } else if (pelmHwChild->nameEquals("HostPci")) {
+ const xml::ElementNode *pelmDevices;
+
+ if ((pelmDevices = pelmHwChild->findChildElement("Devices")))
+ {
+ xml::NodesLoop nl2(*pelmDevices, "Device");
+ const xml::ElementNode *pelmDevice;
+ while ((pelmDevice = nl2.forAllNodes()))
+ {
+ HostPciDeviceAttachment hpda;
+
+ if (!pelmDevice->getAttributeValue("host", hpda.uHostAddress))
+ throw ConfigFileError(this, pelmDevice, N_("Missing Device/@host attribute"));
+
+ if (!pelmDevice->getAttributeValue("guest", hpda.uGuestAddress))
+ throw ConfigFileError(this, pelmDevice, N_("Missing Device/@guest attribute"));
+
+ /* name is optional */
+ pelmDevice->getAttributeValue("name", hpda.strDeviceName);
+
+ hw.pciAttachments.push_back(hpda);
+ }
+ }
}
}
@@ -2901,7 +2984,10 @@ void MachineConfigFile::readStorageControllers(const xml::ElementNode &elmStorag
pelmAttached->getAttributeValue("type", strTemp);
if (strTemp == "HardDisk")
+ {
att.deviceType = DeviceType_HardDisk;
+ pelmAttached->getAttributeValue("nonrotational", att.fNonRotational);
+ }
else if (m->sv >= SettingsVersion_v1_9)
{
// starting with 1.9 we list DVD and floppy drive info + attachments under <StorageControllers>
@@ -2909,6 +2995,7 @@ void MachineConfigFile::readStorageControllers(const xml::ElementNode &elmStorag
{
att.deviceType = DeviceType_DVD;
pelmAttached->getAttributeValue("passthrough", att.fPassThrough);
+ pelmAttached->getAttributeValue("tempeject", att.fTempEject);
}
else if (strTemp == "Floppy")
att.deviceType = DeviceType_Floppy;
@@ -2980,6 +3067,7 @@ void MachineConfigFile::readDVDAndFloppies_pre1_9(const xml::ElementNode &elmHar
att.lPort = 1;
att.lDevice = 0;
pelmHwChild->getAttributeValue("passthrough", att.fPassThrough);
+ pelmHwChild->getAttributeValue("tempeject", att.fTempEject);
const xml::ElementNode *pDriveChild;
Utf8Str strTmp;
@@ -3212,6 +3300,8 @@ void MachineConfigFile::readMachine(const xml::ElementNode &elmMachine)
if (elmMachine.getAttributeValue("lastStateChange", str))
parseTimestamp(timeLastStateChange, str);
// constructor has called RTTimeNow(&timeLastStateChange) before
+ if (elmMachine.getAttributeValue("aborted", fAborted))
+ fAborted = true;
// parse Hardware before the other elements because other things depend on it
const xml::ElementNode *pelmHardware;
@@ -3376,11 +3466,11 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
switch (hw.firmwareType)
{
- case FirmwareType_EFI: pcszFirmware = "EFI"; break;
- case FirmwareType_EFI32: pcszFirmware = "EFI32"; break;
- case FirmwareType_EFI64: pcszFirmware = "EFI64"; break;
+ case FirmwareType_EFI: pcszFirmware = "EFI"; break;
+ case FirmwareType_EFI32: pcszFirmware = "EFI32"; break;
+ case FirmwareType_EFI64: pcszFirmware = "EFI64"; break;
case FirmwareType_EFIDUAL: pcszFirmware = "EFIDUAL"; break;
- default: pcszFirmware = "None"; break;
+ default: pcszFirmware = "None"; break;
}
pelmFirmware->setAttribute("type", pcszFirmware);
}
@@ -3601,6 +3691,8 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
++cDVDs;
pelmDVD->setAttribute("passthrough", att.fPassThrough);
+ if (att.fTempEject)
+ pelmDVD->setAttribute("tempeject", att.fTempEject);
if (!att.uuid.isEmpty())
pelmDVD->createChild("Image")->setAttribute("uuid", att.uuid.toStringCurly());
else if (att.strHostDriveSrc.length())
@@ -3663,8 +3755,19 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
pelmAdapter->setAttribute("trace", nic.fTraceEnabled);
pelmAdapter->setAttribute("tracefile", nic.strTraceFile);
}
- if (nic.ulBandwidthLimit)
- pelmAdapter->setAttribute("bandwidthLimit", nic.ulBandwidthLimit);
+ if (nic.strBandwidthGroup.isNotEmpty())
+ pelmAdapter->setAttribute("bandwidthGroup", nic.strBandwidthGroup);
+
+ const char *pszPolicy;
+ switch (nic.enmPromiscModePolicy)
+ {
+ case NetworkAdapterPromiscModePolicy_Deny: pszPolicy = NULL; break;
+ case NetworkAdapterPromiscModePolicy_AllowNetwork: pszPolicy = "AllowNetwork"; break;
+ case NetworkAdapterPromiscModePolicy_AllowAll: pszPolicy = "AllowAll"; break;
+ default: pszPolicy = NULL; AssertFailed(); break;
+ }
+ if (pszPolicy)
+ pelmAdapter->setAttribute("promiscuousModePolicy", pszPolicy);
const char *pcszType;
switch (nic.type)
@@ -3687,39 +3790,40 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
pelmNAT = pelmAdapter->createChild("NAT");
if (nic.nat.strNetwork.length())
pelmNAT->setAttribute("network", nic.nat.strNetwork);
- break;
+ break;
case NetworkAttachmentType_Bridged:
- pelmAdapter->createChild("BridgedInterface")->setAttribute("name", nic.strName);
- break;
+ pelmAdapter->createChild("BridgedInterface")->setAttribute("name", nic.strBridgedName);
+ break;
case NetworkAttachmentType_Internal:
- pelmAdapter->createChild("InternalNetwork")->setAttribute("name", nic.strName);
- break;
+ pelmAdapter->createChild("InternalNetwork")->setAttribute("name", nic.strInternalNetworkName);
+ break;
case NetworkAttachmentType_HostOnly:
- pelmAdapter->createChild("HostOnlyInterface")->setAttribute("name", nic.strName);
- break;
-
-#if defined(VBOX_WITH_VDE)
- case NetworkAttachmentType_VDE:
- pelmAdapter->createChild("VDE")->setAttribute("network", nic.strName);
- break;
-#endif
+ pelmAdapter->createChild("HostOnlyInterface")->setAttribute("name", nic.strHostOnlyName);
+ break;
default: /*case NetworkAttachmentType_Null:*/
- break;
+ break;
}
}
else
{
/* m->sv >= SettingsVersion_v1_10 */
- xml::ElementNode *pelmDisabledNode= NULL;
- if (nic.fHasDisabledNAT)
- pelmDisabledNode = pelmAdapter->createChild("DisabledModes");
- if (nic.fHasDisabledNAT)
- buildNetworkXML(NetworkAttachmentType_NAT, *pelmDisabledNode, nic);
- buildNetworkXML(nic.mode, *pelmAdapter, nic);
+ xml::ElementNode *pelmDisabledNode = NULL;
+ pelmDisabledNode = pelmAdapter->createChild("DisabledModes");
+ if (nic.mode != NetworkAttachmentType_NAT)
+ buildNetworkXML(NetworkAttachmentType_NAT, *pelmDisabledNode, false, nic);
+ if (nic.mode != NetworkAttachmentType_Bridged)
+ buildNetworkXML(NetworkAttachmentType_Bridged, *pelmDisabledNode, false, nic);
+ if (nic.mode != NetworkAttachmentType_Internal)
+ buildNetworkXML(NetworkAttachmentType_HostOnly, *pelmDisabledNode, false, nic);
+ if (nic.mode != NetworkAttachmentType_HostOnly)
+ buildNetworkXML(NetworkAttachmentType_HostOnly, *pelmDisabledNode, false, nic);
+ if (nic.mode != NetworkAttachmentType_Generic)
+ buildNetworkXML(NetworkAttachmentType_Generic, *pelmDisabledNode, false, nic);
+ buildNetworkXML(nic.mode, *pelmAdapter, true, nic);
}
}
@@ -3790,7 +3894,8 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
/* fall through */
case AudioControllerType_AC97:
default:
- pcszController = "AC97"; break;
+ pcszController = "AC97";
+ break;
}
pelmAudio->setAttribute("controller", pcszController);
@@ -3872,6 +3977,25 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
}
}
+ if (m->sv >= SettingsVersion_v1_12)
+ {
+ xml::ElementNode *pelmPci = pelmHardware->createChild("HostPci");
+ xml::ElementNode *pelmPciDevices = pelmPci->createChild("Devices");
+
+ for (HostPciDeviceAttachmentList::const_iterator it = hw.pciAttachments.begin();
+ it != hw.pciAttachments.end();
+ ++it)
+ {
+ const HostPciDeviceAttachment &hpda = *it;
+
+ xml::ElementNode *pelmThis = pelmPciDevices->createChild("Device");
+
+ pelmThis->setAttribute("host", hpda.uHostAddress);
+ pelmThis->setAttribute("guest", hpda.uGuestAddress);
+ pelmThis->setAttribute("name", hpda.strDeviceName);
+ }
+ }
+
xml::ElementNode *pelmGuest = pelmHardware->createChild("Guest");
pelmGuest->setAttribute("memoryBalloonSize", hw.ulMemoryBalloonSize);
@@ -3896,10 +4020,12 @@ void MachineConfigFile::buildHardwareXML(xml::ElementNode &elmParent,
* Fill a <Network> node. Only relevant for XML version >= v1_10.
* @param mode
* @param elmParent
- * @param nice
+ * @param fEnabled
+ * @param nic
*/
void MachineConfigFile::buildNetworkXML(NetworkAttachmentType_T mode,
xml::ElementNode &elmParent,
+ bool fEnabled,
const NetworkAdapter &nic)
{
switch (mode)
@@ -3964,28 +4090,41 @@ void MachineConfigFile::buildNetworkXML(NetworkAttachmentType_T mode,
if ((*rule).u16GuestPort)
pelmPF->setAttribute("guestport", (*rule).u16GuestPort);
}
- break;
+ break;
case NetworkAttachmentType_Bridged:
- elmParent.createChild("BridgedInterface")->setAttribute("name", nic.strName);
- break;
+ if (fEnabled || !nic.strBridgedName.isEmpty())
+ elmParent.createChild("BridgedInterface")->setAttribute("name", nic.strBridgedName);
+ break;
case NetworkAttachmentType_Internal:
- elmParent.createChild("InternalNetwork")->setAttribute("name", nic.strName);
- break;
+ if (fEnabled || !nic.strInternalNetworkName.isEmpty())
+ elmParent.createChild("InternalNetwork")->setAttribute("name", nic.strInternalNetworkName);
+ break;
case NetworkAttachmentType_HostOnly:
- elmParent.createChild("HostOnlyInterface")->setAttribute("name", nic.strName);
- break;
+ if (fEnabled || !nic.strHostOnlyName.isEmpty())
+ elmParent.createChild("HostOnlyInterface")->setAttribute("name", nic.strHostOnlyName);
+ break;
-#ifdef VBOX_WITH_VDE
- case NetworkAttachmentType_VDE:
- elmParent.createChild("VDE")->setAttribute("network", nic.strName);
- break;
-#endif
+ case NetworkAttachmentType_Generic:
+ if (fEnabled || !nic.strGenericDriver.isEmpty() || nic.genericProperties.size())
+ {
+ xml::ElementNode *pelmMode = elmParent.createChild("GenericInterface");
+ pelmMode->setAttribute("driver", nic.strGenericDriver);
+ for (StringsMap::const_iterator it = nic.genericProperties.begin();
+ it != nic.genericProperties.end();
+ ++it)
+ {
+ xml::ElementNode *pelmProp = pelmMode->createChild("Property");
+ pelmProp->setAttribute("name", it->first);
+ pelmProp->setAttribute("value", it->second);
+ }
+ }
+ break;
default: /*case NetworkAttachmentType_Null:*/
- break;
+ break;
}
}
@@ -4094,16 +4233,20 @@ void MachineConfigFile::buildStorageControllersXML(xml::ElementNode &elmParent,
{
case DeviceType_HardDisk:
pcszType = "HardDisk";
- break;
+ if (att.fNonRotational)
+ pelmDevice->setAttribute("nonrotational", att.fNonRotational);
+ break;
case DeviceType_DVD:
pcszType = "DVD";
pelmDevice->setAttribute("passthrough", att.fPassThrough);
- break;
+ if (att.fTempEject)
+ pelmDevice->setAttribute("tempeject", att.fTempEject);
+ break;
case DeviceType_Floppy:
pcszType = "Floppy";
- break;
+ break;
}
pelmDevice->setAttribute("type", pcszType);
@@ -4383,9 +4526,9 @@ AudioDriverType_T MachineConfigFile::getHostDefaultAudioDriver()
return AudioDriverType_SolAudio;
#elif defined(RT_OS_LINUX)
// on Linux, we need to check at runtime what's actually supported...
- static RTLockMtx s_mtx;
+ static RTCLockMtx s_mtx;
static AudioDriverType_T s_linuxDriver = -1;
- RTLock lock(s_mtx);
+ RTCLock lock(s_mtx);
if (s_linuxDriver == (AudioDriverType_T)-1)
{
# if defined(VBOX_WITH_PULSE)
@@ -4397,9 +4540,9 @@ AudioDriverType_T MachineConfigFile::getHostDefaultAudioDriver()
# endif /* VBOX_WITH_PULSE */
# if defined(VBOX_WITH_ALSA)
/* Check if we can load the ALSA library */
- if (RTLdrIsLoadable("libasound.so.2"))
+ if (RTLdrIsLoadable("libasound.so.2"))
s_linuxDriver = AudioDriverType_ALSA;
- else
+ else
# endif /* VBOX_WITH_ALSA */
s_linuxDriver = AudioDriverType_OSS;
}
@@ -4427,6 +4570,34 @@ AudioDriverType_T MachineConfigFile::getHostDefaultAudioDriver()
*/
void MachineConfigFile::bumpSettingsVersionIfNeeded()
{
+ if (m->sv < SettingsVersion_v1_12)
+ {
+ // VirtualBox 4.1 adds PCI passthrough.
+ if (hardwareMachine.pciAttachments.size())
+ m->sv = SettingsVersion_v1_12;
+ }
+
+ if (m->sv < SettingsVersion_v1_12)
+ {
+ // VirtualBox 4.1 adds a promiscuous mode policy to the network
+ // adapters and a generic network driver transport.
+ NetworkAdaptersList::const_iterator netit;
+ for (netit = hardwareMachine.llNetworkAdapters.begin();
+ netit != hardwareMachine.llNetworkAdapters.end();
+ ++netit)
+ {
+ if ( netit->enmPromiscModePolicy != NetworkAdapterPromiscModePolicy_Deny
+ || netit->mode == NetworkAttachmentType_Generic
+ || !netit->strGenericDriver.isEmpty()
+ || netit->genericProperties.size()
+ )
+ {
+ m->sv = SettingsVersion_v1_12;
+ break;
+ }
+ }
+ }
+
if (m->sv < SettingsVersion_v1_11)
{
// VirtualBox 4.0 adds HD audio, CPU priorities, fault tolerance,
@@ -4644,12 +4815,12 @@ void MachineConfigFile::bumpSettingsVersionIfNeeded()
netit != hardwareMachine.llNetworkAdapters.end();
++netit)
{
- if ( (m->sv < SettingsVersion_v1_11)
- && (netit->ulBandwidthLimit)
+ if ( (m->sv < SettingsVersion_v1_12)
+ && (netit->strBandwidthGroup.isNotEmpty())
)
{
- /* New in VirtualBox 4.0 */
- m->sv = SettingsVersion_v1_11;
+ /* New in VirtualBox 4.1 */
+ m->sv = SettingsVersion_v1_12;
break;
}
else if ( (m->sv < SettingsVersion_v1_10)