[one-users] hostname and IP address as arguments for 'onetemplate instantiate' command

Carlos Martín Sánchez cmartin at opennebula.org
Thu Oct 18 06:13:28 PDT 2012


Hi,

You can request a specific IP from the network using NIC/IP [1]. For
example:

NIC = [
  NETWORK_ID="0",
  IP = "10.10.10.1"
]

This can't be parameterized, but you can try to automate it in bash doing a
'onetemplate update' and pipe it to sed to replace the IP. Or write a small
ruby script to get the template info, change the IP, and do an instantiate
action.


Regards

[1] http://opennebula.org/documentation:rel3.6:template#network_section
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open-source Solution for Data Center Virtualization
www.OpenNebula.org | cmartin at opennebula.org |
@OpenNebula<http://twitter.com/opennebula><cmartin at opennebula.org>



On Thu, Oct 18, 2012 at 7:20 AM, <knawnd at gmail.com> wrote:

> Dear community,
>
> I wonder if there is a way to assign a certain IP address for particular
> VM created and deployed by 'onetemplate instantiate' command? Right now it
> looks like IP is chosen randomly from the pool of free IP addresses
> (leases).
> Moreover from time to time I need to create a bunch of identical VMs which
> differ only by hostnames and corresponding IP addresses.
> It seems that the use of 'onetemplate instantiate' command looks
> reasonable in that case but I don't know how to pass the IP addresses.
>
> I would assume something like
> $ onetemplate instantiate --name vm%i -m 5 --ip 10.10.10.%i
>
> with the following network definition and contextualization section in
> template description as below:
> NIC=[ NETWORK_ID="0" ]
>
> CONTEXT=[
> HOSTNAME="$NAME.domain.org",
> NAMESERVER="$NETWORK[DNS, NETWORK_ID=0 ]" ]
>
>
> I can't use DHCP since venet is used as network devices (I am using OpenVZ
> hypervisor) and venet doesn't support DHCP.
> So I wonder what the possible ways to pass hostname and corresponding IP
> address to the VM deployment file are to be parsed by deploy script and
> make a proper OpenVZ config file?
>
> Iam using OpenNebula 3.6 installed from rpm.
>
> Regards,
> Nikolay.
>
> ______________________________**_________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/**listinfo.cgi/users-opennebula.**org<http://lists.opennebula.org/listinfo.cgi/users-opennebula.org>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20121018/39e198cd/attachment-0002.htm>


More information about the Users mailing list