Citrix XenServer goes free

Just read the announcement from Citrix that by the end of March 2009, the full enterprise-level class of XenServer will be free of charge. Citrix’s XenServer is based on open source Xen and the company have developed a bunch of GUI tools for ease of installation and management.

The announcement can be read here: http://www.citrix.com/English/NE/news/news.asp?newsID=1687130

Advertisement

Σκωτσέζικες εφευρέσεις

Πολλές από τις σημαντικότερες εφευρέσεις των τελευταίων αιώνων έχουν γίνει από Σκωτσέζους. Εφευρέσεις που άλλαξαν κυριολεκτικά τον κόσμο και που χρησιμοποιούμε στη καθημερινή μας ζωή. Ακολουθεί λίστα με τους σημαντικότερους εφευρέτες και των κυριότερων έργων τους:

  • James Watt (1736 – 1819)
    Γεννημένος στο Greenock. Τελειοποίησε την ατμομηχανή που χρησιμοποιήθηκε αργότερα από τις βιομηχανιές. Πράγμα το οποίο οδήγησε στη βιομηχανική επανάσταση. Προς τιμή του η ομόνυμα μονάδα μέτρησης ισχύος.
  • William Murdoch (1754 – 1839)
    Γεννημένος στο Lugar. Μαθητής του James Watt εφήυρε το φωταέριο, βελτίωσε την ατμομηχανή και εφήυρε την αδιάβροχη μπογιά.
  • Alexander Graham Bell (1847 – 1922)
    Γεννημένος στο Εδιμβούργο, ήταν δάσκαλος κωφών παιδιών και πειραματιζόταν με ηλεκτρονικές συσκευές προκειμένου να βοηθήσει τα παιδιά να επικοινωνήσουν. Το 1876 πιστοποιεί το τηλέφωνο ως εφεύρεση.
  • Alexander Fleming (1881 – 1955)
    Γεννημένος στο Darvel. Εφήυρε την πενικιλίνη και του απονομήθηκε το βραβείο Νόμπελ το 1945.
  • John Logie Baird (1888 – 1946)
    Γεννημένος στο  Helensburgh. Εφήυρε τη τηλεόραση όπως την ξέρουμε σήμερα. Μετέδωσε την πρώτη εικόνα το 1925 και την πρώτη διατλαντική μετάδωση το 1928. Εφήυρε επίσης τις οπτικές ίνες και τη τεχνολογία νυχτερινή όραση.
  • Robert Watson-Watt (1893 – 1973)
    Γεννημένος στο Brechin. Ως μετερεολόγος εφήυρε το ραντάρ για ανίχνευση καταιγήδων από αεροπλάνα. Στη συνέχεια ανέπτυξε ραντάρ για την ανίχνευση
    αεροπλάνων, το οποίο χρησιμοποιήθηκε και στη Μάχη της Βρετανίας.
  • James Young (1811 – 1883)
    Γεννημένος στη Γλασκώβη. Θεωρείτε πατέρας της βιομηχανίας πετρελαίου καθώς εφήυρε τρόπο παραγωγής παραφινέλαιου από σχιστόλιθο και άνθρακα.
  • Kirkpatrick MacMillan (1812 – 1878)
    Γεννημένος στο Keir. Εφήυρε το ποδήλατο με πετάλι το 1842.
  • Charles MacIntosh (1766 – 1843)
    Γεννημένος στη Γλασκώβη. Ανέπτυξε τη τεχνική που καθιστούσε τα ρούχα αδιάβροχα. Η τεχνική αυτή χρησιμοποιήθηκε για πρώτη φορά το 1824 σε μια Αρκτική αποστολή.
  • James Young Simpson (1811 – 1870)
    Γεννημένος στο Bathgate. Εφύηρε το χλωροφόρμιο το οποίο και χρησιμοποίησε ως αναισθησιογώνο σε γεννήσεις.
  • James Clerk Maxwell (1831 – 1879)
    Γεννημένος στο Εδιμβούργο. Πατέρας της κλασσικής θεωρίας του ηλεκτρομαγνητισμού.
  • John Napier (1550 – 1617)
    Γεννημένος στο Εδιμβούργο. Πατέρας των λογάριθμων. Αύξησε τον αριθμό των υποδιαστολών.
  • Alexander Bain (1811 – 1877)
    Γεννημένος στο Watten. Εφύηρε το Fax.
  • William Thomson (Lord Kelvin, 1824 – 1907)
    Γεννημένος στο Μπέλφαστ της Βορείου Ιρλανδίας και από ηλικία 10 ετών βρέθηκε στη Γλασκώβη. Πατέρας της θερμοδυναμικής και της μονάδας μέτρησης της απόλυτης θερμοκρασίας.

