FMotif

From PRAGMA wiki
Jump to: navigation, search

Introduction

  • The VM image, http://snowfox.nchc.org.tw/download/ubuntu-10.04-amd64-fmotif.img.gz, is a Ubuntu/KVM VM image for FMotif application, created by NCHC.
  • The VM deployment has been tested among 3 sites: SDSC, AIST and NCHC.
    • Rocks/Xen:
      • SDSC: Phil Papadopoulos, Cindy Zheng
      • AIST: Yoshio Tanaka, Akihiko Ota
    • Ubuntu/KVM:
      • NCHC: Weicheng Huang, Serena Pan
  • The deployment notes below can serve as a guide. We encourage all sites who deploy this VM image to contribute their notes/tips into this document.
  • After you deploy the VM image to the VM hosting server at your site, or if you have questions and need any help, please inform/contact Cindy.

Sample deployment notes

Deploy to a Rocks VM hosting server

  • Create a VM
[root@fiji ~]# rocks add host vm fiji.rocksclusters.org membership="Hosted VM" name=fmotif
added VM fmotif on physical node fiji
  • Set VM network interface to public
[root@fiji ~]# rocks set host interface subnet fmotif eth0 public
  • Get VM MAC address and disk image path
[root@fiji ~]# rocks list host interface fmotif
SUBNET IFACE MAC               IP NETMASK MODULE NAME   VLAN OPTIONS CHANNEL
public eth0  b6:58:ca:00:00:60 -- ------- ------ fmotif ---- ------- -------
[root@fiji ~]# rocks list host vm fmotif showdisks=y
SLICE MEM   CPUS MAC               HOST DISK                                              DISKSIZE
14    1024  1    b6:58:ca:00:00:60 fiji file:/state/partition1/xen/disks/fmotif.hda,hda,w 36
  • Copy disk image file to new VM file location
[root@fiji ~]# cd /state/partition1/xen/disks
[root@fiji disks]# wget http://snowfox.nchc.org.tw/download/ubuntu-10.04-amd64-fmotif.img.gz
[root@fiji disks]# mv ubuntu-10.04-amd64-fmotif.img.gz fmotif.hda.gz
[root@fiji disks]# gunzip fmotif.hda.gz
  • Modify disk image before boot
[root@fiji disks]# lomount -diskimage fmotif.hda -partition 1 /media
[root@fiji disks]# vi /media/etc/network/interfaces
[root@fiji disks]# cat /media/etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 198.202.88.204
#       hwaddress ether 00:55:60:48:18:60
        netmask 255.255.255.0
        network 198.202.88.0
        broadcast 198.202.88.255
        gateway 198.202.88.20
  • Add your ssh public key to /media/home/nchc/.ssh/authorized_keys file
  • Find the Ubuntu kernel and ramdisk image file paths in /media/boot/grub/grub.cfg, in lines like these
linux /boot/vmlinuz-2.6.32-21-generic root=UUID=85376c09-2271-4ab0-b43e-70d2598610e3 ro quiet splash
initrd /boot/initrd.img-2.6.32-21-generic
  • Copy the image files to your VM hosting server
[root@fiji disks]# mkdir /var/www/html/ubuntu
[root@fiji disks]# cp /media/boot/vmlinuz-2.6.32-21-generic /var/www/html/ubuntu
[root@fiji disks]# cp /media/boot/initrd.img-2.6.32-21-generic /var/www/html/ubuntu
  • Add a new bootaction for Ubontu VM
[root@fiji disks]# rocks add bootaction action=ubuntu args="root=/dev/xvda1 ro quiet" kernel=http://10.1.1.1/ubuntu/vmlinuz-2.6.32-21-generic ramdisk=http://10.1.1.1/ubuntu/initrd.img-2.6.32-21-generic
[root@fiji disks]# rocks set host runaction fmotif ubuntu
  • Boot VM
[root@fiji disks]# umount /media
[root@fiji disks]# rocks set host boot action=os fmotif
[root@fiji disks]# rocks list host boot fmotif
ACTION
os
[root@fiji disks]# rocks start host vm fmotif
  • Test ssh access
$ ssh nchc@rocks-204.sdsc.edu
The authenticity of host 'rocks-204.sdsc.edu (198.202.88.204)' can't be established.
RSA key fingerprint is c6:12:33:95:ed:e1:de:a4:62:75:66:1c:ff:b3:d5:6c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rocks-204.sdsc.edu,198.202.88.204' (RSA) to the list of known hosts.
Enter passphrase for key '/home/zhengc/.ssh/id_rsa':
Linux bio002 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010 x86_64 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/

Last login: Thu Feb 17 16:00:51 2011 from node01.local
nchc@bio002:~$
  • Test web interface

Point your browser to http://rocks-204.sdsc.edu

  • Congratulations for the success! But don't forget to inform Cindy and Weicheng the VM hostname/ip, so NCHC team can test and add this VM instance to their application runs.

Deploy to an Eucalyptus based KVM cloud

By Jing Yuan Luke, MIMOS

Eucalyptus some how relies on the root to be labelled as root (i.e. it attempts to use an option like "-append root=LABEL=root"). This somehow is not enabled in Ubuntu by default so my colleagues in the lab always run the "e2label" command from the VM to ensure eucalyptus would start the Ubuntu instances. This problem however doesn't happen on CentOS/Redhat.

So the work around I used basically is to mount your Ubuntu image as loop device, here are the steps I taken:

  1. sudo losetup -f (assuming /dev/loop0 is available)
  2. sudo losetup /dev/loop0 ubuntu-10.04-amd64-fmotif.img
  3. sudo kpartx -av /dev/loop0
  4. sudo e2label /dev/mapper/loop0p1 root
  5. sudo mount /dev/mapper/loop0p1 /mnt
  6. ... additional wok to be discussed later (including copying out vmlinuz and initrd which already been discussed)
  7. sudo umount /mnt
  8. sudo kpartx -dv /dev/loop0
  9. sudo losetup -d /dev/loop0


For step 6, my colleagues would further change the eth0 (/etc/network/interfaces) to dhcp. Remove from /etc/udev/rules.d the 70-persistent-net.rules file and from /lib/udev write_net_rules file.