Dear Nikolay, I think the image.rb approach won't work anyway, because it is executed on the DONE state, when the transfer manager already staged back the disk.i's already to the ONE FrontEnd.
So I guess where you really want to set this tar operation is in the TM scripts. Take a look at src/tm_mad/ssh/tm_mv.sh. The last lines are: -- exec_and_log "$SSH $DST_HOST mkdir -p $DST_DIR" exec_and_log "$SCP -r $SRC $DST" exec_and_log "$SSH $SRC_HOST rm -rf $SRC_PATH" -- you have to ensure that $SRC is the tar.gz of the modified openVZ disk (that is, with the modifications after running the VM). You will need also to modify src/tm_mad/nfs/tm_mv.sh to allow for shared storage configurations. You can create new TMs (tm_ssh_openvz and tm_nfs_openvz) by basically using all the existing tm_* scripts, and including the modified tm_mv.sh Hope it helps, -Tino -- Constantino Vázquez Blanco, MSc OpenNebula Major Contributor www.OpenNebula.org | @tinova79 On Tue, Aug 23, 2011 at 2:38 PM, <[email protected]> wrote: > Tino Vazquez wrote on 23/08/11 14:58: >>> >>> So for now I would like to make a 'onevm saveas' command work with OpenVZ >>> VMs as well as if the SAVE sub-attribute is set to yes for OpenNebula >>> 2.2.1. >>> As far as I understand both these features trigger >>> $ONE_LOCATOIN/share/hooks/image.rb script. So in order to achieve a >>> desired >>> behavior a command like 'tar -czf $VM_DIR/<VMID>/images/disk.0 -C >>> /vz/private/<VMID>/ *' must be executed in the beginning of that hook >>> (image.rb) what would replace the original disk.0 file. Is that correct? >>> I would appreciate any help on that. >> >> Yes, this seems like a good approach. Have you tried it out? It look fine >> to me. > > I started to modify $ONE_LOCATION/share/hooks/image.rb file but then > realized that hooks ($ONE_LOCATOIN/share/hooks/image.rb) is executed locally > on FN whereas the VM directory packaging/archiving has to be done remotely > i.e. on CNs. So adding to that hook something that needs to be done remotely > (like > ssh root@<CN> "sudo tar -Sp -C -czf #{source_path} ." would break remote and > local hooks logic as I wrote before in [1] >> So I see not so much possibilities: >> 1) add the execution of tar command on remote node in image.rb hook which >> is executed on local (front-end) node i.e. such approach breaks the >> local/remote hooks logic; >> 2) create one more custom hook what has to be executed on remote node >> and what would archive VM working dir. But there are several issues here: >> - how one can make sure that custom hook will be executed before >> image.rb one since both of them should be triggered when VM reaches the >> DONE state, >> - how make that custom hook trigger only upon 'onevm saveas' command >> execution or if SAVE sub-attribute of DISK attribute is set to YES. > > So I am stuck at that point. > > As always any help on that is highly appreciated! > > Regards, > Nikolay. > > [1] http://article.gmane.org/gmane.comp.distributed.opennebula.user/3948 > >> >> Regards, and many thanks for the detailed emails (it does help a long >> way in understanding the issue ;)) >> >> -Tino > _______________________________________________ Users mailing list [email protected] http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
