Bug 510299

Summary: Static network handling is broken
Product: Red Hat Satellite 5 Reporter: Justin Sherrill <jsherril>
Component: ProvisioningAssignee: Partha Aji <paji>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: low    
Version: 530CC: cperry, dparker, jason.dobies, pthomas
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: sat530 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-10 19:27:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 457075    

Description Justin Sherrill 2009-07-08 15:48:28 UTC
In 5.2 we did the following if the user had selected static networking for a profile:


1.  We would embed the kickstart within the initrd during kickstart initiation
2.  We would re-write the 'network' line of the kickstart when rendering it for a re-provisioning so that it matched that interface. 


Currently we are doing neither of these things.  I spoke with mike and these were our thoughts on how to implement this:





<jsherrill> we more the 'use dhcp interface' and 'use static interface' to the provisioning page
<jsherrill> take it off the profile page \
<jsherrill> move*
<jsherrill> then if they select static, we set the static flag in the cobbler system record 
<jsherrill> and use the snippet for the network line
<jsherrill> now if we didn't want to always use the snippet for the network line
<jsherrill> (i.e only use it if they select static, to reduce risk)
<jsherrill> we could create an if statement in the templates
<jsherrill> that basically say
<jsherrill> if some variable ($static for instance) is defined and set to 1
<jsherrill> use the snippet
<jsherrill> else
<jsherrill> just use 'network --bootproto dhcp'
<jsherrill> mccun934,  does that make sense ?
<mccun934> jsherrill: that does

Comment 1 Clifford Perry 2009-07-08 16:05:36 UTC
Sounds good to me. Static I am sure is still widely used in server environments. 

Cliff

Comment 2 Partha Aji 2009-07-13 14:41:23 UTC
Should be resolved as of http://git.fedorahosted.org/git/?p=spacewalk.git;a=commit;h=26aa7de5d7692f814e9f609d47c004f11a6f82f2


Following changes were made to the workflow
1) The Network Interface  selection was moved from Profile -> System Details to SDC -> Provisioning-> Schedule -> Advanced Configuration page, for the network option is more system specific than profile specific. So if you want to set provision thru static IP go to SDC Provisioning advanced configuration page.
 That being said, if the user wants to use network --bootproto  static for bare metal KS they can still go to Profiles -> Profile -> Advanced Options and add the bootproto line to network command. 

2) This option has been added to SSM provisioning also.

3) Spacewalk koan has been modified to deal with the static device addition and embed the kickstart in the initrd image similar to what was done in 5.2.

Comment 3 Partha Aji 2009-07-16 19:09:10 UTC
Muliple areas to test.
* SSH to your system and get the following details of your system,
Device/Interface Name (usually eth0)-> ifconfig,

IP Address:
ifconfig $DEVICE | perl -lne '/inet addr:([\d.]+)/ and print $1'

Netmask:
ifconfig $DEVICE | perl -lne '/Mask:([\d.]+)/ and print $1'

Hostname:
hostname

Nameservers:
cat /etc/resolv.conf | perl -lne '/^nameserver\s+(\S+)$/ and print $1'

Gateway:
route -n | grep '^0.0.0.0' | awk  '{print $2}'


*  SDC to that system -> Provisioning-> Schedule -> Advanced Configuration page change DHCP to static and select an interface (lets say eth0 for our example)..
*  Click Schedule and Finish
* rhn_check make sure it schedules everything ok
* shutdown -c, 
find the initrd image name from /etc/grub.conf  and look under /boot
cp the image to a tmp location and
gunzip < initrd.img | cpio -i --make-directories
make sure you find a ks.cfg file in the base dir with the following line, 
* network --bootproto static --device <DEVICE> --ip <IP> --gateway <GATEWAY> --nameserver <NAMESERVER> --netmask <NETMASK> --hostname <HOSTNAME>
the variables should be the same as the interface values you computed in the first step

If you are satisfied with this , reboot the machine and after a successful kickstart check -> /etc/sysconfig/network-scripts/ifcfg-<DEVICE>
you should see the correct values  for

DEVICE=<DEVICE>
HWADDR=<HWADDR>
ONBOOT=yes
BOOTPROTO=static
IPADDR=<IP>
NETMASK=<NETMASK>
DNS1=<NAMESERVER>


also check the host name.. "hostname"
It should look ok

also look at
Couple of things I 'd also test 
Select a Kickstart Profile and go to Advanced Options 
Change the network line from 
network: --bootproto dhcp
to
network: --bootproto dhcp TESTFOO
Go to kickstart file 
You should see the line-> 
network --bootproto dhcp TESTFOO

Comment 4 Partha Aji 2009-07-16 19:38:44 UTC
Just noticed that the spacewalkkoan code running this was determining the ip in an incorrect manner. Its using 
ifconfig  | perl -lne '/inet addr:([\d.]+)/ and print $1' 
instead of 
ifconfig <DEVICE NAME> | perl -lne '/inet addr:([\d.]+)/ and print $1' 

the first can potentially be wrong if more than 2 interfaces exist on the system.

Comment 6 Preethi Thomas 2009-07-23 18:43:45 UTC
fails_qa
Satellite-5.3.0-RHEL5-re20090721.0-i386-embedded-oracle.iso

after satitc kickstart
[root@rlx-0-10 network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:42:52:00:ED:D6
ONBOOT=yes
BOOTPROTO=dhcp

Comment 7 Preethi Thomas 2009-07-23 18:44:10 UTC
sorry I meant to fails_qa.

Comment 9 Preethi Thomas 2009-07-24 15:06:35 UTC
Satellite-5.3.0-RHEL5-re20090721.0-i386-embedded-oracle.iso
Yum updated to the latest
after static kickstart
[root@fjs-0-20 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:C0:9F:AC:62:4B
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.10.76.147
NETMASK=255.255.254.0
DNS1=172.16.52.28
DNS2=172.16.52.27

Comment 10 Brandon Perkins 2009-09-10 19:27:13 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2009-1434.html