Και η λίστα συνεχίζεται…

Acrobat Reader buffer overflow vulnerability

A critical vulnerability has been identified in Adobe Reader 9 and Acrobat 9 and earlier versions. This vulnerability would cause the application to crash and could potentially allow an attacker to take control of the affected system. There are reports that this issue is being exploited.

Adobe is planning to release updates to Adobe Reader and Acrobat to resolve the relevant security issue. Adobe expects to make available an update for Adobe Reader 9 and Acrobat 9 by March 11th, 2009. Updates for Adobe Reader 8 and Acrobat 8 will follow soon after, with Adobe Reader 7 and Acrobat 7 updates to follow. In the meantime, Adobe is in contact with anti-virus vendors, including McAfee and Symantec, on this issue in order to ensure the security of our mutual customers. A security bulletin will be published on http://www.adobe.com/support/security as soon as product updates are available.

http://www.adobe.com/support/security/advisories/apsa09-01.html

Quick solution to avoid unexpected behaviour, use a different PDF viewer. Alternatives are available for Linux (Xpdf, Kpdf, Evince), *BSD (Xpdf), OS X (Preview) and Windows (Foxit).

lcfg-xen-0.99.5-1

New release of the Xen component for LCFG. It has the previous patches applied.

– Creates the top level directory for a disk image to be stored in case it doesn’t exist (otherwise would fail on creating the disk image)
– Fixes typo bug for detecting the network interfaces at component start and start the Xen bridge interface

RPM: http://lcfg.ucs.ed.ac.uk/pkgs/devolved/world/sl5/rpms/lcfg-xen-0.99.5-1.noarch.rpm
Source RPM: http://lcfg.ucs.ed.ac.uk/pkgs/devolved/world/sl5/srpms/lcfg-xen-0.99.5-1.src.rpm

OS X: δημιουργία χρηστών και ομάδων από τερματικό

Η δημιουργία χρηστών και ομάδων στο OS X 10.5.x μέσω του τερματικού μπορεί να προκαλέσει εύκολα πονοκέφαλο. Πρέπει να γίνει πολλαπλή χρήση του Directory Service command line utility όπως περιγράφεται εδώ. Τα συμάζεψα λίγο σε ένα απλό script μαζί με τη δυνατότητα διαγραφής του χρήστη, καθώς και δημιουργία και διαγραφή ομάδων.

#!/bin/bash
function reconfDirServ() {
        killall -HUP DirectoryService
}
echo "|-----------------------------------|"
echo "|      OS X Users and Groups        |"
echo "|-----------------------------------|"
echo "|  1. Add a user   -----------------|"
echo "|  2. Delete user  -----------------|"
echo "|  3. Add a group  -----------------|"
echo "|  4. Delete group -----------------|"
echo "|-----------------------------------|"
echo
echo -n "Option : "; read input
iif [ $input -eq 1 ]; then
        echo -n "Username : "; read username
        dscl . -create /Users/$username
        echo -n "Default shell [/bin/bash]: "; read defaultshell
        if [ -z $defaultshell ]; then defaultshell="/bin/bash"; fi
        dscl . -create /Users/$username UserShell $defaultshell
        echo -n "Full name: "; read fullname
        dscl . -create /Users/$username RealName "$fullname"
        echo -n "User ID: "; read userid
        dscl . -create /Users/$username UniqueID $userid
        dscl . -create /Users/$username PrimaryGroupID 20
        echo -n "Will $username to be an administrator (Y/N) [N]: "; read adminfunc
        if [ -z $adminfunc ]; then adminfunc="n";fi
        if [ "$adminfunc" == "y" ] || [ "$adminfunc" == "Y" ]; then
           dscl . -append /Groups/admin GroupMembership $username
        fi
        mkdir /Users/$username
        dscl . -create /Users/$username NFSHomeDirectory /Users/$username
        passwd $username
        chown $userid:staff /Users/$username
        reconfDirServ
