<!DOCTYPE html><html><head>
<style type="text/css">body { font-family:'DejaVu Sans Mono'; font-size:12px}</style>
</head>
<body><div>Hello,</div><div><br></div><div><br></div><div>On Sun, 02 Dec 2012 04:26:05 +0100, cmcc.dylan <dx10years@126.com> wrote:<br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Hi, every one!<div> I want to add lxc backend for opennebula, but i meet some questions and hope someone to help me.</div><div><br></div><div>1. the key point is i need to add a lxc driver like kvm, for example, imitating the directory structure of kvm as follows:</div><div><div># ls var/remotes/vmm/kvm</div><div>cancel<span class="Apple-tab-span" style="white-space:pre"> </span>deploy<span class="Apple-tab-span" style="white-space:pre"> </span>kvmrc migrate<span class="Apple-tab-span" style="white-space:pre"> </span>migrate_local poll poll_ganglia reboot restore save shutdown</div></div><div>But i don't knonw who call the these scripts, for example where call "deploy" script in opennebula soruce code or in config files.</div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>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:</div><div><br></div><div>http://opennebula.org/documentation:rel3.8:devel-vmm</div><div><br></div><div>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.</div><div><br></div><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div>2. I have already validate virsh commad is ok. and i can use command as follows to create and operate the lxc instance.</div><div> a. Deploy: ssh node1 virsh -c lxc:/// create /path-to-xml/lxc.xml</div><div> b. virsh -c lxc+ssh://node1 virsh-command lxc_instance_name</div><div>But i know little ruby,someone can give me some advice to help me complete lxc driver for opennebula</div></div></blockquote><div><br></div><div>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.</div><div><br></div><div>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)</div><div><br></div><div>Regards,<br></div><br><div id="M2Signature"><div>-- </div><div>Hector Sanjuan<br>@hecsanjuan</div></div></body></html>