Re: [Openstack] Guest VM IP configuration script

2016-08-31 Thread Kevin Benton
The neutron DHCP agent does not issue leases for ports that don't exist in
the Neutron DB. There was a time when it would issue a DHCPNAK to other
DHCP traffic[1], but that's been fixed for quite some time now. perhaps
that was the bad behavior in Juno that you observed?

1. http://lists.openstack.org/pipermail/openstack-dev/2015-May/064725.html

On Tue, Aug 30, 2016 at 7:44 AM, Satish Patel  wrote:

> Robert,
>
> I didn't find any related configuration which blacklist mac address on
> Mitaka. also i didn't find any document stated that DHCP agent only
> gives ip address to instance mac address.
>
> Do you point me to any doc or any kind of material
>
> On Fri, Aug 26, 2016 at 4:07 PM, Van Leeuwen, Robert
>  wrote:
> > Are you sure it was DHCP misbehaving?
> > Because it could also have been that it tried to takeover the gateway IP.
> > That would certainly mess with connectivity on the network.
> >
> > Just mentioning because you gave the example --router:external while I
> think it should be --router:external True
> >
> > Also if it is dhcp misbehaving you might be able to fix it with the
> dnsmasq_config_file option in the dhcp agent. You can probably blacklist
> everything that does not start with the OpenStack MAC range. (Base_mac
> setting)
> >
> > I currently don't have a setup to reproduce this so I cannot be 100%
> sure about the details or if this works ;-)
> >
> > Cheers,
> > Robert van Leeuwen
> >
> >
> >> On 26 Aug 2016, at 18:58, Satish Patel  wrote:
> >>
> >> Robert,
> >>
> >> I remembered in JUNO release when i did flat network with my existing
> >> provider LAN then DHCP started giving IPs to my existing LAN clients
> >> and people started yelling their network is down :(
> >>
> >> Following networking i configured.
> >>
> >> #neutron net-create network1 --provider:network_type flat
> >> --provider:physical_network extnet  --router:external --shared
> >>
> >> #neutron subnet-create --name subnet1 --enable_dhcp=True
> >> --allocation-pool=start=10.0.3.160,end=10.0.3.166 --gateway=10.0.0.1
> >> network1 10.0.0.0/21
> >>
> >> After realizing issue i have changed  --enable_dhcp=False
> >>
> >> On Fri, Aug 26, 2016 at 2:35 AM, Van Leeuwen, Robert
> >>  wrote:
>  When i was trying to use DHCP in openstack i found openstack DHCP
>  start provide ip address to my existing LAN machines ( we are using
>  flat VLAN with neutron), that is why i disable openstack DHCP, Is it
>  common or i am doing something wrong?
> >>>
> >>> I do not think this should happen.
> >>> It has been a while (Folsom) since I touched a setup with mixed “LAN”
> and OpenStack DHCP but IIRC it works like this:
> >>>
> >>> AFAIK the leases file neutron uses is very specific and will only
> reply to the mac-addresses that are in the dnsmasq config.
> >>> Looking at the dnsmasq process it is set to static:
> >>> From the man page:
> >>> The optional  keyword may be static which tells dnsmasq to
> enable DHCP for the network specified, but not to dynamically allocate IP
> addresses, only hosts which have static addresses given via dhcp-host or
> from /etc/ethers will be served.
> >>>
> >>> Usually the problem is the other way around:
> >>> The existing DHCP in the “lan” bites with what OpenStack does. (so an
> OpenStack instance gets an IP from the lan DHCP)
> >>> This can be prevented by blacklisting the MAC address range your
> instances get in your lan dhcp (Blacklist MAC starting with fa:16:3e )
> >>>
> >>> Cheers,
> >>> Robert van Leeuwen
> >>>
>
> ___
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
>
___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-31 Thread Turbo Fredriksson
On Aug 31, 2016, at 7:15 AM, Van Leeuwen, Robert wrote:

> When you look at the dnsmasq process on a neutron server it is indeed set to 
> static and uses the –dhcp-host options:
> dnsmasq  --dhcp-range=set:tag0,1.1.1.0,static,5529600s  
> --dhcp-hostsfile=/var/lib/neutron/dhcp/123-4567/host --lots_of_other_options

Using static IPs with DNSMasq isn't horribly difficult, but it takes
a little attention.

This is examples from my own setup. I have all my compute nodes configured
to get DHCP addresses, but in the DHCP server (dnsmasq), I make sure it
gives out static IPs. This is a HP Blade Center, with 16 BL460c/G6 blades:

/etc/dnsmasq.conf
=
# Network for the iLO interface on the blades
dhcp-range=net:iLO,10.0.1.0,static,infinite

# The default network (anything else - dynamic IPs)
dhcp-range=192.168.69.150,192.168.69.250,12h

# Network for eth1 on the blades
dhcp-range=net:bc1,10.0.4.0,static,infinite

# MAC to IP to HOSTNAME mapping
dhcp-host=78:e7:d1:5e:32:22,10.0.1.1,bladeA01-iLO,infinite
dhcp-host=78:e7:d1:59:f8:ec,10.0.4.1,bladeA01,infinite
[etc]

# Make sure to tag the hosts
dhcp-vendorclass=iLO,CPQRIB3# iLO class
dhcp-vendorclass=bc1,PXEClient:Arch:0:UNDI:002001   # PXE boot
dhcp-vendorclass=bc1,d-i# Debian installer asks 
with this

# Options for Blade Center 1 - iLO
dhcp-option=iLO,1,255.255.255.0
dhcp-option=iLO,3,10.0.1.254
dhcp-option=iLO,6,10.0.1.254
dhcp-option=iLO,15,domain.tld
dhcp-option=iLO,28,10.0.1.255
dhcp-option=iLO,42,10.0.1.254
dhcp-option=iLO,119,domain.tld.

# Options for Blade Center 1 - blades
dhcp-option=bc1,1,255.255.255.0
dhcp-option=bc1,3,10.0.4.254
dhcp-option=bc1,6,10.0.4.254
dhcp-option=bc1,15,domain.tld
dhcp-option=bc1,28,10.0.4.255
dhcp-option=bc1,42,10.0.4.254
dhcp-option=bc1,119,openstack.domain.tld.

# Options for the default network
dhcp-option=15,domain.tld
dhcp-option=23,50
dhcp-option=27,1
dhcp-option=40,domain
dhcp-option=42,0.0.0.0
dhcp-option=44,192.168.69.8
dhcp-option=45,192.168.69.8
dhcp-option=119,domain.tld

/etc/hosts
=
10.0.1.1bladeA01-iLO.domain.tld bladeA01-iLO
10.0.4.1bladeA01.domain.tld bladeA01b openstack control control1 
controller
[etc]


Have a look at http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html
for explanation on these options and their possible values. The "secret"
is actually the "dhcp-vendorclass"! That's what "tags" the request so that
it can then be "routed" (bad word, but it kind'a makes a little sense)
to the right "dhcp-option" and to the correct "dhcp-host" (which, of course
also uses the MAC for selection).
___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-31 Thread Van Leeuwen, Robert
On 8/30/16, 4:44 PM, "Satish Patel"  wrote:

>Robert,
>   
>I didn't find any related configuration which blacklist mac address on
>Mitaka. also i didn't find any document stated that DHCP agent only
>   gives ip address to instance mac address.

I am not sure if there is any specific doc about this on the OpenStack pages.
However, neutron starts a dnsmasq process so you can have a look with ps on how 
that is running and configured.

I am no dnsmasq expert but I looking at the dnsmasq man page:
“The optional  keyword may be static which tells dnsmasq to enable DHCP 
for the network specified, but not to dynamically allocate IP addresses: only 
hosts which have static addresses given via dhcp-host or from /etc/ethers will 
be served”

When you look at the dnsmasq process on a neutron server it is indeed set to 
static and uses the –dhcp-host options:
dnsmasq  --dhcp-range=set:tag0,1.1.1.0,static,5529600s  
--dhcp-hostsfile=/var/lib/neutron/dhcp/123-4567/host --lots_of_other_options

Disclaimer:
Last time I had this scenario it was 2 years ago so my memory could be 
deceiving me but this was also the behavior I experienced.
(Not 100% sure but I think we did have a custom build dnsmasq because the 
centos 6 version did not support all the required options or something.
Since it was at a previous job I can no longer check but I am pretty sure it 
worked with 2 dhcp servers in the same range. 
Although it also depends a bit on which DHCP responds quicker on what behavior 
you will see exactly. In theory our “LAN” dhcp just could have been 
consistently quicker)

Cheers,
Robert van Leeuwen


___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-30 Thread Brent Troge
this is how i do things without dhcp services in the network.

1. enable config-drive within server declaration
2. using cloud-config write out the network l3 information to a file on the
guest.
3. using cloud-config you can then add an user-data script to your
config-drive,
4. the user data script will parse the injected file and configure the
guest NICs accordingly



resources:
  mysc:
type: OS::Heat::SoftwareConfig
properties:
  config:
   str_replace:
 template: {get_file: myscript.sh}
 params:
   $target: blah
  myuserdata:
type: OS::Heat::MultipartMime
properties:
  parts:
  - config: {get_resource: myconfig}
  - config: {get_resource: mysc}
  myconfig:
type: OS::Heat::CloudConfig
properties:
  cloud_config:
write_files:
- path: /var/tmp/network-out
  content: { get_attr: [ myport1, subnets ] }
..
  myserver:
type: OS::Nova::Server
properties:
  ..
  config_drive: True
  user_data_format: RAW
  user_data:
get_resource: myuserdata







On Tue, Aug 30, 2016 at 9:44 AM, Satish Patel  wrote:

> Robert,
>
> I didn't find any related configuration which blacklist mac address on
> Mitaka. also i didn't find any document stated that DHCP agent only
> gives ip address to instance mac address.
>
> Do you point me to any doc or any kind of material
>
> On Fri, Aug 26, 2016 at 4:07 PM, Van Leeuwen, Robert
>  wrote:
> > Are you sure it was DHCP misbehaving?
> > Because it could also have been that it tried to takeover the gateway IP.
> > That would certainly mess with connectivity on the network.
> >
> > Just mentioning because you gave the example --router:external while I
> think it should be --router:external True
> >
> > Also if it is dhcp misbehaving you might be able to fix it with the
> dnsmasq_config_file option in the dhcp agent. You can probably blacklist
> everything that does not start with the OpenStack MAC range. (Base_mac
> setting)
> >
> > I currently don't have a setup to reproduce this so I cannot be 100%
> sure about the details or if this works ;-)
> >
> > Cheers,
> > Robert van Leeuwen
> >
> >
> >> On 26 Aug 2016, at 18:58, Satish Patel  wrote:
> >>
> >> Robert,
> >>
> >> I remembered in JUNO release when i did flat network with my existing
> >> provider LAN then DHCP started giving IPs to my existing LAN clients
> >> and people started yelling their network is down :(
> >>
> >> Following networking i configured.
> >>
> >> #neutron net-create network1 --provider:network_type flat
> >> --provider:physical_network extnet  --router:external --shared
> >>
> >> #neutron subnet-create --name subnet1 --enable_dhcp=True
> >> --allocation-pool=start=10.0.3.160,end=10.0.3.166 --gateway=10.0.0.1
> >> network1 10.0.0.0/21
> >>
> >> After realizing issue i have changed  --enable_dhcp=False
> >>
> >> On Fri, Aug 26, 2016 at 2:35 AM, Van Leeuwen, Robert
> >>  wrote:
>  When i was trying to use DHCP in openstack i found openstack DHCP
>  start provide ip address to my existing LAN machines ( we are using
>  flat VLAN with neutron), that is why i disable openstack DHCP, Is it
>  common or i am doing something wrong?
> >>>
> >>> I do not think this should happen.
> >>> It has been a while (Folsom) since I touched a setup with mixed “LAN”
> and OpenStack DHCP but IIRC it works like this:
> >>>
> >>> AFAIK the leases file neutron uses is very specific and will only
> reply to the mac-addresses that are in the dnsmasq config.
> >>> Looking at the dnsmasq process it is set to static:
> >>> From the man page:
> >>> The optional  keyword may be static which tells dnsmasq to
> enable DHCP for the network specified, but not to dynamically allocate IP
> addresses, only hosts which have static addresses given via dhcp-host or
> from /etc/ethers will be served.
> >>>
> >>> Usually the problem is the other way around:
> >>> The existing DHCP in the “lan” bites with what OpenStack does. (so an
> OpenStack instance gets an IP from the lan DHCP)
> >>> This can be prevented by blacklisting the MAC address range your
> instances get in your lan dhcp (Blacklist MAC starting with fa:16:3e )
> >>>
> >>> Cheers,
> >>> Robert van Leeuwen
> >>>
>
> ___
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/
> openstack
>
___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-30 Thread Satish Patel
Robert,

I didn't find any related configuration which blacklist mac address on
Mitaka. also i didn't find any document stated that DHCP agent only
gives ip address to instance mac address.

Do you point me to any doc or any kind of material

On Fri, Aug 26, 2016 at 4:07 PM, Van Leeuwen, Robert
 wrote:
> Are you sure it was DHCP misbehaving?
> Because it could also have been that it tried to takeover the gateway IP.
> That would certainly mess with connectivity on the network.
>
> Just mentioning because you gave the example --router:external while I think 
> it should be --router:external True
>
> Also if it is dhcp misbehaving you might be able to fix it with the 
> dnsmasq_config_file option in the dhcp agent. You can probably blacklist 
> everything that does not start with the OpenStack MAC range. (Base_mac 
> setting)
>
> I currently don't have a setup to reproduce this so I cannot be 100% sure 
> about the details or if this works ;-)
>
> Cheers,
> Robert van Leeuwen
>
>
>> On 26 Aug 2016, at 18:58, Satish Patel  wrote:
>>
>> Robert,
>>
>> I remembered in JUNO release when i did flat network with my existing
>> provider LAN then DHCP started giving IPs to my existing LAN clients
>> and people started yelling their network is down :(
>>
>> Following networking i configured.
>>
>> #neutron net-create network1 --provider:network_type flat
>> --provider:physical_network extnet  --router:external --shared
>>
>> #neutron subnet-create --name subnet1 --enable_dhcp=True
>> --allocation-pool=start=10.0.3.160,end=10.0.3.166 --gateway=10.0.0.1
>> network1 10.0.0.0/21
>>
>> After realizing issue i have changed  --enable_dhcp=False
>>
>> On Fri, Aug 26, 2016 at 2:35 AM, Van Leeuwen, Robert
>>  wrote:
 When i was trying to use DHCP in openstack i found openstack DHCP
 start provide ip address to my existing LAN machines ( we are using
 flat VLAN with neutron), that is why i disable openstack DHCP, Is it
 common or i am doing something wrong?
>>>
>>> I do not think this should happen.
>>> It has been a while (Folsom) since I touched a setup with mixed “LAN” and 
>>> OpenStack DHCP but IIRC it works like this:
>>>
>>> AFAIK the leases file neutron uses is very specific and will only reply to 
>>> the mac-addresses that are in the dnsmasq config.
>>> Looking at the dnsmasq process it is set to static:
>>> From the man page:
>>> The optional  keyword may be static which tells dnsmasq to enable 
>>> DHCP for the network specified, but not to dynamically allocate IP 
>>> addresses, only hosts which have static addresses given via dhcp-host or 
>>> from /etc/ethers will be served.
>>>
>>> Usually the problem is the other way around:
>>> The existing DHCP in the “lan” bites with what OpenStack does. (so an 
>>> OpenStack instance gets an IP from the lan DHCP)
>>> This can be prevented by blacklisting the MAC address range your instances 
>>> get in your lan dhcp (Blacklist MAC starting with fa:16:3e )
>>>
>>> Cheers,
>>> Robert van Leeuwen
>>>

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-26 Thread Van Leeuwen, Robert
Are you sure it was DHCP misbehaving?
Because it could also have been that it tried to takeover the gateway IP.
That would certainly mess with connectivity on the network.

Just mentioning because you gave the example --router:external while I think it 
should be --router:external True

Also if it is dhcp misbehaving you might be able to fix it with the 
dnsmasq_config_file option in the dhcp agent. You can probably blacklist 
everything that does not start with the OpenStack MAC range. (Base_mac setting)

I currently don't have a setup to reproduce this so I cannot be 100% sure about 
the details or if this works ;-)

Cheers,
Robert van Leeuwen


> On 26 Aug 2016, at 18:58, Satish Patel  wrote:
> 
> Robert,
> 
> I remembered in JUNO release when i did flat network with my existing
> provider LAN then DHCP started giving IPs to my existing LAN clients
> and people started yelling their network is down :(
> 
> Following networking i configured.
> 
> #neutron net-create network1 --provider:network_type flat
> --provider:physical_network extnet  --router:external --shared
> 
> #neutron subnet-create --name subnet1 --enable_dhcp=True
> --allocation-pool=start=10.0.3.160,end=10.0.3.166 --gateway=10.0.0.1
> network1 10.0.0.0/21
> 
> After realizing issue i have changed  --enable_dhcp=False
> 
> On Fri, Aug 26, 2016 at 2:35 AM, Van Leeuwen, Robert
>  wrote:
>>> When i was trying to use DHCP in openstack i found openstack DHCP
>>> start provide ip address to my existing LAN machines ( we are using
>>> flat VLAN with neutron), that is why i disable openstack DHCP, Is it
>>> common or i am doing something wrong?
>> 
>> I do not think this should happen.
>> It has been a while (Folsom) since I touched a setup with mixed “LAN” and 
>> OpenStack DHCP but IIRC it works like this:
>> 
>> AFAIK the leases file neutron uses is very specific and will only reply to 
>> the mac-addresses that are in the dnsmasq config.
>> Looking at the dnsmasq process it is set to static:
>> From the man page:
>> The optional  keyword may be static which tells dnsmasq to enable DHCP 
>> for the network specified, but not to dynamically allocate IP addresses, 
>> only hosts which have static addresses given via dhcp-host or from 
>> /etc/ethers will be served.
>> 
>> Usually the problem is the other way around:
>> The existing DHCP in the “lan” bites with what OpenStack does. (so an 
>> OpenStack instance gets an IP from the lan DHCP)
>> This can be prevented by blacklisting the MAC address range your instances 
>> get in your lan dhcp (Blacklist MAC starting with fa:16:3e )
>> 
>> Cheers,
>> Robert van Leeuwen
>> 

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-26 Thread Van Leeuwen, Robert
> When i was trying to use DHCP in openstack i found openstack DHCP
> start provide ip address to my existing LAN machines ( we are using
> flat VLAN with neutron), that is why i disable openstack DHCP, Is it
> common or i am doing something wrong?

I do not think this should happen.
It has been a while (Folsom) since I touched a setup with mixed “LAN” and 
OpenStack DHCP but IIRC it works like this:

AFAIK the leases file neutron uses is very specific and will only reply to the 
mac-addresses that are in the dnsmasq config.
Looking at the dnsmasq process it is set to static:
From the man page:
The optional  keyword may be static which tells dnsmasq to enable DHCP 
for the network specified, but not to dynamically allocate IP addresses, only 
hosts which have static addresses given via dhcp-host or from /etc/ethers will 
be served.

Usually the problem is the other way around:
The existing DHCP in the “lan” bites with what OpenStack does. (so an OpenStack 
instance gets an IP from the lan DHCP)
This can be prevented by blacklisting the MAC address range your instances get 
in your lan dhcp (Blacklist MAC starting with fa:16:3e )

Cheers,
Robert van Leeuwen

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Kaustubh Kelkar
The get_attr{} function should return the address in IPADDR variable. 

Remember, you *do need* another NIC connected to metadata server with DHCP 
enabled, since the user-data is retrieved from the metadata server. By default, 
Ubuntu has the 1st interface configured to get IP from DHCP server, which I 
usually connect to the network that hosts the metadata server, and the rest of 
the interfaces can get IPs from this method.


-Kaustubh
> -Original Message-
> From: Satish Patel [mailto:satish@gmail.com]
> Sent: Thursday, August 25, 2016 5:58 PM
> To: Kaustubh Kelkar <kaustubh.kel...@casa-systems.com>
> Cc: Eugen Block <ebl...@nde.ag>; openstack <openstack@lists.openstack.org>
> Subject: Re: [Openstack] Guest VM IP configuration script
> 
> This is perfect!
> 
> In your script, does it automatically query to neutron to get IP ADDRESS of
> instance? or i need to manually set IP address in script variable $IPADDR
> 
> 
> In setup Openstack start VM and also assign IP address from allocated pool 
> but i
> want to automatically pass that IP address to script (cloud-init or heat) 
> whatever
> to set IP in instance.
> 
> 
> 
> 
> On Thu, Aug 25, 2016 at 10:11 AM, Kaustubh Kelkar <kaustubh.kelkar@casa-
> systems.com> wrote:
> > Here is a heat template that I use (the indentation might be off). I have 
> > one
> network with DHCP enabled that connects to metadata server:
> >
> > heat_template_version: 2015-04-30
> >
> > parameters:
> >   mgmt:
> > type: json
> > description: ID of the mgmt network
> > default: { "name": "mgmt" ,
> >"id": "abcd1234" }
> >
> >   no_dhcp_net:
> > type: string
> > default: "wxyz6789"
> >
> > resources:
> >   server:
> > type: OS::Nova::Server
> > properties:
> >   name:test-vm
> >   image: ubuntu-16.04
> >   flavor: m1.small
> >   networks:
> >- network: { get_param: [ mgmt, id ] }
> >- port: { get_resource: server_port }
> >   user_data_format: RAW
> >   user_data:
> > str_replace:
> >   template: |
> > #!/bin/bash
> > echo -e "\n" >> /etc/network/interfaces
> > echo "auto ens4" >> /etc/network/interfaces
> > echo "iface ens4 inet static" >> /etc/network/interfaces
> > echo "address $IPADDR" >> /etc/network/interfaces
> > echo "netmask 255.255.255.0" >> /etc/network/interfaces
> > ifdown ens4 2>/dev/null
> > ifup ens4 2>/dev/null
> >   params:
> > $IPADDR: { get_attr: [ server_port, fixed_ips, 0,
> > ip_address ] }
> >
> >   server_port:
> > type: OS::Neutron::Port
> > properties:
> >   network_id: { get_param: no_dhcp_net }
> >
> > outputs:
> >   dump:
> > value: { get_attr: [ server, show ] }
> >
> >
> > Hope this helps.
> >
> > As for config-drive, I hope the folks can shed some light.
> >
> >
> > -Kaustubh
> >
> >> -Original Message-
> >> From: Satish Patel [mailto:satish@gmail.com]
> >> Sent: Thursday, August 25, 2016 9:27 AM
> >> To: Eugen Block <ebl...@nde.ag>
> >> Cc: openstack <openstack@lists.openstack.org>
> >> Subject: Re: [Openstack] Guest VM IP configuration script
> >>
> >> Eugen,
> >>
> >> I think config-drive make sense when you don't have initial network
> >> in place. In my case i don't care about fixed-IP for instance. I only
> >> need to setup network using whatever IP neutron provide in that case
> >> how do i query neutron port to find out what IP address is available
> >> or neutron going to provide so i can take that information and pass to
> userdata. Its sounds tricky any idea how to do that?
> >>
> >> On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
> >> > Hi,
> >> >
> >> > we've been trying to learn how to feed cloud-init with ip
> >> > addresses, too. If DHCP is disabled in your network, the instance
> >> > won't get it's
> >> > eth0 configured and won't be able to query the metadata server.
> >> > Creating a port before attaching it to a booting instance also
> >> > doesn't work if no dhcp is running on that network, I just tried that to 
> 

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Satish Patel
This is perfect!

In your script, does it automatically query to neutron to get IP
ADDRESS of instance? or i need to manually set IP address in script
variable $IPADDR


In setup Openstack start VM and also assign IP address from allocated
pool but i want to automatically pass that IP address to script
(cloud-init or heat) whatever to set IP in instance.




On Thu, Aug 25, 2016 at 10:11 AM, Kaustubh Kelkar
<kaustubh.kel...@casa-systems.com> wrote:
> Here is a heat template that I use (the indentation might be off). I have one 
> network with DHCP enabled that connects to metadata server:
>
> heat_template_version: 2015-04-30
>
> parameters:
>   mgmt:
> type: json
> description: ID of the mgmt network
> default: { "name": "mgmt" ,
>"id": "abcd1234" }
>
>   no_dhcp_net:
> type: string
> default: "wxyz6789"
>
> resources:
>   server:
> type: OS::Nova::Server
> properties:
>   name:test-vm
>   image: ubuntu-16.04
>   flavor: m1.small
>   networks:
>- network: { get_param: [ mgmt, id ] }
>- port: { get_resource: server_port }
>   user_data_format: RAW
>   user_data:
> str_replace:
>   template: |
> #!/bin/bash
> echo -e "\n" >> /etc/network/interfaces
> echo "auto ens4" >> /etc/network/interfaces
> echo "iface ens4 inet static" >> /etc/network/interfaces
> echo "address $IPADDR" >> /etc/network/interfaces
> echo "netmask 255.255.255.0" >> /etc/network/interfaces
> ifdown ens4 2>/dev/null
> ifup ens4 2>/dev/null
>   params:
> $IPADDR: { get_attr: [ server_port, fixed_ips, 0, ip_address ] }
>
>   server_port:
> type: OS::Neutron::Port
> properties:
>   network_id: { get_param: no_dhcp_net }
>
> outputs:
>   dump:
> value: { get_attr: [ server, show ] }
>
>
> Hope this helps.
>
> As for config-drive, I hope the folks can shed some light.
>
>
> -Kaustubh
>
>> -Original Message-
>> From: Satish Patel [mailto:satish@gmail.com]
>> Sent: Thursday, August 25, 2016 9:27 AM
>> To: Eugen Block <ebl...@nde.ag>
>> Cc: openstack <openstack@lists.openstack.org>
>> Subject: Re: [Openstack] Guest VM IP configuration script
>>
>> Eugen,
>>
>> I think config-drive make sense when you don't have initial network in 
>> place. In
>> my case i don't care about fixed-IP for instance. I only need to setup 
>> network
>> using whatever IP neutron provide in that case how do i query neutron port to
>> find out what IP address is available or neutron going to provide so i can 
>> take
>> that information and pass to userdata. Its sounds tricky any idea how to do 
>> that?
>>
>> On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
>> > Hi,
>> >
>> > we've been trying to learn how to feed cloud-init with ip addresses,
>> > too. If DHCP is disabled in your network, the instance won't get it's
>> > eth0 configured and won't be able to query the metadata server.
>> > Creating a port before attaching it to a booting instance also doesn't
>> > work if no dhcp is running on that network, I just tried that to be sure.
>> >
>> > I've tried several ways but I only found one working option. For
>> > external networks (or networks without dhcp) we are using config-drive
>> > now. Depending on the OpenStack version it could be possible that
>> > you'll need cloud-init-0.7.7, we had to fix two issues ourselves in
>> > version 0.7.6 to get it working, one of them was a missing default route.
>> >
>> > With enabled config-drive the instance doesn't need a configured
>> > interface, it's a temporarily mounted drive from where the required
>> > information is read by cloud-init.
>> > You can either add the option "--config-drive true" in your nova boot
>> > call or check the checkbox in Horizon.
>> >
>> > To answer your question about ports, you can create a new port either
>> > in Horizon, but there you won't be able to assign a specific ip
>> > address. If you want a specific ip address you have to call neutron
>> > port-create (port-name is optional):
>> >
>> >neutron port-create  --fixed-ip
>> > subnet_id=,ip_address= --name 
>> >
>> > The resulting ID of that port can be used in 

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Eugen Block
v/2014-December/053069.html.


-Kaustubh


-Original Message-
From: Satish Patel [mailto:satish@gmail.com]
Sent: Wednesday, August 24, 2016 5:05 PM
To: James Downs <e...@egon.cc>
Cc: openstack <openstack@lists.openstack.org>
Subject: Re: [Openstack] Guest VM IP configuration script

I am using neutron networking with vlan ( its provider VLAN). We are not
using
DHCP but i need some kind of hack to inject IP address in instance using
cloud-
init.

We are using cloud-init but i don't know how does it work and get IP
from
neutron. I am new with neutron stuff.

On Wed, Aug 24, 2016 at 4:29 PM, James Downs <e...@egon.cc> wrote:
> On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
>> I enabled following in nova.conf on compute node but didn't work :(
>>
>> flat_injected=true
>>
>> Do i need to do anything else?
>
> Are you using flat networking?
> Nova-networks or Neutron?
>
> At this point, if you're not using DHCP, your only option is to
> arrange to feed
the networking information into the metadata for the VM at creation
time, and
use someting like cloud-init to configure the networking. The ancient
networking injection stuff has either been removed, or been broken for
years.
>
> Cheers,
> -j
>
> ___
> Mailing list:
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

___
Mailing list:
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe :
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack



___
Mailing list:
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe :
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack





--
Eugen Block voice   : +49-40-559 51 75
NDE Netzdesign und -entwicklung AG  fax : +49-40-559 51 77
Postfach 61 03 15
D-22423 Hamburg e-mail  : ebl...@nde.ag

Vorsitzende des Aufsichtsrates: Angelika Mozdzen
  Sitz und Registergericht: Hamburg, HRB 90934
  Vorstand: Jens-U. Mozdzen
   USt-IdNr. DE 814 013 983



___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack




--
Eugen Block voice   : +49-40-559 51 75
NDE Netzdesign und -entwicklung AG  fax : +49-40-559 51 77
Postfach 61 03 15
D-22423 Hamburg e-mail  : ebl...@nde.ag

Vorsitzende des Aufsichtsrates: Angelika Mozdzen
  Sitz und Registergericht: Hamburg, HRB 90934
  Vorstand: Jens-U. Mozdzen
   USt-IdNr. DE 814 013 983


___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Kaustubh Kelkar
Here is a heat template that I use (the indentation might be off). I have one 
network with DHCP enabled that connects to metadata server:

heat_template_version: 2015-04-30

parameters:
  mgmt:
type: json
description: ID of the mgmt network
default: { "name": "mgmt" ,
   "id": "abcd1234" }

  no_dhcp_net:
type: string
default: "wxyz6789"

resources:
  server:
type: OS::Nova::Server
properties:
  name:test-vm
  image: ubuntu-16.04
  flavor: m1.small
  networks:
   - network: { get_param: [ mgmt, id ] }
   - port: { get_resource: server_port }
  user_data_format: RAW
  user_data:
str_replace:
  template: |
#!/bin/bash
echo -e "\n" >> /etc/network/interfaces
echo "auto ens4" >> /etc/network/interfaces
echo "iface ens4 inet static" >> /etc/network/interfaces
echo "address $IPADDR" >> /etc/network/interfaces
echo "netmask 255.255.255.0" >> /etc/network/interfaces
ifdown ens4 2>/dev/null
ifup ens4 2>/dev/null
  params:
$IPADDR: { get_attr: [ server_port, fixed_ips, 0, ip_address ] }

  server_port:
type: OS::Neutron::Port
properties:
  network_id: { get_param: no_dhcp_net }

outputs:
  dump:
value: { get_attr: [ server, show ] }


Hope this helps.

As for config-drive, I hope the folks can shed some light.


-Kaustubh

> -Original Message-
> From: Satish Patel [mailto:satish@gmail.com]
> Sent: Thursday, August 25, 2016 9:27 AM
> To: Eugen Block <ebl...@nde.ag>
> Cc: openstack <openstack@lists.openstack.org>
> Subject: Re: [Openstack] Guest VM IP configuration script
> 
> Eugen,
> 
> I think config-drive make sense when you don't have initial network in place. 
> In
> my case i don't care about fixed-IP for instance. I only need to setup network
> using whatever IP neutron provide in that case how do i query neutron port to
> find out what IP address is available or neutron going to provide so i can 
> take
> that information and pass to userdata. Its sounds tricky any idea how to do 
> that?
> 
> On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
> > Hi,
> >
> > we've been trying to learn how to feed cloud-init with ip addresses,
> > too. If DHCP is disabled in your network, the instance won't get it's
> > eth0 configured and won't be able to query the metadata server.
> > Creating a port before attaching it to a booting instance also doesn't
> > work if no dhcp is running on that network, I just tried that to be sure.
> >
> > I've tried several ways but I only found one working option. For
> > external networks (or networks without dhcp) we are using config-drive
> > now. Depending on the OpenStack version it could be possible that
> > you'll need cloud-init-0.7.7, we had to fix two issues ourselves in
> > version 0.7.6 to get it working, one of them was a missing default route.
> >
> > With enabled config-drive the instance doesn't need a configured
> > interface, it's a temporarily mounted drive from where the required
> > information is read by cloud-init.
> > You can either add the option "--config-drive true" in your nova boot
> > call or check the checkbox in Horizon.
> >
> > To answer your question about ports, you can create a new port either
> > in Horizon, but there you won't be able to assign a specific ip
> > address. If you want a specific ip address you have to call neutron
> > port-create (port-name is optional):
> >
> >neutron port-create  --fixed-ip
> > subnet_id=,ip_address= --name 
> >
> > The resulting ID of that port can be used in nova boot call:
> >
> >nova boot --flavor 2 --image  --nic port-id=
> > 
> >
> > Another way to assign a specific ip address to a booting instance
> > without port-creation (but DHCP has to be enabled) would be:
> >
> >nova boot --flavor 2 --image  --nic
> > net-id=,v4-fixed-ip= 
> >
> > for example:
> >nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980
> > --nic
> > net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6
> > test1
> >
> > Hope this helps!
> >
> >
> > Zitat von Satish Patel <satish@gmail.com>:
> >
> >
> >> My question is how to query ports and pass info to cloud-init?  is
> >> there any document or api which i can call using script and setup
> >> network ifcfg-eth0 file
> >>
> >> 

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Kaustubh Kelkar
If you are using VLANs, you can configure the physical switch to not forward 
frames with VLAN tags (that are used within openstack) out the other ports.

> -Original Message-
> From: Satish Patel [mailto:satish@gmail.com]
> Sent: Thursday, August 25, 2016 9:31 AM
> To: Eugen Block <ebl...@nde.ag>
> Cc: openstack <openstack@lists.openstack.org>
> Subject: Re: [Openstack] Guest VM IP configuration script
> 
> I am planning to upgrade liberty to mitaka now so hope i will have latest and
> greatest feature to solve this problem. why openstack community doesn't have
> any straightforward solution.
> 
> When i was trying to use DHCP in openstack i found openstack DHCP start
> provide ip address to my existing LAN machines ( we are using flat VLAN with
> neutron), that is why i disable openstack DHCP, Is it common or i am doing
> something wrong?
> 
> We have existing DHCP in out LAN i don't want openstack DHCP take over and
> start assigning own IPs to Provide LAN.
> 
> neutron subnet-create  ext_net --gateway 10.35.1.254 10.35.1.0/24 -- --
> enable_dhcp=True
> 
> On Thu, Aug 25, 2016 at 9:26 AM, Satish Patel <satish@gmail.com> wrote:
> > Eugen,
> >
> > I think config-drive make sense when you don't have initial network in
> > place. In my case i don't care about fixed-IP for instance. I only
> > need to setup network using whatever IP neutron provide in that case
> > how do i query neutron port to find out what IP address is available
> > or neutron going to provide so i can take that information and pass to
> > userdata. Its sounds tricky any idea how to do that?
> >
> > On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
> >> Hi,
> >>
> >> we've been trying to learn how to feed cloud-init with ip addresses,
> >> too. If DHCP is disabled in your network, the instance won't get it's
> >> eth0 configured and won't be able to query the metadata server.
> >> Creating a port before attaching it to a booting instance also
> >> doesn't work if no dhcp is running on that network, I just tried that to 
> >> be sure.
> >>
> >> I've tried several ways but I only found one working option. For
> >> external networks (or networks without dhcp) we are using
> >> config-drive now. Depending on the OpenStack version it could be
> >> possible that you'll need cloud-init-0.7.7, we had to fix two issues
> >> ourselves in version 0.7.6 to get it working, one of them was a missing
> default route.
> >>
> >> With enabled config-drive the instance doesn't need a configured
> >> interface, it's a temporarily mounted drive from where the required
> >> information is read by cloud-init.
> >> You can either add the option "--config-drive true" in your nova boot
> >> call or check the checkbox in Horizon.
> >>
> >> To answer your question about ports, you can create a new port either
> >> in Horizon, but there you won't be able to assign a specific ip
> >> address. If you want a specific ip address you have to call neutron
> >> port-create (port-name is optional):
> >>
> >>neutron port-create  --fixed-ip
> >> subnet_id=,ip_address= --name 
> >>
> >> The resulting ID of that port can be used in nova boot call:
> >>
> >>nova boot --flavor 2 --image  --nic port-id=
> >> 
> >>
> >> Another way to assign a specific ip address to a booting instance
> >> without port-creation (but DHCP has to be enabled) would be:
> >>
> >>nova boot --flavor 2 --image  --nic
> >> net-id=,v4-fixed-ip= 
> >>
> >> for example:
> >>nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980
> >> --nic
> >> net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6
> >> test1
> >>
> >> Hope this helps!
> >>
> >>
> >> Zitat von Satish Patel <satish@gmail.com>:
> >>
> >>
> >>> My question is how to query ports and pass info to cloud-init?  is
> >>> there any document or api which i can call using script and setup
> >>> network ifcfg-eth0 file
> >>>
> >>> On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
> >>> <kaustubh.kel...@casa-systems.com> wrote:
> >>>>
> >>>> You can create the ports beforehand and plug them in while creating
> >>>> the instance. As for assigning IP addresses, you can query the
> >>>> ports and pass the informa

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Satish Patel
I am planning to upgrade liberty to mitaka now so hope i will have
latest and greatest feature to solve this problem. why openstack
community doesn't have any straightforward solution.

When i was trying to use DHCP in openstack i found openstack DHCP
start provide ip address to my existing LAN machines ( we are using
flat VLAN with neutron), that is why i disable openstack DHCP, Is it
common or i am doing something wrong?

We have existing DHCP in out LAN i don't want openstack DHCP take over
and start assigning own IPs to Provide LAN.

neutron subnet-create  ext_net --gateway 10.35.1.254 10.35.1.0/24 --
--enable_dhcp=True

On Thu, Aug 25, 2016 at 9:26 AM, Satish Patel <satish@gmail.com> wrote:
> Eugen,
>
> I think config-drive make sense when you don't have initial network in
> place. In my case i don't care about fixed-IP for instance. I only
> need to setup network using whatever IP neutron provide in that case
> how do i query neutron port to find out what IP address is available
> or neutron going to provide so i can take that information and pass to
> userdata. Its sounds tricky any idea how to do that?
>
> On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
>> Hi,
>>
>> we've been trying to learn how to feed cloud-init with ip addresses, too. If
>> DHCP is disabled in your network, the instance won't get it's eth0
>> configured and won't be able to query the metadata server.
>> Creating a port before attaching it to a booting instance also doesn't work
>> if no dhcp is running on that network, I just tried that to be sure.
>>
>> I've tried several ways but I only found one working option. For external
>> networks (or networks without dhcp) we are using config-drive now. Depending
>> on the OpenStack version it could be possible that you'll need
>> cloud-init-0.7.7, we had to fix two issues ourselves in version 0.7.6 to get
>> it working, one of them was a missing default route.
>>
>> With enabled config-drive the instance doesn't need a configured interface,
>> it's a temporarily mounted drive from where the required information is read
>> by cloud-init.
>> You can either add the option "--config-drive true" in your nova boot call
>> or check the checkbox in Horizon.
>>
>> To answer your question about ports, you can create a new port either in
>> Horizon, but there you won't be able to assign a specific ip address. If you
>> want a specific ip address you have to call neutron port-create (port-name
>> is optional):
>>
>>neutron port-create  --fixed-ip
>> subnet_id=,ip_address= --name 
>>
>> The resulting ID of that port can be used in nova boot call:
>>
>>nova boot --flavor 2 --image  --nic port-id=
>> 
>>
>> Another way to assign a specific ip address to a booting instance without
>> port-creation (but DHCP has to be enabled) would be:
>>
>>nova boot --flavor 2 --image  --nic
>> net-id=,v4-fixed-ip= 
>>
>> for example:
>>nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980 --nic
>> net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6 test1
>>
>> Hope this helps!
>>
>>
>> Zitat von Satish Patel <satish@gmail.com>:
>>
>>
>>> My question is how to query ports and pass info to cloud-init?  is
>>> there any document or api which i can call using script and setup
>>> network ifcfg-eth0 file
>>>
>>> On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
>>> <kaustubh.kel...@casa-systems.com> wrote:
>>>>
>>>> You can create the ports beforehand and plug them in while creating the
>>>> instance. As for assigning IP addresses, you can query the ports and pass
>>>> the information to cloud-init. I am not sure if there is any other way to 
>>>> do
>>>> this.
>>>>
>>>> Even if DHCP is disabled, OpenStack assigns IP information to ports when
>>>> a VM is created, and you can see this in your dashboard. The MAC and IP
>>>> information is used to configure iptables rules within security groups. 
>>>> Here
>>>> is the archived thread that provides this information:
>>>> http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.
>>>>
>>>>
>>>> -Kaustubh
>>>>
>>>>> -Original Message-
>>>>> From: Satish Patel [mailto:satish@gmail.com]
>>>>> Sent: Wednesday, August 24, 2016 5:05 PM
>>>>> To: James Downs <e...@egon.cc>
>>>>> Cc: openstac

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Satish Patel
Eugen,

I think config-drive make sense when you don't have initial network in
place. In my case i don't care about fixed-IP for instance. I only
need to setup network using whatever IP neutron provide in that case
how do i query neutron port to find out what IP address is available
or neutron going to provide so i can take that information and pass to
userdata. Its sounds tricky any idea how to do that?

On Thu, Aug 25, 2016 at 2:53 AM, Eugen Block <ebl...@nde.ag> wrote:
> Hi,
>
> we've been trying to learn how to feed cloud-init with ip addresses, too. If
> DHCP is disabled in your network, the instance won't get it's eth0
> configured and won't be able to query the metadata server.
> Creating a port before attaching it to a booting instance also doesn't work
> if no dhcp is running on that network, I just tried that to be sure.
>
> I've tried several ways but I only found one working option. For external
> networks (or networks without dhcp) we are using config-drive now. Depending
> on the OpenStack version it could be possible that you'll need
> cloud-init-0.7.7, we had to fix two issues ourselves in version 0.7.6 to get
> it working, one of them was a missing default route.
>
> With enabled config-drive the instance doesn't need a configured interface,
> it's a temporarily mounted drive from where the required information is read
> by cloud-init.
> You can either add the option "--config-drive true" in your nova boot call
> or check the checkbox in Horizon.
>
> To answer your question about ports, you can create a new port either in
> Horizon, but there you won't be able to assign a specific ip address. If you
> want a specific ip address you have to call neutron port-create (port-name
> is optional):
>
>neutron port-create  --fixed-ip
> subnet_id=,ip_address= --name 
>
> The resulting ID of that port can be used in nova boot call:
>
>nova boot --flavor 2 --image  --nic port-id=
> 
>
> Another way to assign a specific ip address to a booting instance without
> port-creation (but DHCP has to be enabled) would be:
>
>nova boot --flavor 2 --image  --nic
> net-id=,v4-fixed-ip= 
>
> for example:
>nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980 --nic
> net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6 test1
>
> Hope this helps!
>
>
> Zitat von Satish Patel <satish@gmail.com>:
>
>
>> My question is how to query ports and pass info to cloud-init?  is
>> there any document or api which i can call using script and setup
>> network ifcfg-eth0 file
>>
>> On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
>> <kaustubh.kel...@casa-systems.com> wrote:
>>>
>>> You can create the ports beforehand and plug them in while creating the
>>> instance. As for assigning IP addresses, you can query the ports and pass
>>> the information to cloud-init. I am not sure if there is any other way to do
>>> this.
>>>
>>> Even if DHCP is disabled, OpenStack assigns IP information to ports when
>>> a VM is created, and you can see this in your dashboard. The MAC and IP
>>> information is used to configure iptables rules within security groups. Here
>>> is the archived thread that provides this information:
>>> http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.
>>>
>>>
>>> -Kaustubh
>>>
>>>> -Original Message-
>>>> From: Satish Patel [mailto:satish@gmail.com]
>>>> Sent: Wednesday, August 24, 2016 5:05 PM
>>>> To: James Downs <e...@egon.cc>
>>>> Cc: openstack <openstack@lists.openstack.org>
>>>> Subject: Re: [Openstack] Guest VM IP configuration script
>>>>
>>>> I am using neutron networking with vlan ( its provider VLAN). We are not
>>>> using
>>>> DHCP but i need some kind of hack to inject IP address in instance using
>>>> cloud-
>>>> init.
>>>>
>>>> We are using cloud-init but i don't know how does it work and get IP
>>>> from
>>>> neutron. I am new with neutron stuff.
>>>>
>>>> On Wed, Aug 24, 2016 at 4:29 PM, James Downs <e...@egon.cc> wrote:
>>>> > On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
>>>> >> I enabled following in nova.conf on compute node but didn't work :(
>>>> >>
>>>> >> flat_injected=true
>>>> >>
>>>> >> Do i need to do anything else?
>>>> >
>>>> > Are you using flat networ

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Eugen Block
You can download the tarball for cloud-init-0.7.7 from [1] already.  
You would have to build the packages yourself, I don't know if that's  
an option for you.
Currently, we're in a review process at OBS to upgrade from 0.7.6 to  
0.7.7 based on this new tarball. In case it will be accepted you'll  
have the newest rpm in the official repositories of openSUSE incl. a  
fix for missing default gateway. Please notice that we're running  
Mitaka on openSUSE distro, not Liberty.


Regards,
Eugen

[1] https://launchpad.net/cloud-init/+download


Zitat von Andreas Scheuring <scheu...@linux.vnet.ibm.com>:


We faced a similar issue while doing some tests in the past.
In any case you need to use the config drive. This is the only way how
your instance can access the IP information required.


There seem to be 3 ways for doing the configuration

#1 There is some code for cloud-init in review [1], that would do that.
But that would need to be merged first, a new version release is
required and your distro needs to pick that release. I'm not sure about
the current state, but it seems to be still in review.

#2 Use Glean [2] instead of cloud-init. It's an alternative to
cloud-init. But of course your image needs to have glean installed and
configured.

#3 hack your own solution. We did that for our limited scenario. With
nova file inject we injected a larger python script, doing all the
configuration. We used cloud-init to execute that script (directly
passing that script in with cloud-init was not possible, as it was too
large - that's why this hack was required :P). I would not recommend
going this way, cause you need to consider all the things like routes
and so on.


I personally think the best solution is #2 for now.



[1]
https://code.launchpad.net/~harlowja/cloud-init/cloud-init-net-sysconfig
[2] http://docs.openstack.org/infra/glean/



--
-
Andreas
IRC: andreas_s (formerly scheuran)



On Do, 2016-08-25 at 08:53 +0200, Eugen Block wrote:

Hi,

we've been trying to learn how to feed cloud-init with ip addresses,
too. If DHCP is disabled in your network, the instance won't get it's
eth0 configured and won't be able to query the metadata server.
Creating a port before attaching it to a booting instance also doesn't
work if no dhcp is running on that network, I just tried that to be
sure.

I've tried several ways but I only found one working option. For
external networks (or networks without dhcp) we are using config-drive
now. Depending on the OpenStack version it could be possible that
you'll need cloud-init-0.7.7, we had to fix two issues ourselves in
version 0.7.6 to get it working, one of them was a missing default
route.

With enabled config-drive the instance doesn't need a configured
interface, it's a temporarily mounted drive from where the required
information is read by cloud-init.
You can either add the option "--config-drive true" in your nova boot
call or check the checkbox in Horizon.

To answer your question about ports, you can create a new port either
in Horizon, but there you won't be able to assign a specific ip
address. If you want a specific ip address you have to call neutron
port-create (port-name is optional):

neutron port-create  --fixed-ip
subnet_id=,ip_address= --name 

The resulting ID of that port can be used in nova boot call:

nova boot --flavor 2 --image  --nic port-id=


Another way to assign a specific ip address to a booting instance
without port-creation (but DHCP has to be enabled) would be:

nova boot --flavor 2 --image  --nic
net-id=,v4-fixed-ip= 

for example:
nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980
--nic
net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6
test1

Hope this helps!


Zitat von Satish Patel <satish@gmail.com>:

> My question is how to query ports and pass info to cloud-init?  is
> there any document or api which i can call using script and setup
> network ifcfg-eth0 file
>
> On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
> <kaustubh.kel...@casa-systems.com> wrote:
>> You can create the ports beforehand and plug them in while creating
>> the instance. As for assigning IP addresses, you can query the
>> ports and pass the information to cloud-init. I am not sure if
>> there is any other way to do this.
>>
>> Even if DHCP is disabled, OpenStack assigns IP information to ports
>> when a VM is created, and you can see this in your dashboard. The
>> MAC and IP information is used to configure iptables rules within
>> security groups. Here is the archived thread that provides this
>> information:
>>  
http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.

>>
>>
>> -Kaustubh
>>
>>> -Original Message-
>>> From: Satish Patel [mailto:satish@gmail.com]
>>> Sent: Wednesday, August 24, 2016 5:05 PM
&g

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Andreas Scheuring
We faced a similar issue while doing some tests in the past.
In any case you need to use the config drive. This is the only way how
your instance can access the IP information required.


There seem to be 3 ways for doing the configuration

#1 There is some code for cloud-init in review [1], that would do that.
But that would need to be merged first, a new version release is
required and your distro needs to pick that release. I'm not sure about
the current state, but it seems to be still in review.

#2 Use Glean [2] instead of cloud-init. It's an alternative to
cloud-init. But of course your image needs to have glean installed and
configured.

#3 hack your own solution. We did that for our limited scenario. With
nova file inject we injected a larger python script, doing all the
configuration. We used cloud-init to execute that script (directly
passing that script in with cloud-init was not possible, as it was too
large - that's why this hack was required :P). I would not recommend
going this way, cause you need to consider all the things like routes
and so on. 


I personally think the best solution is #2 for now.



[1]
https://code.launchpad.net/~harlowja/cloud-init/cloud-init-net-sysconfig
[2] http://docs.openstack.org/infra/glean/



-- 
-
Andreas 
IRC: andreas_s (formerly scheuran)



On Do, 2016-08-25 at 08:53 +0200, Eugen Block wrote:
> Hi,
> 
> we've been trying to learn how to feed cloud-init with ip addresses,  
> too. If DHCP is disabled in your network, the instance won't get it's  
> eth0 configured and won't be able to query the metadata server.
> Creating a port before attaching it to a booting instance also doesn't  
> work if no dhcp is running on that network, I just tried that to be  
> sure.
> 
> I've tried several ways but I only found one working option. For  
> external networks (or networks without dhcp) we are using config-drive  
> now. Depending on the OpenStack version it could be possible that  
> you'll need cloud-init-0.7.7, we had to fix two issues ourselves in  
> version 0.7.6 to get it working, one of them was a missing default  
> route.
> 
> With enabled config-drive the instance doesn't need a configured  
> interface, it's a temporarily mounted drive from where the required  
> information is read by cloud-init.
> You can either add the option "--config-drive true" in your nova boot  
> call or check the checkbox in Horizon.
> 
> To answer your question about ports, you can create a new port either  
> in Horizon, but there you won't be able to assign a specific ip  
> address. If you want a specific ip address you have to call neutron  
> port-create (port-name is optional):
> 
> neutron port-create  --fixed-ip  
> subnet_id=,ip_address= --name 
> 
> The resulting ID of that port can be used in nova boot call:
> 
> nova boot --flavor 2 --image  --nic port-id=  
> 
> 
> Another way to assign a specific ip address to a booting instance  
> without port-creation (but DHCP has to be enabled) would be:
> 
> nova boot --flavor 2 --image  --nic  
> net-id=,v4-fixed-ip= 
> 
> for example:
> nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980  
> --nic  
> net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6  
> test1
> 
> Hope this helps!
> 
> 
> Zitat von Satish Patel <satish@gmail.com>:
> 
> > My question is how to query ports and pass info to cloud-init?  is
> > there any document or api which i can call using script and setup
> > network ifcfg-eth0 file
> >
> > On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
> > <kaustubh.kel...@casa-systems.com> wrote:
> >> You can create the ports beforehand and plug them in while creating  
> >> the instance. As for assigning IP addresses, you can query the  
> >> ports and pass the information to cloud-init. I am not sure if  
> >> there is any other way to do this.
> >>
> >> Even if DHCP is disabled, OpenStack assigns IP information to ports  
> >> when a VM is created, and you can see this in your dashboard. The  
> >> MAC and IP information is used to configure iptables rules within  
> >> security groups. Here is the archived thread that provides this  
> >> information:  
> >> http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.
> >>
> >>
> >> -Kaustubh
> >>
> >>> -Original Message-
> >>> From: Satish Patel [mailto:satish@gmail.com]
> >>> Sent: Wednesday, August 24, 2016 5:05 PM
> >>> To: James Downs <e...@egon.cc>
> >>> Cc: openstack <openstack@lists.openstack.org>
> >>> Subject: Re: [Openstack] Guest VM IP 

Re: [Openstack] Guest VM IP configuration script

2016-08-25 Thread Eugen Block

Hi,

we've been trying to learn how to feed cloud-init with ip addresses,  
too. If DHCP is disabled in your network, the instance won't get it's  
eth0 configured and won't be able to query the metadata server.
Creating a port before attaching it to a booting instance also doesn't  
work if no dhcp is running on that network, I just tried that to be  
sure.


I've tried several ways but I only found one working option. For  
external networks (or networks without dhcp) we are using config-drive  
now. Depending on the OpenStack version it could be possible that  
you'll need cloud-init-0.7.7, we had to fix two issues ourselves in  
version 0.7.6 to get it working, one of them was a missing default  
route.


With enabled config-drive the instance doesn't need a configured  
interface, it's a temporarily mounted drive from where the required  
information is read by cloud-init.
You can either add the option "--config-drive true" in your nova boot  
call or check the checkbox in Horizon.


To answer your question about ports, you can create a new port either  
in Horizon, but there you won't be able to assign a specific ip  
address. If you want a specific ip address you have to call neutron  
port-create (port-name is optional):


   neutron port-create  --fixed-ip  
subnet_id=,ip_address= --name 


The resulting ID of that port can be used in nova boot call:

   nova boot --flavor 2 --image  --nic port-id=  



Another way to assign a specific ip address to a booting instance  
without port-creation (but DHCP has to be enabled) would be:


   nova boot --flavor 2 --image  --nic  
net-id=,v4-fixed-ip= 


for example:
   nova boot --flavor 2 --image dc05b777-3122-4021-b7eb-8d96fdab2980  
--nic  
net-id=4421e160-d675-49f2-8c29-9722aebf03b2,v4-fixed-ip=192.168.124.6  
test1


Hope this helps!


Zitat von Satish Patel <satish@gmail.com>:


My question is how to query ports and pass info to cloud-init?  is
there any document or api which i can call using script and setup
network ifcfg-eth0 file

On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
<kaustubh.kel...@casa-systems.com> wrote:
You can create the ports beforehand and plug them in while creating  
the instance. As for assigning IP addresses, you can query the  
ports and pass the information to cloud-init. I am not sure if  
there is any other way to do this.


Even if DHCP is disabled, OpenStack assigns IP information to ports  
when a VM is created, and you can see this in your dashboard. The  
MAC and IP information is used to configure iptables rules within  
security groups. Here is the archived thread that provides this  
information:  
http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.



-Kaustubh


-Original Message-
From: Satish Patel [mailto:satish@gmail.com]
Sent: Wednesday, August 24, 2016 5:05 PM
To: James Downs <e...@egon.cc>
Cc: openstack <openstack@lists.openstack.org>
Subject: Re: [Openstack] Guest VM IP configuration script

I am using neutron networking with vlan ( its provider VLAN). We  
are not using
DHCP but i need some kind of hack to inject IP address in instance  
using cloud-

init.

We are using cloud-init but i don't know how does it work and get IP from
neutron. I am new with neutron stuff.

On Wed, Aug 24, 2016 at 4:29 PM, James Downs <e...@egon.cc> wrote:
> On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
>> I enabled following in nova.conf on compute node but didn't work :(
>>
>> flat_injected=true
>>
>> Do i need to do anything else?
>
> Are you using flat networking?
> Nova-networks or Neutron?
>
> At this point, if you're not using DHCP, your only option is to  
arrange to feed
the networking information into the metadata for the VM at  
creation time, and

use someting like cloud-init to configure the networking. The ancient
networking injection stuff has either been removed, or been broken  
for years.

>
> Cheers,
> -j
>
> ___
> Mailing list:  
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

> Post to : openstack@lists.openstack.org
> Unsubscribe :
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack




--
Eugen Block voice   : +49-40-559 51 75
NDE Netzdesign und -entwicklung AG  fax : +49-40-559 51 77
Postfach 61 03 15
D-22423 Hamburg  

Re: [Openstack] Guest VM IP configuration script

2016-08-24 Thread Satish Patel
My question is how to query ports and pass info to cloud-init?  is
there any document or api which i can call using script and setup
network ifcfg-eth0 file

On Wed, Aug 24, 2016 at 5:38 PM, Kaustubh Kelkar
<kaustubh.kel...@casa-systems.com> wrote:
> You can create the ports beforehand and plug them in while creating the 
> instance. As for assigning IP addresses, you can query the ports and pass the 
> information to cloud-init. I am not sure if there is any other way to do this.
>
> Even if DHCP is disabled, OpenStack assigns IP information to ports when a VM 
> is created, and you can see this in your dashboard. The MAC and IP 
> information is used to configure iptables rules within security groups. Here 
> is the archived thread that provides this information: 
> http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html.
>
>
> -Kaustubh
>
>> -Original Message-
>> From: Satish Patel [mailto:satish@gmail.com]
>> Sent: Wednesday, August 24, 2016 5:05 PM
>> To: James Downs <e...@egon.cc>
>> Cc: openstack <openstack@lists.openstack.org>
>> Subject: Re: [Openstack] Guest VM IP configuration script
>>
>> I am using neutron networking with vlan ( its provider VLAN). We are not 
>> using
>> DHCP but i need some kind of hack to inject IP address in instance using 
>> cloud-
>> init.
>>
>> We are using cloud-init but i don't know how does it work and get IP from
>> neutron. I am new with neutron stuff.
>>
>> On Wed, Aug 24, 2016 at 4:29 PM, James Downs <e...@egon.cc> wrote:
>> > On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
>> >> I enabled following in nova.conf on compute node but didn't work :(
>> >>
>> >> flat_injected=true
>> >>
>> >> Do i need to do anything else?
>> >
>> > Are you using flat networking?
>> > Nova-networks or Neutron?
>> >
>> > At this point, if you're not using DHCP, your only option is to arrange to 
>> > feed
>> the networking information into the metadata for the VM at creation time, and
>> use someting like cloud-init to configure the networking. The ancient
>> networking injection stuff has either been removed, or been broken for years.
>> >
>> > Cheers,
>> > -j
>> >
>> > ___
>> > Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>> > Post to : openstack@lists.openstack.org
>> > Unsubscribe :
>> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>>
>> ___
>> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
>> Post to : openstack@lists.openstack.org
>> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-24 Thread Kaustubh Kelkar
You can create the ports beforehand and plug them in while creating the 
instance. As for assigning IP addresses, you can query the ports and pass the 
information to cloud-init. I am not sure if there is any other way to do this.

Even if DHCP is disabled, OpenStack assigns IP information to ports when a VM 
is created, and you can see this in your dashboard. The MAC and IP information 
is used to configure iptables rules within security groups. Here is the 
archived thread that provides this information: 
http://lists.openstack.org/pipermail/openstack-dev/2014-December/053069.html. 


-Kaustubh

> -Original Message-
> From: Satish Patel [mailto:satish@gmail.com]
> Sent: Wednesday, August 24, 2016 5:05 PM
> To: James Downs <e...@egon.cc>
> Cc: openstack <openstack@lists.openstack.org>
> Subject: Re: [Openstack] Guest VM IP configuration script
> 
> I am using neutron networking with vlan ( its provider VLAN). We are not using
> DHCP but i need some kind of hack to inject IP address in instance using 
> cloud-
> init.
> 
> We are using cloud-init but i don't know how does it work and get IP from
> neutron. I am new with neutron stuff.
> 
> On Wed, Aug 24, 2016 at 4:29 PM, James Downs <e...@egon.cc> wrote:
> > On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
> >> I enabled following in nova.conf on compute node but didn't work :(
> >>
> >> flat_injected=true
> >>
> >> Do i need to do anything else?
> >
> > Are you using flat networking?
> > Nova-networks or Neutron?
> >
> > At this point, if you're not using DHCP, your only option is to arrange to 
> > feed
> the networking information into the metadata for the VM at creation time, and
> use someting like cloud-init to configure the networking. The ancient
> networking injection stuff has either been removed, or been broken for years.
> >
> > Cheers,
> > -j
> >
> > ___
> > Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> > Post to : openstack@lists.openstack.org
> > Unsubscribe :
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> 
> ___
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-24 Thread Satish Patel
I am using neutron networking with vlan ( its provider VLAN). We are
not using DHCP but i need some kind of hack to inject IP address in
instance using cloud-init.

We are using cloud-init but i don't know how does it work and get IP
from neutron. I am new with neutron stuff.

On Wed, Aug 24, 2016 at 4:29 PM, James Downs  wrote:
> On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
>> I enabled following in nova.conf on compute node but didn't work :(
>>
>> flat_injected=true
>>
>> Do i need to do anything else?
>
> Are you using flat networking?
> Nova-networks or Neutron?
>
> At this point, if you're not using DHCP, your only option is to arrange to 
> feed the networking information into the metadata for the VM at creation 
> time, and use someting like cloud-init to configure the networking. The 
> ancient networking injection stuff has either been removed, or been broken 
> for years.
>
> Cheers,
> -j
>
> ___
> Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
> Post to : openstack@lists.openstack.org
> Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-24 Thread James Downs
On Wed, Aug 24, 2016 at 03:25:26PM -0400, Satish Patel wrote:
> I enabled following in nova.conf on compute node but didn't work :(
> 
> flat_injected=true
> 
> Do i need to do anything else?

Are you using flat networking?
Nova-networks or Neutron?

At this point, if you're not using DHCP, your only option is to arrange to feed 
the networking information into the metadata for the VM at creation time, and 
use someting like cloud-init to configure the networking. The ancient 
networking injection stuff has either been removed, or been broken for years.

Cheers,
-j

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


Re: [Openstack] Guest VM IP configuration script

2016-08-24 Thread Satish Patel
I enabled following in nova.conf on compute node but didn't work :(

flat_injected=true

Do i need to do anything else?

On Wed, Aug 24, 2016 at 1:52 PM, Satish Patel  wrote:
> This is weird requirement because i google it and i didn't find
> solution. We are no using DHCP with openstack (there is an reason) so
> not if i boot my VM it didn't getting IP address on eth0 interface so
> i have to manually configure IP address.
>
> Is there any script or API which i can put in VM guest so at boot time
> it query IP address and setup eth0 interface with that IP address?

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack


[Openstack] Guest VM IP configuration script

2016-08-24 Thread Satish Patel
This is weird requirement because i google it and i didn't find
solution. We are no using DHCP with openstack (there is an reason) so
not if i boot my VM it didn't getting IP address on eth0 interface so
i have to manually configure IP address.

Is there any script or API which i can put in VM guest so at boot time
it query IP address and setup eth0 interface with that IP address?

___
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack