nodeset supporting ubuntu LE for pkvm VM

This commit is contained in:
zhaoertao 2014-04-03 20:20:54 -07:00
parent 7848b733b3
commit ebbfe29f5c
2 changed files with 168 additions and 1 deletions

View File

@ -663,6 +663,11 @@ sub mkinstall
my $prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform";
my $postscript = "$::XCATROOT/share/xcat/install/scripts/post.$platform";
# for powerkvm VM ubuntu LE#
if ($arch =~ /ppc64/i and $platform eq "ubuntu") {
$prescript = "$::XCATROOT/share/xcat/install/scripts/pre.$platform.ppc64";
}
if (-r "$prescript"){
$preerr =
@ -687,6 +692,12 @@ sub mkinstall
$callback->({node =>[{name => [$node], error => [$errtmp], errorcode => [1]}]});
next;
}
if ($arch =~ /ppc64/i and !(-e "$pkgdir/install/netboot/initrd.gz")) {
$callback->({error => ["The netboot initrd not found in $pkgdir/install/netboot, pls download first"],
errorcode=>[1]});
next;
}
my $tftpdir = "/tftpboot";
# create the node-specific post scripts
@ -697,7 +708,7 @@ sub mkinstall
if (
(
$arch =~ /x86/ and
($arch =~ /x86/ and
(
( -r "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
and $kernpath = "$pkgdir/install/netboot/ubuntu-installer/$darch/linux"
@ -710,6 +721,14 @@ sub mkinstall
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
) or (
$arch =~ /ppc64/i and (
-r "$pkgdir/install/vmlinux"
and $kernpath = "$pkgdir/install/vmlinux"
and -r "$pkgdir/install/netboot/initrd.gz"
and $initrdpath = "$pkgdir/install/netboot/initrd.gz"
)
)
)
){

View File

@ -0,0 +1,148 @@
#!/bin/sh
if [ ! -c /dev/vcs ]; then
mknod /dev/vcs c 7 0
fi
debconf-get open-iscsi/targets > /tmp/q
cat >/tmp/foo.sh <<EOF
#!/bin/sh
#
# If no arguments:
#
# 1) Start child process to connect as client to master, and re-execute this script to send
# "installmonitor" to master. Do not wait for child process.
#
# 2) Loop forever. For each iteration, start child process as server waiting for a client
# connection. Once a connection is established, child process re-executes this script to
# handle request from that particular client.
#
if [ \$# -eq 0 ]; then
xcatdhost="#XCATVAR:XCATMASTER#"
xcatdport="#TABLE:site:key=xcatiport:value#"
NODESTATUS="#TABLEBLANKOKAY:site:key=nodestatus:value#"
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh install_monitor &
if [ -z "\$NODESTATUS" ] || [ "\$NODESTATUS" != "0" -a "\$NODESTATUS" != "N" -a "\$NODESTATUS" != "n" ];
then
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh installstatus installing &
fi
while true; do
/usr/bin/nc -l -p 3001 -e /tmp/foo.sh serve_client
done
exit 1 # never reached; reboot ends this
fi
#
# If the script was called with the "install_monitor" argument, stdin and stdout are
# connected to an xCAT daemon on the master. Write the "installmonitor" request to the
# daemon.
#
if [ "\$1" = "install_monitor" ]; then
cmd=""
while [ "\$cmd" != "done" ]; do
read cmd remainder
if [ "\$cmd" == "ready" ]; then
echo "installmonitor"
fi
done
exit 0
fi
#
# If the script was called with the "installstatus" argument, stdin and stdout are
# connected to an xCAT daemon on the master.
# Write the "installstatus xx" request to the daemon to update thenode installation status.
if [ "\$1" = "installstatus" ]; then
cmd=""
while [ "\$cmd" != "done" ]; do
read cmd remainder
if [ "\$cmd" == "ready" ]; then
echo "installstatus \$2"
fi
done
exit 0
fi
#
# When execution reaches here, script called with "serve_client" argument, which means
# stdin and stdout are connected to a client. Read the request from the client, provide
# the answer to the client, and terminate.
#
read cmd arg remainder
case "\$cmd" in
# "sh") #TODO: ENABLE IF DEBUG
# output=\$(eval \$arg \$remainder)
# echo "\$output"
# echo "EOO"
# ;;
"screendump")
output=\$(eval chvt \$arg; cat /dev/vcs)
echo "\$output"
;;
"stat")
sedcmds='/^[^ ]+ +[^ ]+ +install /h; \${ g; s,^[^ ]+ +[^ ]+ +install +([^ ]+) +[^ ]+ ([^ ]+).*,installing \1 \2,; p }'
output=\$(sed -nre "\$sedcmds" /target/var/log/dpkg.log 2>/dev/null)
if [ -z "\$output" ]; then
output="installing prep"
fi
echo "\$output"
;;
esac
exit 0
EOF
chmod 755 /tmp/foo.sh
/tmp/foo.sh >/tmp/foo.log 2>&1 &
if [ -d /sys/firmware/efi ]; then
echo "ubuntu-efi ::" > /tmp/partitioning
echo " 512 512 1024 fat16" >> /tmp/partitioning
echo ' $iflabel{ gpt } $reusemethod{ } method{ efi } format{ }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
else
echo "ubuntu-boot ::" > /tmp/partitioning
echo "8 1 1 prep" >> /tmp/partitioning
echo ' $primary{ } $bootable{ } method{ prep }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
echo "100 50 100 ext4" >> /tmp/partitioning
echo ' $primary{ } $bootable{ } method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ /boot }' >> /tmp/partitioning
echo " ." >> /tmp/partitioning
fi
echo "500 10000 1000000000 ext4" >> /tmp/partitioning
echo " method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / }" >> /tmp/partitioning
echo " ." >> /tmp/partitioning
echo "2048 512 300% linux-swap" >> /tmp/partitioning
echo " method{ swap } format{ }" >> /tmp/partitioning
echo " ." >> /tmp/partitioning
exit 0