From 6258e5505f96a5b11a7c2d209d6d2004b05b2ffb Mon Sep 17 00:00:00 2001 From: ligc Date: Fri, 8 Jun 2012 09:00:26 +0000 Subject: [PATCH] fix for bug 3496130: resolve hostname to ip address in /tftpboot/etc/, copy resolv.conf from initrd into rootimg git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@13037 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 15 ++++++++++++++- .../xcat/netboot/add-on/statelite/rc.statelite | 6 ++++-- .../add-on/statelite/rc.statelite.ppc.redhat | 5 +++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 311644d6a..fd0a96e1c 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -574,8 +574,21 @@ sub mknetboot } } $kcmdline .= $statemnt ." "; + my $xcatmasterip; + # if xcatmaster is hostname, convert it to ip address + if (xCAT::Utils->validate_ip($xcatmaster)) { + # Using XCAT= will cause problems rc.statelite.ppc.redhat + # when trying to run chroot command + $xcatmasterip = xCAT::NetworkUtils->getipaddr($xcatmaster); + if (!$xcatmasterip) + { + $xcatmasterip = $xcatmaster; + } + } else { + $xcatmasterip = $xcatmaster; + } $kcmdline .= - "XCAT=$xcatmaster:$xcatdport "; + "XCAT=$xcatmasterip:$xcatdport "; if ($rootfstype ne "ramdisk") { # BEGIN service node my $isSV = xCAT::Utils->isServiceNode(); diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite index 373b70ba1..83f86be42 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite @@ -533,9 +533,11 @@ ResolveLinks # make sure mtab points to the right place: /bin/ln -sf /proc/mounts ${TMPFS}/etc/mtab -/bin/cat /etc/resolv.conf > $MNTDIR/etc/resolv.conf - # catch all hack for debugging: #cp -r -a ${DEFAULT}/* /.snapshot/tmpfs/ # foo +# If the resolv.conf is not setup in rootimg, copy the dhcp generated one into rootimg +if grep --quiet --no-messages "Dummy resolv.conf" "$MNTDIR/etc/resolv.conf"; then +/bin/cat /etc/resolv.conf > $MNTDIR/etc/resolv.conf +fi diff --git a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat index 6216a37ac..297b7c211 100755 --- a/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat +++ b/xCAT-server/share/xcat/netboot/add-on/statelite/rc.statelite.ppc.redhat @@ -536,3 +536,8 @@ ResolveLinks # catch all hack for debugging: #cp -r -a ${DEFAULT}/* /.snapshot/tmpfs/ # foo + +# If the resolv.conf is not setup in rootimg, copy the dhcp generated one into rootimg +if grep --quiet --no-messages "Dummy resolv.conf" "$MNTDIR/etc/resolv.conf"; then +/bin/cat /etc/resolv.conf > $MNTDIR/etc/resolv.conf +fi