[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] Booting FreeBSD diskless in DomU


  • To: Geoff Buckingham <geoffb@xxxxxxxxxxxxxxxxxxx>
  • From: Kip Macy <kip.macy@xxxxxxxxx>
  • Date: Thu, 8 Sep 2005 11:42:29 -0700
  • Cc: xen-users@xxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 08 Sep 2005 18:40:33 +0000
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=mSeZZO35Xn7mouzlUH1CGgVAOydHyBMc2IJwCu+7kWkKVvWh2G2IITedIZz3RQEHSzdpWkW+V7Vkz6Onu3DkOP6L8WVIx5zL8YhdwK++qtrbr66ISZxsJx/PXMgtXFsPyK5ZYxjFEt25nZj5vs0Mmn02jBfuAHUQbxkquLqzf7Q=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

I vaguely recall disabling xenFreeBSD's diskless support. One alternative is to have a small loopback mounted root with the majority of your files exported over NFS.

     -Kip

On 9/8/05, Geoff Buckingham <geoffb@xxxxxxxxxxxxxxxxxxx> wrote:

Using the 2.0.6 demo cd image, I booted the supplied freebsd image and rsync'd
the file system to an NFS server. However I don not seem to be able to
succesfully boot from it the system just hangs here:

xn0: bpf attached
xn0: Ethernet address: aa:00:00:61:1c:d4
lo0: bpf

I have modified /sbin/start_freebsd.sh and /etc/xen/freebsd.py to generate
the following  configuration:

xendemo:~# start_freebsd.sh
Starting new guest domain

Using config file "/etc/xen/freebsd.py".
(vm
    (name FreeBSD-69)
    (memory 48)
    (cpu 69)
    (image
        (linux
            (kernel /boot/freebsd)
            (ip 10.0.0.246:10.0.0.19::255.255.255.0::eth0:off)
            (root /dev/dns)
            (args
                'nfsroot=10.0.0.19:/FreeBSD53 ,vfs.root.mountfrom=nfs:10.0.0.19:/FreeBSD53,boot_verbose=yes,boot_single=yes'
            )
        )
    )
    (device (vif (mac aa:00:00:5b:7a:53)))
)

Is there something I am missing? The bridge seems OK I can access the nfs
exports from the demo cd's default DomUs.

I include my modified files, as I am currently using a fixed IP I have only
been launching one instance of FreeBSD at a time.

xendemo:~# brctl show
bridge name     bridge id               STP enabled     interfaces
xen-br0         8000.00110a543046       no              eth0
                                                        vif31.0
xendemo:~# ifconfig xen-br0
xen-br0   Link encap:Ethernet  HWaddr 00:11:0A:54:30:46
          inet addr:10.0.0.237  Bcast:10.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:291944 errors:0 dropped:0 overruns:0 frame:0
          TX packets:533910 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:16437710 (15.6 MiB)  TX bytes:77603155 (74.0 MiB)

xendemo:~# ping 10.0.0.19
PING 10.0.0.19 (10.0.0.19 ) 56(84) bytes of data.
64 bytes from 10.0.0.19: icmp_seq=1 ttl=64 time=7.95 ms
64 bytes from 10.0.0.19: icmp_seq=2 ttl=64 time=0.416 ms
64 bytes from 10.0.0.19: icmp_seq=3 ttl=64 time=0.342 ms

new FreeBSD guest domain

# Wait for the user if we're called on a VT
if [ $PPID -eq 1 ] ; then
  echo
  echo "Press Enter to start a new FreeBSD guest OS"
  read
fi

# First it needs an ID
VMID=`/sbin/get_next_vmid.sh`

# Now here we go
echo "Starting new guest domain"
echo

xm create -c -f /etc/xen/freebsd.py \
root=/dev/dns \
name=FreeBSD-$VMID \
kernel=/boot/freebsd \
ip='10.0.0.246' \
netmask='255.255.255.0' \
nfs_server='10.0.0.19 ' \
nfs_root=/FreeBSD53 \
blkif=no \
netif=no \
memory=48 \
vmid=$VMID
xendemo:~#

xendemo:~# cat /etc/xen/freebsd.py
import xen.util.ip

##### Edit this python file to reflect the configuration of your system

##### This example script expects a variable called 'vmid' to be set.

