summaryrefslogtreecommitdiff
path: root/nova/network
diff options
context:
space:
mode:
authorSean Mooney <sean.k.mooney@intel.com>2016-01-22 17:00:36 +0000
committerMatt Riedemann <mriedem@us.ibm.com>2016-03-22 11:54:12 -0400
commitc7eb823fe73e3db5dca48df5879db18cbab5bd8d (patch)
tree9d5c8e4425b8c93b3a82925d12f29661fd7a2d0a /nova/network
parentce6dbea46c4c5b01a6907e90dd427a49ec453131 (diff)
downloadnova-c7eb823fe73e3db5dca48df5879db18cbab5bd8d.tar.gz
stop setting mtu when plugging vhost-user ports
vhost-user is a userspace protocol to establish connectivity between a virto-net frontend typically qemu and a userspace virtio backend such as ovs with dpdk. vhost-user interfaces exist only in userspace from the host perspective and are not represented in the linux networking stack as kernel netdevs. As a result attempting to set the mtu on a vhost-user interface using ifconfig or ip link will fail with a device not found error. - this change removes a call to _set_device_mtu when plugging vhost-user interfaces. - this change prevents the device not found error from occurring which stopped vms booting with vhost-user interfaces due to an uncaught exception resulting in a failure to set the interface type in ovs. - this change make creating vhost-user interface an atomic action. This latent bug is only triggered when the mtu value is set to a value other than 0 which was the default proir to mitaka. Change-Id: I2e17723d5052d57cd1557bd8a173c06ea0dcb2d4 Closes-Bug: #1533876 (cherry picked from commit adf7ba61dd73fe4bfffa20295be9a4b1006a1fe6)
Diffstat (limited to 'nova/network')
-rw-r--r--nova/network/linux_net.py42
-rw-r--r--nova/network/model.py2
2 files changed, 31 insertions, 13 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py
index e2f40ff3cb..40064a05de 100644
--- a/nova/network/linux_net.py
+++ b/nova/network/linux_net.py
@@ -37,6 +37,7 @@ import six
from nova import exception
from nova.i18n import _, _LE, _LW
+from nova.network import model as network_model
from nova import objects
from nova import paths
from nova.pci import utils as pci_utils
@@ -1365,15 +1366,34 @@ def _ovs_vsctl(args):
raise exception.OvsConfigurationFailure(inner_exception=e)
-def create_ovs_vif_port(bridge, dev, iface_id, mac, instance_id, mtu=None):
- _ovs_vsctl(['--', '--if-exists', 'del-port', dev, '--',
- 'add-port', bridge, dev,
- '--', 'set', 'Interface', dev,
- 'external-ids:iface-id=%s' % iface_id,
- 'external-ids:iface-status=active',
- 'external-ids:attached-mac=%s' % mac,
- 'external-ids:vm-uuid=%s' % instance_id])
- _set_device_mtu(dev, mtu)
+def _create_ovs_vif_cmd(bridge, dev, iface_id, mac,
+ instance_id, interface_type=None):
+ cmd = ['--', '--if-exists', 'del-port', dev, '--',
+ 'add-port', bridge, dev,
+ '--', 'set', 'Interface', dev,
+ 'external-ids:iface-id=%s' % iface_id,
+ 'external-ids:iface-status=active',
+ 'external-ids:attached-mac=%s' % mac,
+ 'external-ids:vm-uuid=%s' % instance_id]
+ if interface_type:
+ cmd += ['type=%s' % interface_type]
+ return cmd
+
+
+def create_ovs_vif_port(bridge, dev, iface_id, mac, instance_id,
+ mtu=None, interface_type=None):
+ _ovs_vsctl(_create_ovs_vif_cmd(bridge, dev, iface_id,
+ mac, instance_id,
+ interface_type))
+ # Note at present there is no support for setting the
+ # mtu for vhost-user type ports.
+ if interface_type != network_model.OVS_VHOSTUSER_INTERFACE_TYPE:
+ _set_device_mtu(dev, mtu)
+ else:
+ LOG.debug("MTU not set on %(interface_name)s interface "
+ "of type %(interface_type)s.",
+ {'interface_name': dev,
+ 'interface_type': interface_type})
def delete_ovs_vif_port(bridge, dev, delete_dev=True):
@@ -1382,10 +1402,6 @@ def delete_ovs_vif_port(bridge, dev, delete_dev=True):
delete_net_dev(dev)
-def ovs_set_vhostuser_port_type(dev):
- _ovs_vsctl(['--', 'set', 'Interface', dev, 'type=dpdkvhostuser'])
-
-
def create_ivs_vif_port(dev, iface_id, mac, instance_id):
utils.execute('ivs-ctl', 'add-port',
dev, run_as_root=True)
diff --git a/nova/network/model.py b/nova/network/model.py
index b28bc37aa9..8088ee8805 100644
--- a/nova/network/model.py
+++ b/nova/network/model.py
@@ -80,6 +80,8 @@ VIF_DETAILS_VHOSTUSER_OVS_PLUG = 'vhostuser_ovs_plug'
# Specifies whether vhost-user socket should be used to
# create a fp netdevice interface.
VIF_DETAILS_VHOSTUSER_FP_PLUG = 'vhostuser_fp_plug'
+# ovs vhost user interface type name
+OVS_VHOSTUSER_INTERFACE_TYPE = 'dpdkvhostuser'
# Constants for dictionary keys in the 'vif_details' field that are
# valid for VIF_TYPE_TAP.