<p dir="ltr">Hi Kerry, </p>
<p dir="ltr">It seems that you are confused about not seeing the IP assigned by OpenNebula matching the IP assigned by the DHCP server:</p>
<p dir="ltr">1. If the IP addresses are managed by the DHCP server, then you can just ignore the IP assigned by OpenNebula. It is derived from the MAC and it is not used in this case by OpenNebula. </p>
<p dir="ltr">if you need to populate the IP of the VM to the VM Template to be queried through Sunstone or CLI that could be done by onegate or a custom monitor probe. </p>
<p dir="ltr">2. If OpenNebula manages the IPs you can integrate the DHCP server as explained by Valentin</p>
<p dir="ltr">3. In 4.8 you can define the network as type Ethernet, to express that the IP is manged externally and get rid of the IP inconsistency you may be seeing. </p>
<p dir="ltr">Hope it helps </p>
<p dir="ltr">Cheers</p>
<p dir="ltr">Ruben</p>
<div class="gmail_quote">On Jul 24, 2014 9:37 PM, "kerryhall ." <<a href="mailto:kerryhall@gmail.com">kerryhall@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div>Valentin,<br><br></div>Thank you for the help! <br><br></div><div>Yes, AFAIK the DNS server is configured with a dynamic zone that is updated from the DHCP
server.</div><div><br>It sounds like the DHCP server in use is Microsoft DHCP. I would like to avoid using the DHCP API if possible, just because I have no experience in that area, and seems like a messy solution.<br><br>
Thinking about this more, here are the desired steps:<br></div>1. User spins up vm via web interface.<br></div>2. Contextualization sets "DHCP_HOSTNAME" to vm name. <br></div>3. DHCP server gives vm an IP address. <br>
</div>4. Sunstone sets the correct IP information in its database. <br><div><div><br></div><div>I can basically do all this manually by <br></div><div>1. Spin up vm<br></div><div>2. edit ifcfg-eth0, setting BOOTPROTO and DHCP_HOSTNAME<br>
</div><div>3. restart networking<br><br></div><div>So it sounds like I can write a bash script that takes care of 2. and 3., something that runs when the vm is spun up.<br><br>However, I don't know how to manually tell Sunstone what the new, correct IP is. Do you know how I could accomplish that?<br>
</div><div><br></div><div>I can write a bash or perl script that fixes this manually in MySQL....but that seems like a Really Bad Idea. :)<br><br></div><div>I'm surprised that OpenNebula doesn't support DHCP out of the box. Seems like a common use case. I wonder if I should make a feature request. <br>
</div><div><br>Thanks!<br>Kerry<br></div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 23, 2014 at 10:03 PM, Valentin Bud <span dir="ltr"><<a href="mailto:valentin.bud@gmail.com" target="_blank">valentin.bud@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Kerry,<div><br></div><div>When you say "DNS and DHCP are tied into one system on my network" you mean</div>
<div>your DNS server is configured with a dynamic zone that is updated from the DHCP</div>
<div>server?</div><div><br></div><div>If that is so, I guess you want a VM to acquire a lease from the DHCP server equal</div><div>to the IP given by OpenNebula to that specific VM. This way it maintains consistency.</div>
<div><br></div><div>If you populate CONTEXT with NETWORK="YES", the contextualization packages </div><div>will do the job of configuring the network. As far as I know it's not possible to "tell"</div>
<div>the contextualization packages to leave the network unconfigured. So using this approach</div><div>would not get you where you want.</div><div><br></div><div>One way of achieving what you desire is to program a hook that inserts a host in the</div>
<div>DHCP server via OMAPI [1]. From the hook you have access to the entire template.</div><div>I am assuming you are using ISC DHCP. This would solve the consistency issue.</div><div><br></div><div>Now the VM needs to be configured for DHCP as you mentioned in your previous E-Mail.</div>
<div><br></div><div>For that you can define SET_HOSTNAME in the CONTEXT to have it available in the</div><div>VM, create a simple (bash) program that reads it and sets ifcfg-eth0 accordingly. Put the</div><div>script in the files datastore and update the context to use it via FILES_DS and INIT_SCRIPTS.</div>
<div><br></div><div>For example you name your super script set_dhcp.sh. You can insert in the files datastore [2]</div><div>using `oneimage create -d files --name set_dhcp.sh --type CONTEXT /path/to/set_dhcp.sh`.</div><div>
<br></div><div>Update the template to use it.</div><div><br></div><div>CONTEXT=[</div><div>FILES_DS="$FILE[IMAGE=\"set_dhcp.sh\",</div><div>INIT_SCRIPTS="set_dhcp.sh"]<br></div><div><br></div><div>
This way the vmcontext init.d script from the contextualization packages would skip the </div><div>network configuration, note NETWORK="YES" is missing and it would run the set_dhcp.sh</div><div>script. </div><div>
<br></div><div>One more thing that comes to mind, SET_HOSTNAME would instruct the vmcontext init</div><div>script to set the hostname and maybe that's not what you want, maybe you want your VM</div><div>to set it's hostname from DHCP. In this case use another variable, like DHCP_HOSTNAME</div>
<div>in CONTEXT and process it in set_dhcp.sh to configure ifcfg-eth0.</div><div><br></div><div>You can set DHCP_HOSTNAME=$NAME inside the template. This way the name you</div><div>give the VM in Sunstone would end up being used.</div>
<div><br></div><div>Take the above with a grain of salt, I am sure there are other (better) ways of achieving</div><div>what you desire.</div><div><br></div><div>@Diego could you please point me where have you find <span style="font-family:arial,sans-serif;font-size:13px">DHCP in the VNET template? </span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">I have looked over the docs and couldn't find it.</span></div><div><br></div><div>[1]: <a href="http://ipamworldwide.com/dhcp-api.html" target="_blank">http://ipamworldwide.com/dhcp-api.html</a></div>
<div class="gmail_extra">[2]: <a href="http://docs.opennebula.org/4.6/administration/storage/file_ds.html" target="_blank">http://docs.opennebula.org/4.6/administration/storage/file_ds.html</a><br><br>Best,</div><div class="gmail_extra">
Valentin</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote"><div><div>On Wed, Jul 23, 2014 at 10:45 PM, kerryhall . <span dir="ltr"><<a href="mailto:kerryhall@gmail.com" target="_blank">kerryhall@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><div dir="ltr"><div><div>
I have managed to figure out how to edit my template (onetemplate update TEMPLATE_ID) so I can now set the hostname. However, DNS and DHCP are tied into one system on my network, so I can't perform a dig on my new server and get the IP back. <br>
<br>I just need to know what lines to add to my template file to get my vms to use DHCP only. I'm sure it's something really simple, I just can't find any info here:<br><a href="http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html" target="_blank">http://docs.opennebula.org/4.6/user/virtual_machine_setup/cong.html</a><br>
<br></div><div>If you know how to get DHCP working, please let me know.<br><br>Thank you!!<br></div></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 22, 2014 at 3:48 PM, kerryhall . <span dir="ltr"><<a href="mailto:kerryhall@gmail.com" target="_blank">kerryhall@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi folks,<br><br>
I want to configure Open Nebula to contextualize two items for ifcfg-eth0.<br>
<br></div>BOOTPROTO=dhcp<br></div>and <br></div>DHCP_HOSTNAME=<parameter passed in via ONE web interface, even just vm-name would work><br>
<br></div>I need no other networking settings. DHCP on my network handles the rest. I have tried manually setting these two parameters in ifcfg-eth0 and it looks like it works. (Although the new IP given via DHCP doesn't match the original IP)<br>
<br>Is this possible to do in ONE? If so, where do I start?<br><br>Thanks!<br></div>Kerry<br></div>
</blockquote></div><br></div>
</div></div><br></div></div><div>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org" target="_blank">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></div></blockquote></div><br></div></div>
</blockquote></div><br></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opennebula.org">Users@lists.opennebula.org</a><br>
<a href="http://lists.opennebula.org/listinfo.cgi/users-opennebula.org" target="_blank">http://lists.opennebula.org/listinfo.cgi/users-opennebula.org</a><br>
<br></blockquote></div>