def config_usage ():
    print >>sys.stderr,"""
The config file '%s' requires the following variable to be defined:
vmid             -- Numeric identifier for the new domain, used to calculate
                     the VM's IP address and root partition. E.g. -Dvmid=1

Additionally the following variable may be defined:
image            -- Path to kernel image, can be gzip'ed. [/boot/freebsd]
mem              -- Memory size. [16]
name             -- Domain name. [FreeBSD VM vmid]
ip               -- Primary IP address for domain. [this domain's IP + vmid]
nfsserv          -- NFS server IP address. [169.254.1.0]
nfsroot          -- Path to nfs root filesystem. [/netboot/freebsd]
""" % config_file

# Define script variables here.
# xm_vars is defined automatically, use xm_vars.var() to define a variable.

def vmid_check(var, val):
    val = int(val)
    if val <= 0:
        raise ValueError
    return val

xm_vars.var('vmid',
            use="Virtual machine id. Integer greater than 0.",
            check=vmid_check)

# This checks the script variables.
xm_vars.check()

try:
    kernel = kernel
except:
    kernel = "/u/kmacy/kernel"

builder='linux' # this is a FreeBSD domain


# STEP 2. The initial memory allocation (in megabytes) for the new domain.
try:
    memory = int(mem)
except:
    memory = 256


# STEP 3. A handy name for your new domain.
try:
    name = name
except:
    name = "FreeBSD VM %d" % vmid

# STEP 3A. Which CPU to start domain on?
cpu = vmid # set based on vmid (mod number of CPUs)


# STEP 4. Specify IP address(es), for the new domain.  You need to
# configure IP addrs within the domain just as you do normally.  This
# is just to let Xen know about them so it can route packets
# appropriately.

#vfr_ipaddr = ["111.222.333.444","222.333.444.555"]
# try:
#    vfr_ipaddr = [ip, xenctl.utils.add_offset_to_ip('169.254.1.0',vmid),]
# except:
#  vfr_ipaddr = [xenctl.utils.add_offset_to_ip(xenctl.get_current_ipaddr(),vmid),
#                 xenctl.utils.add_offset_to_ip('169.254.1.0',vmid),]
#vfr_ipaddr = ["10.56.11.30"];
vfr_ipaddr = ["10.0.0.246 "] # xen-vm0

# STEP 5a. Identify any physcial partitions or virtual disks you want the
# domain to have access to, and what you want them accessible as
# e.g. vbd_list = [ ('phy:sda6','sda6', 'w'),
#        ('phy:sda%d' % (3+vmid), 'hda2', 'r'),
#        ('vd:as73gd784dh','hda1','w'),
#        ('phy:cdrom','hdd','r')

#disk = [ 'phy:loopa,loopa,w' ]


# STEP 5b. Set the VBD expertise level.  Most people should leave this
# on 0, at least to begin with - this script can detect most dangerous
# disk sharing between domains and with this set to zero it will only
# allow read only sharing.

vbd_expert = 0


# STEP 6. Build the command line for the new domain. Edit as req'd.
# You only need the ip= line if you're NFS booting or the root file system
# doesn't set it later e.g. in ifcfg-eth0 or via DHCP
# You can use 'extrabit' to set the runlevel and custom environment
# variables used by custom rc scripts ( e.g. VMID=, usr= )

netmask = xen.util.ip.get_current_ipmask()
gateway = xen.util.ip.get_current_ipgw()
try:
    nfsserv
except:
    nfsserv = '10.0.0.19'

extra = " boot.netif.ip="+vfr_ipaddr[0]
extra += ",boot.netif.netmask="+netmask
extra = ",vfs.root.mountfrom=nfs:10.0.0.19:/FreeBSD53"
extra += ",boot_verbose=yes"
extra += ",boot_single=yes"
#extra += ",boot_gdb=yes"
#extra += ",boot_gdb_pause=yes"

#cmdline_ip += ",init_path=/sbin:/sbin/init"
# there is no real MAC address - need hack in device driver
# cmdline_ip += ", boot.netif.hwaddr=00:00:00:00:00:00"
# cmdline_ip += ",boot.nfsroot.server="+nfsserv
# try:
#    cmdline_ip += ",boot.nfsroot.path="+nfspath
# except:
#    cmdline_ip += ",boot.nfsroot.path=/netboot/freebsd "
# something is appending garbage to the end - make sure it is separate
#    cmdline_ip += ","

# STEP 7. Set according to whether you want the script to watch the domain
# and auto-restart it should it die or exit.

auto_restart = False
#auto_restart = True

xendemo:~#


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.