[Devel] [WISH] exec early script at start

Yoann Moulin ymo at adviseo.fr
Thu Dec 13 03:13:11 PST 2007


Hi all,

I'm working on a xen to openvz migration, and I still have some issue to fix. but some seem to be not possible yet.

actually, on our diskless servers (xen and others), we are using nfsroot. And at start, in the initrd, we are using a script 
that make a connexion on the nfs boot server and remove the old root, create a new one, take the last system image build, and re 
apply configuration with cfengine tools.

I'd like to do the same with openvz, but I didn't see in the source this possibility.

it could be someting like in src/lib/env.c in the vps_start_custom function (in pseudo code) :

         memset(&actions, 0, sizeof(actions));
         if (check_var(res->fs.root, "VE_ROOT is not set"))
                 return VZ_VE_ROOT_NOTSET;
         if (vps_is_run(h, veid)) {
                 logger(-1, 0, "VE is already running");
                 return VZ_VE_RUNNING;
         }
+
+       if (EARLY_SCRIPT) {
+           exec(EARLY_SCRIPT);
+       }
+
         if ((ret = check_ub(&res->ub)))
                 return ret;
         dist_name = get_dist_name(&res->tmpl);
         ret = read_dist_actions(dist_name, DIST_DIR, &actions);
         if (dist_name != NULL)
                 free(dist_name);
         if (ret)
                 return ret;
         logger(0, 0, "Starting VE ...");
         if (vps_is_mounted(res->fs.root)) {
                 /* if VE is mounted -- umount first, to cleanup mount state */
                 vps_umount(h, veid, res->fs.root, skip);
         }

I didn't do C for a while, so I'm not sure I'll be able to do something simple and safe.

I'm available to compile and test this until the openvz server should be production at the end of next week... but I'll take the 
time to do all the test we need before.

If some can help me on this issue.

thanks a lot

Yoann







More information about the Devel mailing list