[one-users] BOOTPROTO, DHCP_HOSTNAME, and vm IPs in Sunstone

Stefan Kooman stefan at bit.nl
Wed Sep 17 22:39:27 PDT 2014


Quoting kerryhall . (kerryhall at gmail.com):
> I would definitely not prefer that the vm manage the IP. What I would like
> to do upon new vm creation:
> 
> 1. VM gets spun up with BOOTPROTO=dhcp
> 2. VM gets spun up with DHCP_HOSTNAME=$NAME
> 3. IP given to the VM by the dhcp server on my network is then the IP that
> is listed in sunstone for that VM.
> 
> AFAIK:
> 1. There is no way to achieve item 1 in ONE out of the box, I have to
> either write a bash script that gets run on VM spin up, or create an image
> that does this.

You don't need to make a VM contextualized to achieve that. Just
configure networking in the image to "DHCP".

> 2. I can set the _hostname_ via template, but in order to set DHCP_HOSTNAME
> again I have to run a bash script on spin up.
Why the DHCP_HOSTNAME? If you have a pre-configured list (all MAC's
statically configured in the DHCP server) it will get the correct
ip-address. You can set the correct HOSTNAME based on the VM template if
you want.
> 3. There is no way to accomplish item 3, outside of writing a bash script
> that runs on my head node that grabs IP data and dumps it into the
> database. Certainly this is not preferable.
At this point you've already accomplished point 3: VM has the IP-address
listed in OpenNebula. The only thing that you don't have is the VM name
in the "host" specificiation in the DHCP config. 

You can however, set the hostname in the DHCP configuration (option
host-name "your-vm-name-here") and configure the hostname (point 2)
based on this. This might even be a setting in dhclient / dhcpcd to do
that automatically. Then you just have to make sure you give the VM the
right IP and the right name (in Sunstone).

> 
> These three items taken all together suggest that including the option to
> easily support DHCP out of the box would be a nice feature to have.
> 
> I'm working on a bash script currently for 1 and 2, but for item 3 I am out
> of luck.
> 
> I hope that makes sense. Let me know if it doesn't and I would be happy to
> clarify further. Thank you for your help!!

I might completely misunderstand you, sorry if that's the case.

Gr. Stefan

-- 
| BIT BV  http://www.bit.nl/        Kamer van Koophandel 09090351
| GPG: 0xD14839C6                   +31 318 648 688 / info at bit.nl


More information about the Users mailing list