<div dir="ltr">Hello,<div><br></div><div>The following patch implements vps.precreate (/etc/sysconfig/vz-scripts/vps.precreate) action script. </div><div><br></div><div><div>diff --git a/include/types.h b/include/types.h</div><div>index b295dc6..a04dfbc 100644</div><div>--- a/include/types.h</div><div>+++ b/include/types.h</div><div>@@ -35,6 +35,7 @@</div><div> #define VPS_PRESTART SCRIPTDIR "/vps-prestart"</div><div> </div><div> /* User-defined scripts are in VPSCONFDIR */</div><div>+#define USER_PRECREATE_SCRIPT VPSCONFDIR "/vps.precreate"</div><div> #define USER_CREATE_SCRIPT VPSCONFDIR "/vps.create"</div><div> </div><div> #ifndef __ENVID_T_DEFINED__</div><div>diff --git a/src/lib/create.c b/src/lib/create.c</div><div>index effcd08..6c16436 100644</div><div>--- a/src/lib/create.c</div><div>+++ b/src/lib/create.c</div><div>@@ -465,6 +465,12 @@ int vps_create(vps_handler *h, envid_t veid, vps_param *vps_p, vps_param *cmd_p,</div><div> goto err_cfg;</div><div> }</div><div> </div><div>+ if ((ret = run_pre_script(veid, USER_PRECREATE_SCRIPT))) {</div><div>+ logger(0, 0, "User pre-create script " USER_PRECREATE_SCRIPT</div><div>+ " exited with error");</div><div>+ goto err_cfg;</div><div>+ }</div><div>+</div><div> if (action != NULL && action->mod_count) {</div><div> if ((ret = mod_setup(h, veid, 0, 0, action, vps_p)))</div><div> goto err_cfg;</div></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On 19 May 2015 at 07:37, Kir Kolyshkin <span dir="ltr"><<a href="mailto:kir@openvz.org" target="_blank">kir@openvz.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
(I previously replied to Nikolay only -- re-sending with devel@
included)<span><br>
<br>
<div>On 05/12/2015 02:36 AM, Nikolay Tenev
wrote:<br>
</div>
</span><span><blockquote type="cite">
<div dir="ltr">Hello devs,
<div><br>
</div>
<div>
<div>In my project I wanted to make every OpenVZ container to
use for a private directory (VE_PRIVATE) separated block
device (HDD partition, lvm volume, NFS share, etc.). To use
wrapper script over vzctl was one option, but PRE_CREATE
hook, in which to create, mkfs and mount LVM volume would be
even better.</div>
<div><br>
</div>
<div>So, I'm not a developer, but using code from POST_CREATE
hook I was able to create the PRE_CREATE one, which can be
used as the other hooks e.g.</div>
<div><br>
</div>
<div>add in /etc/vz/dists/ default</div>
<div>PRE_CREATE = precreate.sh</div>
<div><br>
</div>
<div>and during</div>
<div>vzctl --create ...</div>
<div><br>
</div>
<div>it will call /etc/vz/dists/scripts/precreate.sh with VEID
as argument<br>
</div>
</div>
</div>
</blockquote>
<br></span><span>
Nope. These scripts are per-distribution scripts, i.e. they are
targeted for<br>
various distro-specific things, such as setting IP addresses etc.<br>
<br>
What you need is a global script, not dependent on CT distro. I
suggest<br>
a precreate.sh script similar to prestart.sh one (for details, see
commit<br>
<a href="https://github.com/kolyshkin/vzctl/commit/0807ef4" target="_blank">https://github.com/kolyshkin/vzctl/commit/0807ef4</a>)<br>
<br>
</span><blockquote type="cite">
<div dir="ltr">
<div><br>
</div><span>
<div>
<div>Currently I have a patch to vzctl master branch which
implements this PRE_CREATE hook and I'm ready to share it.</div>
<div><br>
</div>
<div>So my questions are:</div>
<div>- Do you find this for interesting and/or useful?</div>
<div>- If 'yes', what is the right way to send this patch:
here, by email; or to create pull request in git repo?</div>
</div>
</span></div>
</blockquote>
<br><span>
The best way would be to redo as advised above and send a patch to
devel@ list.<br>
<br>
Thanks,<br>
Kir.<br>
<br>
</span><blockquote type="cite">
<div dir="ltr">
<div>
<div><br>
</div>
<div>Best regards!</div>
</div>
<div><br>
</div>
<div>Nikolay Tenev</div>
<div><br>
</div>
</div>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Devel mailing list
<a href="mailto:Devel@openvz.org" target="_blank">Devel@openvz.org</a>
<a href="https://lists.openvz.org/mailman/listinfo/devel" target="_blank">https://lists.openvz.org/mailman/listinfo/devel</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br></div></div>