break;
case VIR_DOMAIN_NET_TYPE_USER:
- def->sourceDev = virXMLPropString(source_node, "dev");
- break;
-
case VIR_DOMAIN_NET_TYPE_NULL:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
return NULL;
}
+ if (def->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
+ def->sourceDev = virXMLPropString(source_node, "dev");
+ }
+
+
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
if (linkstate != NULL) {
if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) {
if (net->type != VIR_DOMAIN_NET_TYPE_USER &&
net->type != VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("The 'passt' backend can only be used with interface type='user' or type='vhostuser'"));
return -1;
}
}
+ if (net->sourceDev && net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("The 'dev' attribute of the <source> element can only be used with <interface> type='user' or type='vhostuser' if the <backend> type='passt'"));
+ return -1;
+ }
+
if (net->nPortForwards > 0) {
size_t p;
<controller type='pci' index='0' model='pci-root'/>
<interface type='vhostuser'>
<mac address='00:11:22:33:44:55'/>
+ <source dev='eth42'/>
<ip address='172.17.2.0' family='ipv4' prefix='24'/>
<ip address='2001:db8:ac10:fd01::feed' family='ipv6'/>
<portForward proto='tcp' address='2001:db8:ac10:fd01::1:10'>
</interface>
<interface type='vhostuser'>
<mac address='00:11:22:33:44:11'/>
+ <source dev='eth43'/>
<model type='virtio'/>
<backend type='passt'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>