Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 4712f8a

Browse files
author
Michal Novotny
committed
Fix CPU Pinning check for pinning string ending with comma
When you provided CPU pinning string that was ending with comma an uncaught exception occured of ValueError about invalid literal for int() with base 10 because of empty string passed to int() function. This patch fixes the lines ending with comma, lines like "1," and corrects this to correct CPU pinning string, ie. "1".
1 parent dae0dc2 commit 4712f8a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

virtinst/Guest.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ def set_cpuset(self, val):
196196
raise ValueError, _("cpuset's pCPU numbers must be less "
197197
"than pCPUs.")
198198
else:
199-
if int(c) >= pcpus:
200-
raise ValueError, _("cpuset's pCPU numbers must be less "
201-
"than pCPUs.")
199+
if len(c) > 0:
200+
val = int(c)
201+
if val >= pcpus:
202+
raise ValueError, _("cpuset's pCPU numbers must be less "
203+
"than pCPUs.")
202204
self._cpuset = val
203205
cpuset = property(get_cpuset, set_cpuset)
204206

0 commit comments

Comments
 (0)