def enable_ovs_dpdk():
    '''Enables the DPDK variant of ovs-vswitchd and restarts it'''
    subprocess.check_call(UPDATE_ALTERNATIVES + [OVS_DPDK_BIN])
    values_changed = []
    if ovs_has_late_dpdk_init():
        dpdk_context = neutron_ovs_context.OVSDPDKDeviceContext()
        other_config = OrderedDict([
            ('dpdk-lcore-mask', dpdk_context.cpu_mask()),
            ('dpdk-socket-mem', dpdk_context.socket_memory()),
            ('dpdk-init', 'true'),
        ])
        if not ovs_vhostuser_client():
            other_config['dpdk-extra'] = (
                '--vhost-owner libvirt-qemu:kvm --vhost-perm 0660 ' +
                dpdk_context.pci_whitelist()
            )
        else:
            other_config['dpdk-extra'] = (
                dpdk_context.pci_whitelist()
            )
        other_config['dpdk-init'] = 'true'
        for column, value in other_config.items():
            values_changed.append(
                set_Open_vSwitch_column_value(
                    'other_config:{}'.format(column),
                    value
                )
            )
    if ((values_changed and any(values_changed)) and
            not is_unit_paused_set()):
        service_restart('openvswitch-switch')
def enable_ovs_dpdk():
    '''Enables the DPDK variant of ovs-vswitchd and restarts it'''
    subprocess.check_call(UPDATE_ALTERNATIVES + [OVS_DPDK_BIN])
    if ovs_has_late_dpdk_init():
        ctxt = neutron_ovs_context.OVSDPDKDeviceContext()
        set_Open_vSwitch_column_value('other_config:dpdk-init=true')
        set_Open_vSwitch_column_value('other_config:dpdk-lcore-mask={}'.format(
            ctxt['cpu_mask']))
        set_Open_vSwitch_column_value('other_config:dpdk-socket-mem={}'.format(
            ctxt['socket_memory']))
        set_Open_vSwitch_column_value('other_config:dpdk-extra=--vhost-owner'
                                      ' libvirt-qemu:kvm --vhost-perm 0660')
    if not is_unit_paused_set():
        service_restart('openvswitch-switch')
Beispiel #3
0
            context.ZeroMQContext(),
            context.NotificationDriverContext()
        ],
    }),
    (ML2_CONF, {
        'services': ['neutron-plugin-openvswitch-agent'],
        'contexts': [neutron_ovs_context.OVSPluginContext()],
    }),
    (OVS_CONF, {
        'services': ['neutron-openvswitch-agent'],
        'contexts': [neutron_ovs_context.OVSPluginContext()],
    }),
    (OVS_DEFAULT, {
        'services': ['openvswitch-switch'],
        'contexts': [
            neutron_ovs_context.OVSDPDKDeviceContext(),
            neutron_ovs_context.RemoteRestartContext(
                ['neutron-plugin', 'neutron-control'])
        ],
    }),
    (DPDK_INTERFACES, {
        'services': ['dpdk'],
        'contexts': [neutron_ovs_context.DPDKDeviceContext()],
    }),
    (PHY_NIC_MTU_CONF, {
        'services': ['os-charm-phy-nic-mtu'],
        'contexts': [context.PhyNICMTUContext()],
    }),
])
METADATA_RESOURCE_MAP = OrderedDict([
    (NEUTRON_METADATA_AGENT_CONF, {
Beispiel #4
0
 def setUp(self):
     super(TestOVSDPDKDeviceContext, self).setUp(context,
                                                 TO_PATCH + DPDK_PATCH)
     self.config.side_effect = self.test_config.get
     self.test_context = context.OVSDPDKDeviceContext()
     self.test_config.set('enable-dpdk', True)