functions: cpulist_invert code moved to utils
Signed-off-by: Jaroslav Škarvada <jskarvad@redhat.com>
This commit is contained in:
parent
dfdbd88e67
commit
d172b5bd8d
2 changed files with 7 additions and 3 deletions
|
|
@ -19,6 +19,4 @@ class cpulist_invert(base.Function):
|
|||
def execute(self, args):
|
||||
if not super(self.__class__, self).execute(args):
|
||||
return None
|
||||
cpus = self._cmd.cpulist_unpack(",".join(args))
|
||||
present = self._cmd.cpulist_unpack(self._cmd.read_file("/sys/devices/system/cpu/present"))
|
||||
return ",".join(str(v) for v in set(present) - set(cpus))
|
||||
return ",".join(str(v) for v in self._cmd.cpulist_invert(",".join(args)))
|
||||
|
|
|
|||
|
|
@ -155,6 +155,12 @@ class commands:
|
|||
return []
|
||||
return sorted(list(set(rl)))
|
||||
|
||||
# Inverts CPU list (i.e. makes its complement)
|
||||
def cpulist_invert(self, l):
|
||||
cpus = self.cpulist_unpack(l)
|
||||
present = self.cpulist_unpack(self.read_file("/sys/devices/system/cpu/present"))
|
||||
return list(set(present) - set(cpus))
|
||||
|
||||
# Converts CPU list to hexadecimal CPU mask
|
||||
def cpulist2hex(self, l):
|
||||
if l is None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue