We implemented something like DHCP, bound to the guest name, not the MAC
address. It's working for 3 years now, and it's very low maintenance.

We had a USER CONFIG file on a MAINT630 disk, and every guest can link that
disk. The USER CONFIG is a simple text file containing this info:
GUEST  IPADDRESS    NETMASK       GATEWAY     HOSTNAME
LNX101 192.168.0.10 255.255.255.0 192.168.0.1 lnx101

Every time the guest boots(we have a rc.local entry for this), it looks for
the /etc/sysconfig/network/routes file. If the file is not found, we run
the following script:
<snip>
chccwdev -e 191 2>&1 > /dev/null
udevadm settle
DISK=/dev/disk/by-path/ccw-0.0.0191
sleep 1
USERID=`vmcp q userid | awk '{print $1}'`
DATA=`cmsfscat -d $DISK -a user.config | grep $USERID`
if ! cmsfscat -d $DISK -a user.config | grep -q $USERID ; then
    # request timeout, retry
    chccwdev -d 191
    sleep 1
    chccwdev -e 191 2>&1 > /dev/null
    udevadm settle
    DISK=/dev/disk/by-path/ccw-0.0.0191
    sleep 1
    USERID=`vmcp q userid | awk '{print $1}'`
    DATA=`cmsfscat -d $DISK -a user.config | grep $USERID`
fi
IP=`echo $DATA | awk '{print $2}'`
NETMASK=`echo $DATA | awk '{print $3}'`
GW=`echo $DATA | awk '{print $4}'`
HOSTNAME=`echo $DATA | awk '{print $5}'`
if [ "X$HOSTNAME" == "X" ] ; then
    # hostname not found, abort
    exit 1
fi
sed -i /etc/sysconfig/network/ifcfg-eth0 -e "s/^IPADDR=.*/IPADDR='$IP'/" -e
"s/^NETMASK.*/NETMASK='$NETMASK'/"
echo "default $GW - -" > /etc/sysconfig/network/routes
echo $HOSTNAME > /etc/HOSTNAME
reboot
</snip>

This will run only once, on the first boot. When we create the machine, we
update the USER CONFIG file and xautolog it. Our template does not have the
/etc/sysconfig/routes, so every cloned guest will exec it.

Our automation does this differently. We use xcat (the community one, not
IBM's) and PHP IP Admin (phpipam). We can automatically detect all used IPs
on the network, assign one, and write it direct to the config files during
the provisioning.

Mauro
http://mauro.limeiratem.com - registered Linux User: 294521
Scripture is both history, and a love letter from God.

2016-01-25 18:13 GMT-02:00 Mark Post <[email protected]>:

> All,
>
> Just FYI, but here at SUSE we're contemplating creating a systemd unit
> file and associated scripts so that our systems running on various
> hypervisors can do whatever sort of "cleanup" each one might require to
> exploit the features of that hypervisor.  For example, in the z/VM case,
> one of those things would be to detach all the CMS disks to be eligible for
> LGR.
>
> Of course, whatever we wind up devising would be better with input from
> the people that will ultimately be using it (or not), assuming it actually
> makes it into the product.  (We hope so, but as everyone knows "stuff"
> happens.)
>
> So, if you have any thoughts on what those various items might be for the
> various hypervisors you run, let us know.  We can discuss it here, with
> this thread, start a new one, whatever makes the most sense for the most
> people.
>
>
> Mark Post
>
> ----------------------------------------------------------------------
> For LINUX-390 subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO LINUX-390 or
> visit
> http://www.marist.edu/htbin/wlvindex?LINUX-390
> ----------------------------------------------------------------------
> For more information on Linux on System z, visit
> http://wiki.linuxvm.org/
>

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390
----------------------------------------------------------------------
For more information on Linux on System z, visit
http://wiki.linuxvm.org/

Reply via email to