* vserver-reference rpm names have changed and become
vserver-@pldistro@-@fcdistro@-@arch@
vserver-systemslices-@pldistro@-@fcdistro@-@arch@
* this contains the images located as
/vservers/.vref/@pldistro@-@fcdistro@-@arch@
and
/vservers/.vstub/@pldistro@-@fcdistro@-@arch@/planetflow
respectively
* a stamp gets created on the nodes as /etc/planetlab/defaultvref
that contains the name for the default slicefamily to use
* nodemanager tries to be smart when chosing the right argument to pass to vuseradd
for this purpose, the argument in 'vref' is taken as a dash-separated list of 'wishes'
so e.g. is defaultvref is planetlab-f8-x86_64, then we should find for the image name:
vref=i386 -> vuseradd -t planetlab-f8-i386
vref=centos5 -> vuseradd -t planetlab-centos5-x86_64
vref=planetflow -> vuseradd -t planetflow
vref=centos5-onelab -> vuseradd -t onelab-centos5-x86_64
for legacy reasons, if the stamp is not found, 'default' is taken instead
=== status
* this is only partly tested
* a given node can install several variants of vserver-*
this would require a manual upload of the rpms into the right install-rpms
and manual changes in yumgroups.
* next improvement would be to have the system (planetflow) slices have a smarter naming scheme as well
this way a 'planetflow' vref would rather be rewritten as planetflow-f8-x86_64
for the time being it is not supported to install several variants of vserver-systemslices
on the node - although it should be harmless
shiftcount=$?
shift $shiftcount
shiftcount=$?
shift $shiftcount
-# pldistro expected as $1 - defaults to planetlab
+# pldistro expected as $1
+# The vserver reference name - this comes from spec's slicefamily
+vrefname=$1; shift
# Do not tolerate errors
set -e
# Path's to the vserver references images and stubs
vrefdir=$PWD/vservers/.vref
# Do not tolerate errors
set -e
# Path's to the vserver references images and stubs
vrefdir=$PWD/vservers/.vref
-vstubdir=$PWD/vservers/.vstub
-
-# XXX: The vserver reference name should be passed in as an argument
-# rather than being hardcoded.
-vrefname=default
+vref=${vrefdir}/${vrefname}
+# stubs are created in a subdir per slicefamily
+vstubdir=$PWD/vservers/.vstub/${vrefname}
# Make /vservers and default vserver reference image
# Make /vservers and default vserver reference image
-vref=${vrefdir}/${vrefname}
install -d -m 755 ${vref}
# Some of the PlanetLab RPMs attempt to (re)start themselves in %post,
install -d -m 755 ${vref}
# Some of the PlanetLab RPMs attempt to (re)start themselves in %post,
# Set the attribute to unlink so vclone does the right thing wrt to
# conserving space by linking and not copying unified files.
# Set the attribute to unlink so vclone does the right thing wrt to
# conserving space by linking and not copying unified files.
-find "$__DEFAULT_VSERVERDIR/.vref/default" -type f -print0 | xargs -0 setattr --iunlink
+find "$__DEFAULT_VSERVERDIR/.vref/*" -type f -print0 | xargs -0 setattr --iunlink
# Build reference images for system slices
# Build reference images for system slices
-for systemvserver in "$__DEFAULT_VSERVERDIR/.vstub/"*.cloned ; do
+# xxx if several instances of systemslices get installed, only one gets instanciated
+for systemvserver in "$__DEFAULT_VSERVERDIR/.vstub/"*/*.cloned ; do
NAME=$(basename $systemvserver .cloned)
NAME=$(basename $systemvserver .cloned)
+ DIR=$(dirname $systemvserver)
# Copy base reference image
if [ ! -d "$__DEFAULT_VSERVERDIR/.vref/$NAME" ] ; then
# Copy base reference image
if [ ! -d "$__DEFAULT_VSERVERDIR/.vref/$NAME" ] ; then
# build the systemvserver from the one it was originally cloned from
TYPE=$(cat $systemvserver)
REF="$__DEFAULT_VSERVERDIR/.vref/$TYPE"
# build the systemvserver from the one it was originally cloned from
TYPE=$(cat $systemvserver)
REF="$__DEFAULT_VSERVERDIR/.vref/$TYPE"
- "$_VCLONE" "$REF"/ "$TMP"/
- RETVAL=$?
+ if [ -d "$REF" ] ; then
+ "$_VCLONE" "$REF"/ "$TMP"/
+ RETVAL=$?
+ else
+ RETVAL=1
+ fi
# merge the stub with the reference to get the system vserver
if [ $RETVAL -eq 0 ] ; then
# merge the stub with the reference to get the system vserver
if [ $RETVAL -eq 0 ] ; then
- (cd "$__DEFAULT_VSERVERDIR/.vstub/$NAME"/ && find . | cpio -m -d -u -p "$TMP"/)
+ (cd "$DIR/$NAME"/ && find . | cpio -m -d -u -p "$TMP"/)
mv "$TMP" "$__DEFAULT_VSERVERDIR/.vref/$NAME"
success >&3 2>&4
else
mv "$TMP" "$__DEFAULT_VSERVERDIR/.vref/$NAME"
success >&3 2>&4
else
failure >&3 2>&4
fi
echo >&3 2>&4
failure >&3 2>&4
fi
echo >&3 2>&4
+%define slicefamily %{pldistro}-%{distroname}-%{_arch}
+
%define name vserver
%define version 4.2
%define taglevel 2
%define name vserver
%define version 4.2
%define taglevel 2
-%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+# pldistro already in the rpm name
+#%define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+%define release %{taglevel}%{?date:.%{date}}
-Summary: VServer reference image
+Summary: VServer reference image for slice family %{slicefamily}
Name: %{name}
Version: %{version}
Release: %{release}
Name: %{name}
Version: %{version}
Release: %{release}
%description
This package does not really exist.
%description
This package does not really exist.
Summary: VServer reference image
Group: Applications/System
AutoReqProv: no
Requires: util-vserver, e2fsprogs, yum
Requires(pre): /bin/sh, coreutils
Summary: VServer reference image
Group: Applications/System
AutoReqProv: no
Requires: util-vserver, e2fsprogs, yum
Requires(pre): /bin/sh, coreutils
+%description %{slicefamily}
This package creates the virtual server (VServer) reference image used
as the installation base for new PlanetLab slivers.
This package creates the virtual server (VServer) reference image used
as the installation base for new PlanetLab slivers.
-%package system-packages
+%package systemslices-%{slicefamily}
Summary: System slice packages
Group: Applications/System
Summary: System slice packages
Group: Applications/System
-Requires: vserver-reference >= %{version}-%{release}
+Requires: vserver-%{slicefamily} >= %{version}-%{release}
-%description system-packages
+%description systemslices-%{slicefamily}
This package installs the RPMS necessary to create system ("root
resource") slices from the virtual server (VServer) reference image.
This package installs the RPMS necessary to create system ("root
resource") slices from the virtual server (VServer) reference image.
%build
pushd VserverReference
%build
pushd VserverReference
+./build.sh %{pldistro} %{slicefamily}
chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
fi
chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
fi
%defattr(-,root,root)
%{_initrddir}/vserver-reference
%{_sysconfdir}/cron.d/vserver-reference
%{_sysconfdir}/logrotate.d/vserver-reference
%defattr(-,root,root)
%{_initrddir}/vserver-reference
%{_sysconfdir}/cron.d/vserver-reference
%{_sysconfdir}/logrotate.d/vserver-reference
+/vservers/.vref/%{slicefamily}
+%files systemslices-%{slicefamily}
%defattr(-,root,root)
/vservers/.vstub
%define vcached_pid /var/run/vcached.pid
%defattr(-,root,root)
/vservers/.vstub
%define vcached_pid /var/run/vcached.pid
# Stop vcached
if [ -r %{vcached_pid} ] ; then
kill $(cat %{vcached_pid})
# Stop vcached
if [ -r %{vcached_pid} ] ; then
kill $(cat %{vcached_pid})
# Allow vcached to run again
rm -f %{vcached_pid}
# Allow vcached to run again
rm -f %{vcached_pid}
chkconfig --add vserver-reference
chkconfig vserver-reference on
chkconfig --add vserver-reference
chkconfig vserver-reference on
+# store the default for nodemanager
+[ -f /etc/planetlab/defaultvref ] || echo %{slicefamily} > /etc/planetlab/defaultvref
[ "$PL_BOOTCD" = "1" ] || service vserver-reference start
# Randomize daily run time
[ "$PL_BOOTCD" = "1" ] || service vserver-reference start
# Randomize daily run time