Skip to content

Commit

Permalink
DPDK: setup VM CPU affinity while adding new node.
Browse files Browse the repository at this point in the history
During vrouter_add_node execute setup_vm_coremask_node that will
add vcpu_pin_set to new node's nova.conf.

Change-Id: I383b6a6fd617e0989006f8adac6e6328410c4c19
Closes-bug: #1547722
  • Loading branch information
semihalf-zmuda-wojciech authored and semihalf-berestovskyy-andriy committed Apr 28, 2016
1 parent 1583217 commit 6c12462
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README
Expand Up @@ -220,7 +220,7 @@ The following fab command upgrades the live system, should be run from the confi

Adding a new compute node to existing cluster
---------------------------------------------
Add all the irequired infromation about the new nodes to testbed.py
Add all the required information about the new nodes to testbed.py
cd /opt/contrail/utils
fab install_pkg_node:/path/to/contrail-install-packages.rpm | /path/to/contrail-install-packages.deb,<user@newnode1ip>,<user@newnode2ip>
fab add_vrouter_node:<user@newnode1ip>,<user@newnode2ip>
Expand Down
18 changes: 10 additions & 8 deletions fabfile/tasks/provision.py
Expand Up @@ -1544,8 +1544,10 @@ def setup_only_vrouter_node(manage_nova_compute='yes', configure_nova='yes', *ar
# Setup hugepages if necessary
setup_hugepages_node(host_string)

# Setup affinity mask if necessary
# Setup affinity masks for vRouter and qemu if necessary
setup_coremask_node(host_string)
setup_vm_coremask_node(False, host_string)

# Setup vr_mpls_labels, vr_nexthops, vr_vrfs, vr_bridge_entries
# if necessary
dpdk_increase_vrouter_limit()
Expand Down Expand Up @@ -2343,18 +2345,18 @@ def setup_vm_coremask_node(q_coremask, *args):
for host_string in args:
dpdk = getattr(env, 'dpdk', None)
if dpdk:
if env.host_string in dpdk:
if host_string in dpdk:
try:
vr_coremask = dpdk[env.host_string]['coremask']
vr_coremask = dpdk[host_string]['coremask']
except KeyError:
raise RuntimeError("vRouter core mask for host %s is not defined." \
%(host_string))
else:
print "No %s in the dpdk section in testbed file." \
%(env.host_string)
%(host_string)
return
else:
print "No dpdk section in testbed file on host %s." %(env.host_string)
print "No dpdk section in testbed file on host %s." %(host_string)
return

if not vr_coremask:
Expand All @@ -2366,12 +2368,12 @@ def setup_vm_coremask_node(q_coremask, *args):
cpu_count = int(run('grep -c processor /proc/cpuinfo'))
except ValueError:
print "Cannot count CPUs on host %s. VM core mask cannot be computed." \
%(env.host_string)
%(host_string)
raise

if not cpu_count or cpu_count == -1:
raise ValueError("Cannot count CPUs on host %s. VM core mask cannot be computed." \
%(env.host_string))
%(host_string))

all_cores = [x for x in xrange(cpu_count)]

Expand Down Expand Up @@ -2422,7 +2424,7 @@ def setup_vm_coremask_node(q_coremask, *args):
if sudo("openstack-config --set /etc/nova/nova.conf DEFAULT vcpu_pin_set %s" \
% q_coremask).succeeded:
print "QEMU coremask on host %s set to %s." \
%(env.host_string, q_coremask)
%(host_string, q_coremask)
else:
raise RuntimeError("Error: setting QEMU core mask %s for host %s failed." \
%(vr_coremask, host_string))
Expand Down

0 comments on commit 6c12462

Please sign in to comment.