Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs & misc bugs #7

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
67 changes: 61 additions & 6 deletions CENTOS_7-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ Host Setup
``default_hugepagesz=2M hugepagesz=2M hugepages=2048 iommu=pt
intel_iommu=on``

#. Configure libvirtd to run qemu as root:
In file ``/etc/libvirt/qemu.conf``, set user and group to root, and check
the path of the hugepages

#. Install etcd and configure etcd::

yum install -y etcd

The file ``/etc/etcd/etcd.conf`` should contains::

ETCD_NAME=default
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://localhost:4001"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:4001"

#. Enable etcd::

systemctl enable etcd
systemctl start etcd


VPP build and install
~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -42,20 +63,38 @@ VPP build and install

* Build and install::

make -Cbuild-root PLATFORM=vpp TAG=vpp_debug vpp-api-install
make build-vpp-api
cd vpp-api/python
sudo python setup.py install

* Copy missing files::

cp ./build-root/install-vpp_debug-native/vpp/vpp-api/vpe.py /usr/lib/python2.7/site-packages/vpp_papi-1.1-py2.7.egg/vpp_papi/
cp ./build-root/install-vpp_debug-native/vlib-api/vlibmemory/memclnt.py /usr/lib/python2.7/site-packages/vpp_papi-1.1-py2.7.egg/vpp_papi/
cp ./build-root/build-vpp_debug-native/vpp-api/python/.libs/*.so* /usr/lib/python2.7/site-packages/vpp_papi-1.1-py2.7.egg/vpp_papi/
replace in file /usr/lib/python2.7/site-packages/vpp_papi-1.1-py2.7.egg/vpp_papi/vpp_papi.py
"vpe = sys.modules['vpe']" by "import vpe"

* Check vpp_papi is correctly installed::

python
>> import vpp_papi <-- should not raise any exception

#. Configuring VPP

It may be desirable to change vpp cli's listening port to something other
than the default 5000, as it is used by keystone. This can be done by
adding line ``cli-listen localhost:5002`` in ``unix`` section of VPP
config file ``/etc/vpp/startup.conf``.

Add a line corresponding to your external NIC in the ``dpdk`` section,
and limit the amount of memory taken by VPP::

It is necessary to load pmd kernel module of choice (vfio-pci, igb_uio,
etc). igb_uio module can be found in dpdk build directory:
``build-root/install-vpp-native/dpdk/kmod/igb_uio.ko``
dpdk {
socket-mem 1024
uio-driver uio_pci_generic
dev 0002:05:00.0
}

#. Starting VPP

Expand Down Expand Up @@ -135,10 +174,26 @@ Add the following to local.conf::
Q_ML2_PLUGIN_MECHANISM_DRIVERS=vpp
Q_ML2_PLUGIN_TYPE_DRIVERS=vlan
VLAN_TRUNK_IF='GigabitEthernet2/5/0'

Note that ``VLAN_TRUNK_IF`` should be set to the interface name in VPP that you
MECH_VPP_PHYSNETLIST=physnet:GigabitEthernet2/5/0
MECH_VPP_AGENTLIST=localhost
QEMU_USER=root
QEMU_GROUP=root
NEUTRON_CREATE_INITIAL_NETWORKS=False


Note that ``VLAN_TRUNK_IF`` and ``MECH_VPP_PHYSNETLIST`` should be set to the interface name in VPP that you
want to use as your trunk interface.


Network creation
~~~~~~~~~~~
As the variable ``NEUTRON_CREATE_INITIAL_NETWORKS`` is set to ``False``, we have to create
manually the private network::
source openrc admin admin
neutron net-create --tenant-id admin --provider:network_type vlan --provider:physical_network physnet private
neutron subnet-create --tenant-id admin --name sub_private --gateway 192.168.78.1 --enable-dhcp --ip-version 4 private 192.168.78.0/24


VM creation
~~~~~~~~~~~

Expand Down
9 changes: 8 additions & 1 deletion devstack/plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ function configure_vpp {
iniset /$Q_PLUGIN_CONF_FILE ml2_vpp agents $MECH_VPP_AGENTLIST
iniset /$Q_PLUGIN_CONF_FILE ml2_vpp physnets $MECH_VPP_PHYSNETLIST

if [ ! -z "$MECH_VPP_DEBUG" ] ; then
iniset /$Q_PLUGIN_CONF_FILE ml2_vpp debug True
fi

if [ ! -z "$VXLAN_SRC_ADDR" ] ; then
iniset /$Q_PLUGIN_CONF_FILE ml2_vpp vxlan_src_addr $VXLAN_SRC_ADDR
fi
Expand Down Expand Up @@ -69,7 +73,10 @@ function pre_install_vpp_agent {
}

function install_vpp_agent {
:
iniset $NOVA_CONF DEFAULT reserved_host_memory_mb 1024
iniset $NOVA_CONF DEFAULT cpu_allocation_ratio 1.0
iniset $NOVA_CONF DEFAULT ram_allocation_ratio 1.0
iniset $NOVA_CONF libvirt cpu_mode 'host-model'
}

function init_vpp_agent {
Expand Down
7 changes: 7 additions & 0 deletions networking_vpp/agent/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ def process_ops(self):

def main():
cfg.CONF(sys.argv[1:])
if cfg.CONF.ml2_vpp.debug:
extra_default_log_levels = ['%s=DEBUG' % __name__]
else:
extra_default_log_levels = ['%s=WARN' % __name__]
loglevels = logging.get_default_log_levels() + extra_default_log_levels
logging.set_defaults(default_log_levels=loglevels)
logging.setup(cfg.CONF, __name__)

# If the user and/or group are specified in config file, we will use
# them as configured; otherwise we try to use defaults depending on
Expand Down
5 changes: 3 additions & 2 deletions networking_vpp/agent/vpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_interfaces(self):
t = vpp_papi.sw_interface_dump(0, b'ignored')

for interface in t:
if interface.vl_msg_id == vpp_papi.VL_API_SW_INTERFACE_DETAILS:
# if interface.vl_msg_id == vpp_papi.VL_API_SW_INTERFACE_DETAILS:
yield (fix_string(interface.interface_name), interface)

def get_interface(self, name):
Expand Down Expand Up @@ -89,6 +89,7 @@ def create_tap(self, ifname, mac):
return t.sw_if_index # will be -1 on failure (e.g. 'already exists')

def delete_tap(self, idx):
self.LOG.debug("Deleting VPP tap interface - index: %s" % idx)
vpp_papi.tap_delete(idx)

# Err, I just got a sw_interface_set_flags here, not a delete tap?
Expand Down Expand Up @@ -120,7 +121,7 @@ def create_vhostuser(self, ifpath, mac, qemu_user, qemu_group):
return t.sw_if_index

def delete_vhostuser(self, idx):
self.LOG.debug("Deleting VPP interface - index: %s" % idx)
self.LOG.debug("Deleting VPP vhostuser interface - index: %s" % idx)
t = vpp_papi.delete_vhost_user_if(idx)

self._check_retval(t)
Expand Down
3 changes: 3 additions & 0 deletions networking_vpp/config_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
help=_("QEMU user. Leave blank for default user")),
cfg.StrOpt('qemu_group',
help=_("QEMU group. Leave blank for default group")),
cfg.BoolOpt('debug',
default=False,
help='Enable or disable debug logging.'),
]

cfg.CONF.register_opts(vpp_opts, "ml2_vpp")
6 changes: 4 additions & 2 deletions networking_vpp/db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ def journal_read(session, func):
session.delete(entry)
else:
# For some reason, we can't do the job.
entry.retries = entry.retries + 1
session.update(entry)
LOG.error("Function %s failed with value (k=%s, v=%s)" %
(str(func), entry.k, entry.v))
entry.retry_count = entry.retry_count + 1
entry.update(entry)
else:
# The table is empty - no work available.
maybe_more=False
Expand Down
15 changes: 12 additions & 3 deletions networking_vpp/mech_vpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
cfg.StrOpt('agents',
help=_("Name=HTTP URL mapping list of agents on compute "
"nodes.")),
cfg.BoolOpt('debug',
default=False,
help='Enable or disable debug logging'),
]

cfg.CONF.register_opts(vpp_opts, "ml2_vpp")
Expand Down Expand Up @@ -273,14 +276,17 @@ def update_port_postcommit(self, port_context):
self.communicator.kick()


def delete_port_precommit(self, port_context):
def delete_port_postcommit(self, port_context):
port = port_context.current
host = port_context.host
LOG.debug('ML2_VPP: delete_port_postcommit, port is %s' % str(port))
self.communicator.unbind(port_context._plugin_context.session,
port, host)

def delete_port_precommit(self, port_context):
port = port_context.current
host = port_context.host
LOG.debug('ML2_VPP: delete_port_precommit, port is %s' % str(port))
self.communicator.kick()

@six.add_metaclass(ABCMeta)
Expand Down Expand Up @@ -455,7 +461,10 @@ def do_etcd_update(self, k, v):
# not needed? - do_etcd_mkdir('/'.join(k.split('/')[:-1]))
if v is None:
LOG.error('deleting key %s' % k)
self.etcd_client.delete(k)
try:
self.etcd_client.delete(k)
except etcd.EtcdKeyNotFound:
pass
else:
LOG.error('writing key %s' % k)
self.etcd_client.write(k, json.dumps(v))
Expand All @@ -481,7 +490,7 @@ def work(k, v):
if self.do_etcd_update(k, v):
return True
else:
os.sleep(1) # something went bad; breathe, in
time.sleep(1) # something went bad; breathe, in
# case we end up in a tight loop
return False

Expand Down