mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
Update structure & XML definitions to support <hostdev caps=net>
This updates the definitions and supporting structures in the XML schema and domain configuration files. Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
This commit is contained in:
parent
6f1b9c8d2a
commit
4aafa1ff86
@ -2341,6 +2341,15 @@
|
|||||||
<char>/dev/input/event3</char>
|
<char>/dev/input/event3</char>
|
||||||
</source>
|
</source>
|
||||||
</hostdev>
|
</hostdev>
|
||||||
|
...
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
...
|
||||||
|
<hostdev mode='capabilities' type='net'>
|
||||||
|
<source>
|
||||||
|
<interface>eth0</interface>
|
||||||
|
</source>
|
||||||
|
</hostdev>
|
||||||
...
|
...
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
@ -2349,13 +2358,15 @@
|
|||||||
<dd>The <code>hostdev</code> element is the main container for describing
|
<dd>The <code>hostdev</code> element is the main container for describing
|
||||||
host devices. For block/character device passthrough <code>mode</code> is
|
host devices. For block/character device passthrough <code>mode</code> is
|
||||||
always "capabilities" and <code>type</code> is "block" for a block
|
always "capabilities" and <code>type</code> is "block" for a block
|
||||||
device and "char" for a character device.
|
device, "char" for a character device and "net" for a host network
|
||||||
|
interface.
|
||||||
</dd>
|
</dd>
|
||||||
<dt><code>source</code></dt>
|
<dt><code>source</code></dt>
|
||||||
<dd>The source element describes the device as seen from the host.
|
<dd>The source element describes the device as seen from the host.
|
||||||
For block devices, the path to the block device in the host
|
For block devices, the path to the block device in the host
|
||||||
OS is provided in the nested "block" element, while for character
|
OS is provided in the nested "block" element, while for character
|
||||||
devices the "char" element is used
|
devices the "char" element is used. For network interfaces, the
|
||||||
|
name of the interface is provided in the "interface" element.
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
@ -3002,6 +3002,9 @@
|
|||||||
<group>
|
<group>
|
||||||
<ref name="hostdevcapsmisc"/>
|
<ref name="hostdevcapsmisc"/>
|
||||||
</group>
|
</group>
|
||||||
|
<group>
|
||||||
|
<ref name="hostdevcapsnet"/>
|
||||||
|
</group>
|
||||||
</choice>
|
</choice>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
@ -3062,6 +3065,17 @@
|
|||||||
</element>
|
</element>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
|
<define name="hostdevcapsnet">
|
||||||
|
<attribute name="type">
|
||||||
|
<value>net</value>
|
||||||
|
</attribute>
|
||||||
|
<element name="source">
|
||||||
|
<element name="interface">
|
||||||
|
<ref name="deviceName"/>
|
||||||
|
</element>
|
||||||
|
</element>
|
||||||
|
</define>
|
||||||
|
|
||||||
<define name="usbproduct">
|
<define name="usbproduct">
|
||||||
<element name="vendor">
|
<element name="vendor">
|
||||||
<attribute name="id">
|
<attribute name="id">
|
||||||
|
@ -582,7 +582,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST,
|
|||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST,
|
||||||
"storage",
|
"storage",
|
||||||
"misc")
|
"misc",
|
||||||
|
"net")
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainPciRombarMode,
|
VIR_ENUM_IMPL(virDomainPciRombarMode,
|
||||||
VIR_DOMAIN_PCI_ROMBAR_LAST,
|
VIR_DOMAIN_PCI_ROMBAR_LAST,
|
||||||
@ -1611,6 +1612,9 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr def)
|
|||||||
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC:
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC:
|
||||||
VIR_FREE(def->source.caps.u.misc.chardev);
|
VIR_FREE(def->source.caps.u.misc.chardev);
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET:
|
||||||
|
VIR_FREE(def->source.caps.u.net.iface);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3675,6 +3679,14 @@ virDomainHostdevDefParseXMLCaps(xmlNodePtr node ATTRIBUTE_UNUSED,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET:
|
||||||
|
if (!(def->source.caps.u.net.iface =
|
||||||
|
virXPathString("string(./source/interface[1])", ctxt))) {
|
||||||
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
|
_("Missing <interface> element in hostdev net device"));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("address type='%s' not supported in hostdev interfaces"),
|
_("address type='%s' not supported in hostdev interfaces"),
|
||||||
@ -8881,6 +8893,14 @@ virDomainHostdevMatchCapsMisc(virDomainHostdevDefPtr a,
|
|||||||
b->source.caps.u.misc.chardev);
|
b->source.caps.u.misc.chardev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainHostdevMatchCapsNet(virDomainHostdevDefPtr a,
|
||||||
|
virDomainHostdevDefPtr b)
|
||||||
|
{
|
||||||
|
return STREQ_NULLABLE(a->source.caps.u.net.iface,
|
||||||
|
b->source.caps.u.net.iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainHostdevMatchCaps(virDomainHostdevDefPtr a,
|
virDomainHostdevMatchCaps(virDomainHostdevDefPtr a,
|
||||||
@ -8894,6 +8914,8 @@ virDomainHostdevMatchCaps(virDomainHostdevDefPtr a,
|
|||||||
return virDomainHostdevMatchCapsStorage(a, b);
|
return virDomainHostdevMatchCapsStorage(a, b);
|
||||||
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC:
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC:
|
||||||
return virDomainHostdevMatchCapsMisc(a, b);
|
return virDomainHostdevMatchCapsMisc(a, b);
|
||||||
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET:
|
||||||
|
return virDomainHostdevMatchCapsNet(a, b);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -13530,6 +13552,10 @@ virDomainHostdevDefFormatCaps(virBufferPtr buf,
|
|||||||
virBufferEscapeString(buf, "<char>%s</char>\n",
|
virBufferEscapeString(buf, "<char>%s</char>\n",
|
||||||
def->source.caps.u.misc.chardev);
|
def->source.caps.u.misc.chardev);
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET:
|
||||||
|
virBufferEscapeString(buf, "<interface>%s</interface>\n",
|
||||||
|
def->source.caps.u.net.iface);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unexpected hostdev type %d"),
|
_("unexpected hostdev type %d"),
|
||||||
|
@ -407,6 +407,7 @@ struct _virDomainHostdevSubsys {
|
|||||||
enum virDomainHostdevCapsType {
|
enum virDomainHostdevCapsType {
|
||||||
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
|
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_STORAGE,
|
||||||
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
|
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_MISC,
|
||||||
|
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET,
|
||||||
|
|
||||||
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
|
VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST
|
||||||
};
|
};
|
||||||
@ -422,6 +423,9 @@ struct _virDomainHostdevCaps {
|
|||||||
struct {
|
struct {
|
||||||
char *chardev;
|
char *chardev;
|
||||||
} misc;
|
} misc;
|
||||||
|
struct {
|
||||||
|
char *iface;
|
||||||
|
} net;
|
||||||
} u;
|
} u;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user