Don't barf when adjusting CPU share if there are no processes in context
Steve Muir [Mon, 9 Jan 2006 21:44:32 +0000 (21:44 +0000)]
python/vserverimpl.c

index 00c8980..6b1284c 100644 (file)
@@ -151,7 +151,9 @@ vserver_setsched(PyObject *self, PyObject *args)
       get_rspec(resources, &rspec))
     return NULL;
 
-  if (pl_setsched(ctx, rspec.cpu_share, rspec.cpu_sched_flags))
+  /* ESRCH indicates that there are no processes in the context */
+  if (pl_setsched(ctx, rspec.cpu_share, rspec.cpu_sched_flags) &&
+      errno != ESRCH)
     return PyErr_SetFromErrno(PyExc_OSError);
 
   return Py_None;