Package: vzctl Version: 3.0.22-5 Severity: wishlist Tags: patch Hi!
The "set" command for "vzctl" should be allowed even when /dev/vzctl is not available. This allows to configure a VE before rebooting to an OpenVZ kernel. Attached is a patch which implements this feature. It might not be perfect, but it works well enough for my needs. Cheers, -- Jérémy Bobbio .''`. [EMAIL PROTECTED] : :Ⓐ : # apt-get install anarchism `. `'` `-
diff -x Makefile -x libtool -Naur vzctl-3.0.22/src/vzctl-actions.c vzctl-3.0.22.patched/src/vzctl-actions.c --- vzctl-3.0.22/src/vzctl-actions.c 2007-12-17 14:44:21.000000000 +0100 +++ vzctl-3.0.22.patched/src/vzctl-actions.c 2008-03-11 16:09:13.278119379 +0100 @@ -518,7 +518,7 @@ return ret; } /* Reset UB parameters from config */ - if (cmd_p->opt.reset_ub == YES) { + if (cmd_p->opt.reset_ub == YES && h != NULL) { ret = vps_set_ublimit(h, veid, &vps_p->res.ub); cmd_p->opt.save = NO; // suppress savewarning return ret; @@ -542,7 +542,7 @@ return ret; } } - is_run = vps_is_run(h, veid); + is_run = h != NULL && vps_is_run(h, veid); if (is_run) { if (cmd_p->res.fs.private_orig != NULL) { free(cmd_p->res.fs.private_orig); @@ -569,7 +569,7 @@ free(dist_name); } /* Setup password */ - if (!list_empty(&cmd_p->res.misc.userpw)) { + if (h != NULL && !list_empty(&cmd_p->res.misc.userpw)) { if (!is_run) if ((ret = vps_start(h, veid, g_p, SKIP_SETUP|SKIP_ACTION_SCRIPT, NULL))) @@ -808,8 +808,11 @@ char fname[STR_SIZE]; ret = 0; - if ((h = vz_open(veid)) == NULL) - return VZ_BAD_KERNEL; + if ((h = vz_open(veid)) == NULL) { + if (action != ACTION_SET && veid != 0) { + return VZ_BAD_KERNEL; + } + } if (action != ACTION_EXEC && action != ACTION_EXEC2 && action != ACTION_EXEC3 &&
signature.asc
Description: Digital signature