Bug 1126857 - cloud-init network configuration not executing
Summary: cloud-init network configuration not executing
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: cloud-init
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Garrett Holmstrom
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-08-05 13:09 UTC by Brian (bex) Exelbierd
Modified: 2016-07-19 19:02 UTC (History)
11 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2016-07-19 19:02:59 UTC


Attachments (Terms of Use)
cloud-init log output (2.90 KB, text/plain)
2014-08-19 12:17 UTC, Dusty Mabe
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Launchpad 1225922 None None None Never

Description Brian (bex) Exelbierd 2014-08-05 13:09:22 UTC
Description of problem:

Network configuration for cloud-init isn't working.

I have tried this syntax and variations on this theme:

    network-interfaces: |
      iface eth0 inet static
      address 192.168.1.10
      netmask 255.255.255.0
      broadcast 192.168.1.255
      gateway 192.168.1.254


Version-Release number of selected component (if applicable):


How reproducible:

always

Steps to Reproduce:
1. Set up a network-interfaces section
2. boot
3. frown

Actual results:

Fedora Atomic defaults to DHCP and that is what is both configured and in /etc/sysconfig/network-scripts/ifcfg-eth0

Expected results:

A static network configuration and proper information in /etc/sysconfig/network-scripts/ifcfg-eth0

Additional info:

Comment 1 Brian (bex) Exelbierd 2014-08-05 13:10:36 UTC
Source for syntax (not perfect but the only reference online):

http://cloudinit.readthedocs.org/en/latest/topics/datasources.html?highlight=netmask#no-cloud

Comment 2 Dusty Mabe 2014-08-17 21:20:41 UTC
Hi Brian,

What atomic image are you using? I was able to manually do a build of http://koji.fedoraproject.org/koji/taskinfo?taskID=7290385 using virt-intstall and was able to get cloud-init to work with this sytax. Here is my meta-data:

[root@vmhost ud]# cat meta-data 
instance-id: test0
hostname: mytest0
network-interfaces: |
  iface eth0 inet static
  address 192.168.122.240
  network 192.168.122.0
  netmask 255.255.255.0
  broadcast 192.168.122.255
  gateway 192.168.122.1

Here is what I see within the guest after attaching an iso with the meta/user data and booting:

[root@localhost ~]# rpm -q cloud-init
cloud-init-0.7.5-6.fc21.x86_64
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
BOOTPROTO=static
ONBOOT=no
TYPE=Ethernet
PERSISTENT_DHCLIENT=yes
BROADCAST=192.168.122.255
NETMASK=255.255.255.0
IPADDR=192.168.122.240
GATEWAY=192.168.122.1

So it appears that it is working using the same syntax (different values) as what you used. Do you have any more details? Can you reproduce? 

If you are interested my virt-install command line is:

virt-install --name atomtest --ram  2048 --vcpus 2 --disk path=/guests/test.img,size=10  --accelerate --network bridge=virbr0 --extra-args='ks=https://kojipkgs.fedoraproject.org//work/tasks/385/7290385/fedora-cloud-atomic-fc3e80c.ks' --location http://kojipkgs.fedoraproject.org/mash/branched-20140813/21/x86_64/os/

- Dusty

Comment 3 Brian (bex) Exelbierd 2014-08-18 11:30:03 UTC
Hi Dusty,

That is working for me now.  The key was that the information goes in the meta-data file and not the user-data file.  How would I have known this?  I missed it somewhere and I'd like to know where so I can reference that.

Thank you.

regards,

bex

PS: I'll close this after your response.

Comment 4 Brian (bex) Exelbierd 2014-08-18 12:29:17 UTC
I spoke too soon ... it appears that while the file is setup correctly, the machine still is booted with the device set to DHCP.