elif [ $input -eq 2 ]; then
        echo -n "Username: "; read username
        dscl . -delete /Users/$username
        rm -Rf /Users/$username
        reconfDirServ
elif [ $input -eq 3 ]; then
        echo -n "Group name: "; read groupname
        dscl . -create /Groups/$groupname
        echo -n "Group ID: "; read groupid
        dscl . -create /Groups/$groupname GroupID $groupid
        reconfDirServ
        exit 0
elif [ $input -eq 4 ]; then
        echo -n "Group name: "; read groupname
        dscl . -delete /Groups/$groupname
        reconfDirServ
else
        echo "Select from options 1 - 4"
fi

Τα XML αρχεία των χρηστών και των ομάδων βρίσκονται στο /var/db/dslocal/nodes/Default/users και /var/db/dslocal/nodes/Default/groups αντίστοιχα.

Live memory and CPU tunning on Xen virtual machine

When configuring a Xen virtual machine you can specific the initial memory the VM will use as well the maximum memory the machine cn be assigned with. The Xen management interface gives the ability to change the memory of the VM on-the-fly, without restarting any daemons or the VM. In the following example the memory is dropped down from 1G to 768M using the ‘xm’ command with the ‘mem-set’ option:

# xm list node1
Name                                      ID Mem(MiB) VCPUs State   Time(s)
node1                                      1     1023     2 -b----    115.5
# xm mem-set node1 768
# xm list node1
Name                                      ID Mem(MiB) VCPUs State   Time(s)
node1                                      1      767     2 -b----    115.7

The maximum memory the VM will be able to get is 1024M as this is the maxmem definition in its configuration file.

The Xen management interface enables very easy the to pin specific CPUs to VCPUs without affecting any running VMs. In the following example core 2 is mapped to VCPU0 and core 3 is mapped to VCPU1. The VM will now exclusively use these cores for each of the VCPUs rather than switching depending on workload etc.

# xm vcpu-list node1
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node1                              1     0     3   -b-      61.1 2-3
node1                              1     1     2   -b-      54.4 2-3
# xm vcpu-pin node1 0 2
# xm vcpu-pin node1 1 3
# xm vcpu-list node1
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node1                              1     0     2   -b-      61.1 2
node1                              1     1     3   -b-      54.4 3

One more very helpful use of the management interface is that it can trun on and off the VCPUs on a VM. Of course, the last one left on can’t be turned off and the most you can turn on are as the number defined in the configuration file.

# xm vcpu-set node1 1
# xm vcpu-list node1
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node1                              1     0     2   -b-      61.3 2
node1                              1     1     -   --p      54.4 3
# xm vcpu-set node1 2
# xm vcpu-list node1
Name                              ID VCPUs   CPU State   Time(s) CPU Affinity
node1                              1     0     2   -b-      61.4 2
node1                              1     1     3   -b-      54.5 3

All the commands above worked perfectly on a paravirtualized Scientific Linux 5.2 VM.

EDIT: The same commands can be used for Domain-0, the machine that hosts the VMs.

Clone Xen virtual machine script

I wrote the following script to make identical clones of a Xen virtual machine template. The script will copy the disk image and edit the necessary files of the guest operating system such as /etc/hosts, /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0. It will replace the hostname and will generate a new MAC address both for the guest OS ifcfg-eth0 file and the guest configuration file which is located under /etc/xen on the host.

Usage:

