OpenVZ Forum


Home » Mailing lists » Devel » [WISH] exec early script at start
Re: [vzctl] exec early script at start [message #26220 is a reply to message #26152] Thu, 17 January 2008 14:41 Go to previous messageGo to previous message
Yoann Moulin is currently offline  Yoann Moulin
Messages: 16
Registered: December 2007
Junior Member
> 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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [RFC][-mm] Memory controller hierarchy support (v1)
Next Topic: To install OpenVZ in an Oracle installed system
Goto Forum:
  


Current Time: Wed Oct 08 08:06:51 GMT 2025

Total time taken to generate the page: 0.13162 seconds