mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 19:45:21 +00:00
Make startmode optional in toplevel interface definition
The minimal XML returned from ncf_if_xml_state() doesn't contain this attribute (which makes no sense in the case of reporting current status of the interface), and it was preventing it from passing through the parse/format step. * src/conf/interface_conf.[ch]: add a new virInterfaceStartMode value and modify loading/saving accordingly
This commit is contained in:
parent
075bb5f1aa
commit
ef591ef7b9
@ -128,12 +128,9 @@ virInterfaceDefParseStartMode(virConnectPtr conn, virInterfaceDefPtr def,
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
|
|
||||||
tmp = virXPathString(conn, "string(./start/@mode)", ctxt);
|
tmp = virXPathString(conn, "string(./start/@mode)", ctxt);
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL)
|
||||||
virInterfaceReportError(conn, VIR_ERR_XML_ERROR,
|
def->startmode = VIR_INTERFACE_START_UNSPECIFIED;
|
||||||
"%s", _("interface misses the start mode attribute"));
|
else if (STREQ(tmp, "onboot"))
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if (STREQ(tmp, "onboot"))
|
|
||||||
def->startmode = VIR_INTERFACE_START_ONBOOT;
|
def->startmode = VIR_INTERFACE_START_ONBOOT;
|
||||||
else if (STREQ(tmp, "hotplug"))
|
else if (STREQ(tmp, "hotplug"))
|
||||||
def->startmode = VIR_INTERFACE_START_HOTPLUG;
|
def->startmode = VIR_INTERFACE_START_HOTPLUG;
|
||||||
@ -1039,6 +1036,8 @@ virInterfaceStartmodeDefFormat(virConnectPtr conn, virBufferPtr buf,
|
|||||||
enum virInterfaceStartMode startmode) {
|
enum virInterfaceStartMode startmode) {
|
||||||
const char *mode;
|
const char *mode;
|
||||||
switch (startmode) {
|
switch (startmode) {
|
||||||
|
case VIR_INTERFACE_START_UNSPECIFIED:
|
||||||
|
return 0;
|
||||||
case VIR_INTERFACE_START_NONE:
|
case VIR_INTERFACE_START_NONE:
|
||||||
mode = "none";
|
mode = "none";
|
||||||
break;
|
break;
|
||||||
|
@ -48,7 +48,8 @@ VIR_ENUM_DECL(virInterface)
|
|||||||
/* types of start mode */
|
/* types of start mode */
|
||||||
|
|
||||||
enum virInterfaceStartMode {
|
enum virInterfaceStartMode {
|
||||||
VIR_INTERFACE_START_NONE = 0, /* not defined */
|
VIR_INTERFACE_START_UNSPECIFIED = 0, /* not given in config */
|
||||||
|
VIR_INTERFACE_START_NONE, /* specified as not defined */
|
||||||
VIR_INTERFACE_START_ONBOOT, /* startup at boot */
|
VIR_INTERFACE_START_ONBOOT, /* startup at boot */
|
||||||
VIR_INTERFACE_START_HOTPLUG, /* on hotplug */
|
VIR_INTERFACE_START_HOTPLUG, /* on hotplug */
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user