./xenclone <disk images dir> <disk name> <clone name>
#!/bin/bash
############################################################################
# Copyright (C) 2009  Panagiotis Kritikakos <pkritika@epcc.ed.ac.uk>       #
#                                                                          #
#    This program is free software: you can redistribute it and/or modify  #
#    it under the terms of the GNU General Public License as published by  #
#    the Free Software Foundation, either version 3 of the License, or     #
#    (at your option) any later version.                                   #
#                                                                          #
#    This program is distributed in the hope that it will be useful,       #
#    but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#    GNU General Public License for more details.                          #
#                                                                          #
#    You should have received a copy of the GNU General Public License     #
#    along with this program.  If not, see <http://www.gnu.org/licenses/>. #
############################################################################
if [ $UID != "0" ]; then
  echo " You must be root to run the script or run it with sudo"
  exit 1;
fi
if [ $# -lt 3 ]; then
  echo " Usage: ./xenclone <disk images dir> <disk name> <clone name>"
  echo " The script assumes the guest being clone is a Red Hat based system"
  exit 1;
fi
DISKPATH=$1
DISK=$2
CLONE=$3
MOUNTDIR=`mktemp -d`
if [ ! -e $DISKPATH/$DISK.img ]; then
  echo " Primary disk image can't be found."
  exit 1;
fi
clear

TEMPF1=`mktemp`
TEMPF2=`mktemp`
TEMPF3=`mktemp`
TEMPHOSTS=`mktemp`
TEMPNETWORK=`mktemp`
TEMPIFCFG=`mktemp`

echo "Copying ${DISK} to ${CLONE}..."
dd if=$DISKPATH/$DISK.img of=$DISKPATH/$CLONE.img

echo "Mapping the image..."
loopPart=`kpartx -l $DISKPATH/$CLONE.img | awk {'print $1'}`
kpartx -a $DISKPATH/$CLONE.img

echo "Mounting the image..."
mount /dev/mapper/$loopPart $MOUNTDIR

echo "Editing files and creating configuration file for ${CLONE}..."
sed "s/$DISK/$CLONE/g" < $MOUNTDIR/etc/hosts > $TEMPHOSTS
cp -f $TEMPHOSTS $MOUNTDIR/etc/hosts
sed "s/$DISK/$CLONE/g" < $MOUNTDIR/etc/sysconfig/network > $TEMPNETWORK
cp -f $TEMPNETWORK $MOUNTDIR/etc/sysconfig/network

sed "s/$DISK/$CLONE/g" < /etc/xen/$DISK > $TEMPF1
olduuid=`grep uuid $TEMPF1 | awk {'print $3'} |  sed s/'"'*'"'//g`
newuuid=`uuidgen`
sed "s/$olduuid/$newuuid/g" < $TEMPF1 > $TEMPF2
oldmac=`grep mac $TEMPF2 | sed s/vif.*mac=//g | sed s/,.*']'//g`
newmac=`echo $RANDOM | openssl md5 | sed 's/\(..\)/\1:/g' | cut -b1-17`
oldhwaddr=`grep HWADDR $MOUNTDIR/etc/sysconfig/network-scripts/ifcfg-eth0
\ | sed s/HWADDR.*=//g`
sed "s/$oldmac/$newmac/g" < $TEMPF2 > $TEMPF3
cp -f $TEMPF3 /etc/xen/$CLONE
sed "s/$oldhwaddr/$newmac/g" < $MOUNTDIR/etc/sysconfig/network-scripts/ifcfg-eth0
\ > $TEMPIFCFG
cp -f $TEMPIFCFG $MOUNTDIR/etc/sysconfig/network-scripts/ifcfg-eth0

echo "Removing temporary files..."
rm -f $TEMPF1 $TEMPF2 $TEMPF3 $TEMPHOSTS $TEMPNETWORK $TEMPIFCFG

echo "Unmounting the image..."
umount /dev/mapper/$loopPart

echo "Unmapping the image..."
kpartx -d $DISKPATH/$CLONE.img

echo "Cloning of ${DISK} to ${CLONE} finished."