From 24a7538453094b5f6c336abc6453569c3ee62d3e Mon Sep 17 00:00:00 2001 From: Alex Tsariounov Date: Mon, 2 Aug 2010 08:37:29 -0600 Subject: [PATCH] Fix Issue#3: cset fails to create cpu sets if some cpus are offline Problem was in cset.rescan() where if certain cpus are offline the all cpu mask turns into a complex expression. The split of this expression did not account for commas and thus threw an exception if commas were present. This patch fixes that problem and accounts for complex cpu expression. Also added a couple of targets to the Makefile. --- Makefile | 9 +++++++++ NEWS | 11 +++++++++++ cpuset.spec | 2 +- cpuset/cset.py | 5 ++++- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2e7fb4c..b374a16 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,15 @@ PYTHON ?= python all: $(PYTHON) setup.py build +rpm: + $(PYTHON) setup.py bdist_rpm + +srcrpm: + $(PYTHON) setup.py bdist_rpm + +srcdist: + $(PYTHON) setup.py sdist + install: $(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) diff --git a/NEWS b/NEWS index 9201667..e4bb4d3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,14 @@ +============================================================ +Cpuset 1.5.5 Pre-release (XXX, 2010) +http://code.google.com/p/cpuset +http://download.opensuse.org/repositories/home:/tsariounov:/cpuset/ + +Maintenance update to 1.5.4 includes fixes as follows. + +* Fix for Issue#3: cset fails to create cpu sets if some cpus are offline + Problem in cset.rescan() for maxcpu if root cpuset cpus are complex + pattern due to offlining cpus. + ============================================================ Cpuset 1.5.4 (May 7, 2010) http://code.google.com/p/cpuset diff --git a/cpuset.spec b/cpuset.spec index af47ef9..20d05a3 100644 --- a/cpuset.spec +++ b/cpuset.spec @@ -16,7 +16,7 @@ # norootforbuild Name: cpuset -Version: 1.5.4 +Version: 1.5.4.2 Release: 1 License: GPL v2 only BuildRoot: %{_tmppath}/%{name}-%{version}-build diff --git a/cpuset/cset.py b/cpuset/cset.py index 65aa0aa..9850443 100644 --- a/cpuset/cset.py +++ b/cpuset/cset.py @@ -343,8 +343,11 @@ def rescan(): global RootSet, maxcpu, allcpumask RootSet = CpuSet() # figure out system properties - maxcpu = int(RootSet.cpus.split('-')[-1]) + log.debug("rescan: all cpus = %s", RootSet.cpus) + maxcpu = int(RootSet.cpus.split('-')[-1].split(',')[-1]) + log.debug(" max cpu = %s", maxcpu) allcpumask = calc_cpumask(maxcpu) + log.debug(" allcpumask = %s", allcpumask) def cpuspec_check(cpuspec, usemax=True): """check format of cpuspec for validity"""