[one-users] some questions about lxc surpporting?

Hector Sanjuan lists at convivencial.org
Sun Dec 2 02:44:35 PST 2012


Hello,


On Sun, 02 Dec 2012 04:26:05 +0100, cmcc.dylan <dx10years at 126.com> wrote:

> Hi, every one!
>    I want to add lxc backend for opennebula, but i meet some questions  
> and hope someone to help me.
>
> 1. the key point is i need to add a lxc driver like kvm, for example,  
> imitating the directory structure of kvm as follows:
> # ls var/remotes/vmm/kvm
> cancel	deploy	kvmrc  migrate	migrate_local  poll  poll_ganglia  reboot   
> restore  save  shutdown
> But i don't knonw who call the  these scripts, for example  where call  
> "deploy" script in opennebula soruce code or in config files.

After you have written your scripts, you need to add your drivers to the  
the oned.conf, just like the vmm_kvm drivers, except these would be  
vmm_lxc. Make sure your scripts are placed in var/remotes/vmm just like  
the kvm etc... when start opennebula oned.log should show that these  
drivers are loaded.

When you add new host to opennebula your scripts are copied to the host.  
When you deploy a virtual machine on that host, Opennebula ssh to the host  
and call the 'deploy' script some arguments. Same for all the other  
actions. Documentation about this:

http://opennebula.org/documentation:rel3.8:devel-vmm

Now the tricky part would be to generate the appropiate lxc.xml for  
deployment. You would need to set the type attribute in the oned.conf  
vmm_lxc configuration to XML. The generated opennebula deployment file by  
opennebula will be simply the opennebula template in XML format. In your  
deploy script you should translate the information in it to whatever lxc  
libvirt driver needs.

> 2. I have already validate virsh commad  is ok. and i can use command as  
> follows to create and operate the lxc instance.
> a. Deploy: ssh node1 virsh -c lxc:/// create /path-to-xml/lxc.xml
> b. virsh -c lxc+ssh://node1 virsh-command lxc_instance_name
> But i know little ruby,someone can give me some advice to help me  
> complete lxc driver for opennebula

You scripts do not need to be in Ruby per se. You can choose any language  
of your choice, as long as they can be executed in the remote host and  
perform the actions you want to perform everything is fine.

Perhaps looking at OpenNebula Virtualbox driver helps you to understand:  
https://github.com/hsanjuan/OneVBox (note that it doesn't use virsh  
though, but rather interpret the deployment XML file and perform the  
necessary actions to setup the VM as it indicates)

Regards,

-- 
Hector Sanjuan
@hecsanjuan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20121202/e90308c6/attachment-0002.htm>


More information about the Users mailing list