xCAT for non-root users

You have a user on your machine and you only want to enable them to do things like rinv, rvitals, and nodels. You don’t want them to be able to provision nor power on/off and do all those other awesome things that xCAT can do.

So what do you do?

Suppose your user name is ‘foobar’.

You do this:
1. Set up the policy table so that it contains the following: (tabedit policy)

1
2
3
4
5
#priority,name,host,commands,noderange,parameters,time,rule,comments,disable
"1","root",,,,,,"allow",,
"1.1","foobar",,"rinv",,,,"allow",,
"1.11","foobar",,"rvitals",,,,"allow",,
"1.12","foobar",,"nodels",,,,"allow",,

2. Set up the local cert for the user:

1
/opt/xcat/share/xcat/scripts/setup-local-client.sh foobar

Any other commands you can add by adding another number, like 1.13, etc. The numbers are arbitrary, just make sure there is a unique number. They stand for the priority of access of how the commands are processed. (e.g: if two commands are received by the xCAT server at the same time.

BitTorrent client on CentOS 5.5

After looking everywhere for a BitTorrent client for CentOS 5.5 I found that the old archives on bittorrent.com provided a perfect match that had no prereq RPMs that I had to download. I got BitTorrent-4.1.3-1.noarch. Installed it with RPM, then ran it like so:

1
btdownloadgui.py

ESXi 4.1 Kickstart on xCAT

I recently added the ESXi 4.1 base template kickstart file to xCAT.  The code is checked in here. We’ve had the ability to do stateless ESXi 4.1 since it came out and we’ve been doing stateless ESXi 4.0 as well.  But for some of our customers, we have needed a way to get the ESXi 4.1 server on the disk.  This seems to be the most common way people want to install VMware ESX(i) these days.  We hope in the future more people will go stateless.  But for now, here is our xCAT ESXi 4.1 base kickstart file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Sample scripted installation file
# edited and updated by vallard@sumavi.com

# Accept the VMware End User License Agreement
vmaccepteula

# Set the root password for the DCUI and Tech Support Mode
rootpw --iscrypted #CRYPT:passwd:key=vmware,username=root:password#

# clear all partitions.
clearpart --alldrives --overwritevmfs
# Choose the first disk (in channel/target/lun order) to install onto
autopart --firstdisk --overwritevmfs

# The install media is on the network.
install url http://#TABLE:noderes:$NODE:nfsserver#/install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#


# Set the network to DHCP on the first network adapter
#network --bootproto=dhcp --device=vmnic0
network --bootproto=dhcp

# reboot automatically when we're done.
reboot

# A sample post-install script
%post --interpreter=busybox --unsupported --ignorefailure=true

# tell xCAT management server we are done installing
# have to put in the IP address instead of the hostname because VMware
# ESXi 4.1 can not resolve IP addresses...
echo "<xcatrequest>\n<command>nextdestiny</command>\n</xcatrequest>" | /bin/openssl s_client -quiet -connect #COMMAND: host #TABLE:noderes:$NODE:xcatmaster# | head -1 |  sed 's/.*address//g' #:3001 2>&1 | tee /tmp/foo.log

# enable SSH on next boot:
%firstboot --interpreter=busybox --unsupported --level=47
sed -ie 's/#ssh/ssh/' /etc/inetd.conf #ssh is too nice not to have

Since this is an xCAT kickstart template then you see the #TABLE … # and #COMMAND ..# tags in there.  Basically these are just cues for xCAT to look up the different attributes for the nodes so that it can customize this one template to be used on the entire data center.  So the password, main HTTP server, and xCAT server are all stored in the xCAT database.

I have two scripts in here.  The first is the %post.  This script simply signals back to xCAT that it is done installing so that the next time it reboots, instead of reinstalling, xCAT will tell the node to boot to hard disk. This happens right after the install.

The second is the %firstboot script.  Notice that I added the –level 47 to the script.  This is important as it tells this script when to run.  If you look at /etc/vmware/init.d/init you’ll see the levels.  Level 48 starts the networking.  Before the networking starts, I want to enable SSH, so I just uncomment the section inside /etc/inetd.conf to allow SSH to happen on boot.  (Another thing you could do is just do an /etc/init.d/TSM-SSH start)

So this template is stored in xCAT in /opt/xcat/share/xcat/install/esx/.  You can have a node boot to it (provided the rest of xCAT is setup and copycds have been run) by doing the following:

nodeset <noderange> install=esxi4.1-x86_64-base
rpower <noderange> boot

or just:

rinstall <noderange>

Then the template is copied into the /install/autoinst/ directory and the name is changed to match the node and all variables are substituted in.  Then the PXE server and DHCP server are set to point to the file to grab and install the node.  This is in xCAT 2.5 which you can get now as the development release (make sure you grab the files at the bottom in the ‘Development Builds’ section)

Another thing that is fun to do with the ESXi kickstart file is to make a new VM as part of the kickstart install.  Generally I recommend using an NFS server to store your VMs on, but there are cases where you just want them on the local drive.  As part of the above kickstart file, the datastore1 partition is created.  This is a place where you could now run the vim-cmds during post to create machines.  This is easy to do during the firstboot section (you would probably do this at level 99) but not so easy to do in the %post section.

The problem with the %post section is that hostd isn’t running so none of the vim-cmds will work.  So you have to start it.   This can be done by running:

/etc/init.d/hostd start

But wait, there is another problem!  The hostd command doesn’t return and hangs!  So you have to use some magic (like creating a script to run it that forks off and returns) otherwise your %post hangs forever. (This is a total bug)

Anyway once you work around that then just running the commands like:

/bin/vim-cmd solo/registervm /vmfs/volumes/datastore1/vm01/vm01.vmx vm01
/bin/vim-cmd vmsvc/power.on 16

Seems to work.  But, during %firstboot, you’ll have to reregister them again.

I hope to put more information on this as we go forward with it.  I am happy that VMware has made this kickstart file for 4.1 and I can only see it improving over time.  The more automation the better and with kickstart we can really automate everything we need.

xCAT Windows Installs

While working at IBM I wrote an article about how to install Windows Server 2008 using xCAT.  The cool thing about this procedure is that you’re using Linux to provision a Windows machine, using the native Windows installer.  This isn’t like the other solutions where they just do something like partimage.  We think this still has a lot more cool stuff that can be done and from Sumavi’s perspective (my company) its just the beginning of what we’re going to be doing with Windows provisioning.

There are some common pitfalls to doing windows installations with xCAT.  Here they are:

1.  Is Samba enabled?  This seems to be the biggest issue that I always forget.  You’ll know if this is your problem and it boots all the way to the command prompt and then reboots.  My Samba configuration looks like this:

/etc/samba/smb.conf

[global]
 workgroup = MYGROUP
 server string = Samba Server Version %v
 security = shared
 passdb backend = tdbsam
 load printers = yes
 cups options = raw
[install]
 path = /install
 public = yes
 writable = no

Once that’s up restart it and make sure it comes back up on boot:

service smb start
chkconfig --add smb

2. Do you have the drivers in your base WinPE image?

This is the hardest part.  If Samba is up and you don’t have the drivers then you need to add them to your base WinPE image.  I hope to write more on this later, but this is generally the big problem I run into.

3. Do you have drivers in your /install/drivers directory?

If the machine installs and then reboots fine, but then errors out its because it can’t find the boot directory.  These drivers in /install/drivers are for the reboot and the script adds them in.

Usually once you get past these issues you can install Windows pretty easily.  I hope to write another article on how to do this with the latest updates.  Since I left IBM that document has been removed, so if you have troubles either post to the xCAT mailing list or drop me an email and I’ll be glad to see if I can help.  We’re trying to make this easier.