summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-11-02 11:07:14 +0000
committervboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f>2016-11-02 11:07:14 +0000
commit10771fe6aac15fc15f183536d45e4a09f7fe4384 (patch)
tree541f3b76367b79e639492997bc5bc6dbeaff6dc0
parentfa058f7fc15322a52cbab807be9bbb9ef2d58934 (diff)
downloadVirtualBox-svn-10771fe6aac15fc15f183536d45e4a09f7fe4384.tar.gz
Main/Settings: Network name settings have to be optional, otherwise there is trouble with inaccessible VMs when the settings are saved before the network name is updated. Happens easily with VBoxManage.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@64517 cfe28804-0f27-0410-a406-dd0f0b0b656f
-rw-r--r--src/VBox/Main/xml/Settings.cpp21
-rw-r--r--src/VBox/Main/xml/VirtualBox-settings.xsd8
2 files changed, 18 insertions, 11 deletions
diff --git a/src/VBox/Main/xml/Settings.cpp b/src/VBox/Main/xml/Settings.cpp
index e068ccf4f8b..d0b6f06efdf 100644
--- a/src/VBox/Main/xml/Settings.cpp
+++ b/src/VBox/Main/xml/Settings.cpp
@@ -3439,21 +3439,25 @@ void MachineConfigFile::readAttachedNetworkMode(const xml::ElementNode &elmMode,
{
enmAttachmentType = NetworkAttachmentType_Bridged;
- elmMode.getAttributeValue("name", nic.strBridgedName); // optional bridged interface name
+ // optional network name, cannot be required or we have trouble with
+ // settings which are saved before configuring the network name
+ elmMode.getAttributeValue("name", nic.strBridgedName);
}
else if (elmMode.nameEquals("InternalNetwork"))
{
enmAttachmentType = NetworkAttachmentType_Internal;
- if (!elmMode.getAttributeValue("name", nic.strInternalNetworkName)) // required network name
- throw ConfigFileError(this, &elmMode, N_("Required InternalNetwork/@name element is missing"));
+ // optional network name, cannot be required or we have trouble with
+ // settings which are saved before configuring the network name
+ elmMode.getAttributeValue("name", nic.strInternalNetworkName);
}
else if (elmMode.nameEquals("HostOnlyInterface"))
{
enmAttachmentType = NetworkAttachmentType_HostOnly;
- if (!elmMode.getAttributeValue("name", nic.strHostOnlyName)) // required network name
- throw ConfigFileError(this, &elmMode, N_("Required HostOnlyInterface/@name element is missing"));
+ // optional network name, cannot be required or we have trouble with
+ // settings which are saved before configuring the network name
+ elmMode.getAttributeValue("name", nic.strHostOnlyName);
}
else if (elmMode.nameEquals("GenericInterface"))
{
@@ -3481,11 +3485,14 @@ void MachineConfigFile::readAttachedNetworkMode(const xml::ElementNode &elmMode,
{
enmAttachmentType = NetworkAttachmentType_NATNetwork;
- if (!elmMode.getAttributeValue("name", nic.strNATNetworkName)) // required network name
- throw ConfigFileError(this, &elmMode, N_("Required NATNetwork/@name element is missing"));
+ // optional network name, cannot be required or we have trouble with
+ // settings which are saved before configuring the network name
+ elmMode.getAttributeValue("name", nic.strNATNetworkName);
}
else if (elmMode.nameEquals("VDE"))
{
+ // inofficial hack (VDE networking was never part of the official
+ // settings, so it's not mentioned in VirtualBox-settings.xsd)
enmAttachmentType = NetworkAttachmentType_Generic;
com::Utf8Str strVDEName;
diff --git a/src/VBox/Main/xml/VirtualBox-settings.xsd b/src/VBox/Main/xml/VirtualBox-settings.xsd
index f6a8e35ac74..8145cd9dabf 100644
--- a/src/VBox/Main/xml/VirtualBox-settings.xsd
+++ b/src/VBox/Main/xml/VirtualBox-settings.xsd
@@ -936,19 +936,19 @@
</xsd:complexType>
<xsd:complexType name="TNetNATNetwork">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TNetBridged">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TNetInternal">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TNetHostOnly">
- <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="TNetGeneric">