From 8a2fa70d4f413118d9e960b5a21e979b1e5d4a94 Mon Sep 17 00:00:00 2001 From: Jim Gauld Date: Tue, 23 Oct 2018 11:49:11 -0400 Subject: [PATCH] Change nova instances_path and cpuset mounts to openstack-helm default This changes the nova configuration instances_path parameter to reflect the openstack-helm default of /var/lib/nova/instances. This changes the nova cpuset mount configuration to reflect the openstack-helm default cgroup path. The nova_setup_cpusets script now mounts /sys/fs/cgroup/cpuset instead of /dev/cpuset to provide the equivalent functionality. Change-Id: I1db45213b78da52532b40e6b6c07528f52427da0 Story: 2003909 Task: 27081 Signed-off-by: Jim Gauld --- openstack/python-nova/python-nova/nova.conf | 2 +- .../python-nova/nova_setup_cpusets | 45 +++++++++---------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/openstack/python-nova/python-nova/nova.conf b/openstack/python-nova/python-nova/nova.conf index 4496d729..e9d62fd9 100644 --- a/openstack/python-nova/python-nova/nova.conf +++ b/openstack/python-nova/python-nova/nova.conf @@ -14,7 +14,7 @@ rootwrap_config = /etc/nova/rootwrap.conf api_paste_config = /etc/nova/api-paste.ini allow_resize_to_same_host = true auth_strategy = keystone -instances_path = /etc/nova/instances +instances_path = /var/lib/nova/instances debug = True my_ip = 127.0.0.1 glance_host = 127.0.0.1 diff --git a/openstack/python-nova/python-nova/nova_setup_cpusets b/openstack/python-nova/python-nova/nova_setup_cpusets index 3138540e..a2881702 100644 --- a/openstack/python-nova/python-nova/nova_setup_cpusets +++ b/openstack/python-nova/python-nova/nova_setup_cpusets @@ -58,6 +58,8 @@ errlog() start() { + set -euo pipefail + # Do not continue if the host has not been configured. We can't do # anything until the nova.conf file has been updated. if [ ! -f ${INITIAL_COMPUTE_CONFIG_COMPLETE} ] @@ -66,43 +68,37 @@ start() exit 0 fi - mkdir -p /dev/cpuset + # Configure cpuset mount + CPUSET=/sys/fs/cgroup/cpuset + CPUS='cpuset.cpus' + MEMS='cpuset.mems' + mkdir -p ${CPUSET} if [ $? -ne 0 ]; then - errlog "unable to create /dev/cpuset" + errlog "unable to create ${CPUSET}" exit 1 fi - if ! mountpoint -q /dev/cpuset + if ! mountpoint -q ${CPUSET} then - mount -t cpuset none /dev/cpuset + mount -t cpuset none ${CPUSET} if [ $? -ne 0 ]; then - errlog "unable to mount /dev/cpuset" + errlog "unable to mount ${CPUSET}" exit 1 fi fi - # Figure out whether to use WRL or CentOS naming - if [ -f /dev/cpuset/cpuset.cpus ] - then - CPUS='cpuset.cpus' - MEMS='cpuset.mems' - else - CPUS='cpus' - MEMS='mems' - fi - # Make the global "floating" cpuset - mkdir -p /dev/cpuset/floating + mkdir -p ${CPUSET}/floating if [ $? -ne 0 ]; then errlog "unable to create 'floating' cpuset" exit 1 fi # Assign the full set of NUMA nodes to the global floating nodeset - MEMNODES=$(cat /dev/cpuset/${MEMS}) + MEMNODES=$(cat ${CPUSET}/${MEMS}) log "Assign nodes ${MEMNODES} to floating/${MEMS}" - cp /dev/cpuset/${MEMS} /dev/cpuset/floating/${MEMS} + cp ${CPUSET}/${MEMS} ${CPUSET}/floating/${MEMS} if [ $? -ne 0 ]; then errlog "unable to write to floating/${MEMS}" fi @@ -111,20 +107,21 @@ start() VCPU_PIN_STR=$(grep vcpu_pin_set /etc/nova/nova.conf) VCPU_PIN_STR=${VCPU_PIN_STR//\"/} FLOAT_CPUS=${VCPU_PIN_STR##*=} + log "Assign cpus ${FLOAT_CPUS} to floating/${CPUS}" - /bin/echo $FLOAT_CPUS > /dev/cpuset/floating/${CPUS} + /bin/echo $FLOAT_CPUS > ${CPUSET}/floating/${CPUS} if [ $? -ne 0 ]; then errlog "unable to write to floating/${CPUS}" fi # Set ownership/permissions on the cpus/tasks files - chown nova.nova /dev/cpuset/floating/${CPUS} /dev/cpuset/floating/tasks - chmod 644 /dev/cpuset/floating/${CPUS} /dev/cpuset/floating/tasks + chown nova.nova ${CPUSET}/floating/${CPUS} ${CPUSET}/floating/tasks + chmod 644 ${CPUSET}/floating/${CPUS} ${CPUSET}/floating/tasks # Now set up the per-NUMA-node cpusets cd /sys/devices/system/node/ - NODES=`ls -d node*` - cd /dev/cpuset/floating + NODES=$(ls -d node*) + cd ${CPUSET}/floating for NODE in $NODES do NODENUM=${NODE#node} @@ -138,7 +135,7 @@ start() # may span numa nodes. Default linux memory allocation policy is to # use the same node(s) where the task is affined if that is possible. log "Assign nodes ${MEMNODES} to floating/${NODE}/${MEMS}" - cp /dev/cpuset/${MEMS} ${NODE}/${MEMS} + cp ${CPUSET}/${MEMS} ${NODE}/${MEMS} if [ $? -ne 0 ]; then errlog "unable to write to ${NODE}/${MEMS}" continue