[one-users] tune 'onevm saveas' behavior for OpenVZ

knawnd at gmail.com knawnd at gmail.com
Tue Aug 23 05:38:23 PDT 2011

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!


[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

More information about the Users mailing list