Comment 5 Dusty Mabe 2014-08-18 14:09:54 UTC
(In reply to Brian (bex) Exelbierd from comment #3)
> Hi Dusty,
> 
> That is working for me now.  The key was that the information goes in the
> meta-data file and not the user-data file.  How would I have known this?  I
> missed it somewhere and I'd like to know where so I can reference that.
> 

The documentation that you referenced earlier says that it is in 'metadata':

"Also, you can inject an /etc/network/interfaces file by providing the content for that file in the network-interfaces field of metadata."

I admit it's not extremely obvious but that is what the documentation said so I followed it.

Comment 6 Dusty Mabe 2014-08-18 14:12:56 UTC
(In reply to Brian (bex) Exelbierd from comment #4)
> I spoke too soon ... it appears that while the file is setup correctly, the
> machine still is booted with the device set to DHCP.

Odd. Seem s to be working fine for me. My interface comes up with the address I requested and I don't see the dhclient process running as I observe on machines that are using dhcp.

Can you provide any more details?

Comment 7 Brian (bex) Exelbierd 2014-08-19 09:46:38 UTC
(In reply to Dusty Mabe from comment #5)
> (In reply to Brian (bex) Exelbierd from comment #3)
> The documentation that you referenced earlier says that it is in 'metadata':

Yes it does.  I must have been tired to have missed that in my reading :(

(In reply to Dusty Mabe from comment #6)
> (In reply to Brian (bex) Exelbierd from comment #4)
> > I spoke too soon ... it appears that while the file is setup correctly, the
> > machine still is booted with the device set to DHCP.
> 
> Odd. Seem s to be working fine for me. My interface comes up with the
> address I requested and I don't see the dhclient process running as I
> observe on machines that are using dhcp.
> 
> Can you provide any more details?

I have some details below, however I would rather test with a newer qcow.  What would it take to build one in koji (I am not familiar with the process)?

Config:

[bexelbie@dhcp-2-218 fedora-test]$ cat meta-data 
instance-id: FedoraAtomic0
local-hostname: FedoraAtomic0
network-interfaces: |
  iface eth0 inet static
  address 192.168.122.240
  network 192.168.122.0
  netmask 255.255.255.0
  broadcast 192.168.122.255
  gateway 192.168.122.1

First boot network config:

[root@FedoraAtomic0 foobar]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:f3:22:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.158/24 brd 192.168.122.255 scope global dynamic eth0
       valid_lft 3255sec preferred_lft 3255sec
    inet6 fe80::5054:ff:fef3:22ec/64 scope link 
       valid_lft forever preferred_lft forever

[root@FedoraAtomic0 foobar]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
DEVICE=eth0
BOOTPROTO=static
ONBOOT=no
TYPE=Ethernet
PERSISTENT_DHCLIENT=yes
BROADCAST=192.168.122.255
NETMASK=255.255.255.0
IPADDR=192.168.122.240
GATEWAY=192.168.122.1

[root@FedoraAtomic0 foobar]# ps -ef | grep dhclient
root       594     1  0 09:25 ?        00:00:00 /sbin/dhclient -H localhost -q -lf /var/lib/dhclient/dhclient--eth0.lease -pf /var/run/dhclient-eth0.pid eth0

cloud-init version:

[root@FedoraAtomic0 foobar]# rpm -qi cloud-init
Name        : cloud-init
Version     : 0.7.5
Release     : 6.fc21
Architecture: x86_64
Install Date: Fri 25 Jul 2014 10:53:11 AM UTC

Comment 8 Dusty Mabe 2014-08-19 12:15:07 UTC
(In reply to Brian (bex) Exelbierd from comment #7)

You are right. I think I wasn't seeing dhclient before because I did the install manually and there is an automatic reboot in the kickstart (which means the system booted, then I shut it down and attached an iso with the ud/md). If I download the latest cloud image (https://kojipkgs.fedoraproject.org//work/tasks/3247/7413247/fedora-cloud-base-20140817-21.x86_64.qcow2) and do an import:


virt-install --import --name test2 --ram 2048 --vcpus 2 --disk /guests/test2.qcow2 --disk /tmp/ud/test0-cidata.iso,device=cdrom --network bridge=virbr0

Then I do see dhclient still running. I wonder if this is also an issue upstream. Basically the problem boils down to the fact that cloud-init brings up the network(dhcp) to look for data sources. Later we then tell it what config we want and it populates the file and then does an ifup on eth0 but it never takes down eth0 first (which means dhclient gets left running). For me my interface does have the right IP address.. for now. dhclient (since it is still running) may later assign it the one from dhcp again.

I'll make an attachment with some of the log details.

Comment 9 Dusty Mabe 2014-08-19 12:17:15 UTC
Created attachment 928339 [details]
cloud-init log output

Comment 10 Dusty Mabe 2014-08-20 01:03:38 UTC
As suspected this is a bug in upstream as well: 
    https://bugs.launchpad.net/cloud-init/+bug/1225922

On the plus side, at least for me, the interface did come up with the right configuration.

Brian, you may want to try some of the workarounds in the linked bug report.

Comment 11 Brian (bex) Exelbierd 2014-08-21 10:40:15 UTC
Thank you Dusty.  The work arounds worked.  I hope we will see some fixes upstream soon.

Comment 12 Jaroslav Reznik 2015-03-03 16:10:58 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 13 Fedora End Of Life 2016-07-19 19:02:59 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.