From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
When EINVAL caught, tell user that what values
are invalid for what field.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/util/vircgroup.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index e99caf5..a98bd63 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -664,12 +664,21 @@ virCgroupSetValueStr(virCgroupPtr group,
{
int ret = -1;
char *keypath = NULL;
+ char *tmp = NULL;
if (virCgroupPathOfController(group, controller, key, &keypath) < 0)
return -1;
VIR_DEBUG("Set value '%s' to '%s'", keypath, value);
if (virFileWriteStr(keypath, value, 0) < 0) {
+ if (errno == EINVAL) {
+ tmp = strrchr(keypath, '/');
+ if (!tmp)
+ goto cleanup;
+ virReportSystemError(errno,
+ _("Invalid value '%s' for
'%s'"), value, ++tmp);
+ goto cleanup;
+ }
virReportSystemError(errno,
_("Unable to write to '%s'"), keypath);
goto cleanup;
@@ -1829,7 +1838,8 @@ virCgroupGetBlkioWeight(virCgroupPtr group, unsigned int *weight)
*
* @group: The cgroup to change io device weight device for
* @path: The device with a weight to alter
- * @weight: The new device weight (100-1000), or 0 to clear
+ * @weight: The new device weight (100-1000),
+ * (10-1000) after kernel 2.6.39, or 0 to clear
*
* device_weight is treated as a write-only parameter, so
* there isn't a getter counterpart.
--
1.8.2.1