[Devel] [vzctl] exec early script at start

Yoann Moulin ymo at adviseo.fr
Thu Jan 17 06:41:36 PST 2008


> Have you tried using /etc/vz/conf/$VEID.start script? There are also
> .stop, .mount and .umount. I'm sorry if it is not documented; will fix that.

> Note that mount/umount scripts are both per-VE and global (global one is
> called vps.mount/vps.umount), while start/stop are only per-VE. This can
> easily be fixed: look at  src/lib/env.c, functions vps_start_custom()
> and vps_stop() to see how start/stop scripts is called, then look at
> src/lib/fs.c, functions vps_mount() and vps_umount() to see how both
> global and per-VE mount/umount scripts are called. Now you can modify
> code in env.c to have global start/stop scripts as well. Patches are
> welcome.

I have look, but start or mount script are call too late, as I said in my first
message, I'd like to execute a script before mounting the rootfs for the VE, so
maybe it can be done by adding a $VEID.premount and be place just after the
vps_is_run test.

I'm not very familiar with this syntaxes but I think it can be done similarly :

snprintf(buf, sizeof(buf), VPS_CONF_DIR "%d.%s", veid,
         START_PREFIX);
if (stat_file(buf)) {
         if (vps_exec_script(h, veid, res->fs.root, NULL, NULL,
                 buf, NULL, 0))
         {
                 ret = VZ_ACTIONSCRIPT_ERROR;
                 goto err;
         }
}

I'm investigate more into the code, and refresh some C knowledge to understand this

> PS the best way to do patches is to use git.

ok, I never use git before, but I will

Yoann




More information about the Devel mailing list