Subject: Re: problem with remote NFS
To: Keichii Moto <keichiitoyota@yahoo.com>
From: Christian Limpach <chris@pin.lu>
List: port-xen
Date: 04/18/2004 13:17:44
--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sat, Apr 17, 2004 at 11:01:44PM -0700, Keichii Moto wrote:
> I followed instructions to build Xen and NetBSD/xen:
> http://mail-index.netbsd.org/port-xen/2004/04/07/0000.html
> 
> I have a problem with /etc/xc/netbsd, would anyone can
> send that config file to me? Thanks.

The file should get installed if you installed Xen from sources.
I think it doesn't get installed if you install Xen from the DemoCD,
but it's on the CD at (/usr)/local/src/xeno-1.2/install/etc/netbsd.

I'm also attaching the file to this email, just in case.

    christian


--MGYHOYXEY6WxJCY8
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=netbsd


##### 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/netbsd]
 mem              -- Memory size. [16]
 name             -- Domain name. [NetBSD 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/netbsd]
""" % config_file


try:
    vmid=int(vmid) # convert to integer
except:
    print >>sys.stderr,"%s: This script expects 'vmid' to be set using -D vmid=X" % config_file
    assert()

if vmid == 0:
    print >>sys.stderr,"%s: 'vmid' must be greater than 0" % config_file
    assert()


# STEP 1. Specify kernel image file. Can be gzip'ed.
if image == "": image = "/boot/netbsd"

builder_fn='netbsd' # this is a NetBSD domain


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


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


# 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, XenoUtil.add_offset_to_ip('169.254.1.0',vmid),]
except:
    vfr_ipaddr = [XenoUtil.add_offset_to_ip(XenoUtil.get_current_ipaddr(),vmid),
                  XenoUtil.add_offset_to_ip('169.254.1.0',vmid),]


# 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:sda1','sda1', 'w'),
#	 ('phy:sda%d' % (3+vmid), 'hda2', 'r'), 
#	 ('vd:as73gd784dh','hda1','w'),
#	 ('phy:cdrom','hdd','r')

#vbd_list = [ ('phy:sda%d'%(7+vmid),'sda1','w' ), 
#	     ('phy:sda6','sda6','r') ]



# 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 = XenoUtil.get_current_ipmask()
gateway = XenoUtil.get_current_ipgw()
try:
    nfsserv
except:
    nfsserv = '169.254.1.0'

cmdline_ip = "ip="+vfr_ipaddr[0]+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
try:
    cmdline_root = "nfsroot="+nfsserv+":"+nfsroot
except:
    cmdline_root = "nfsroot="+nfsserv+":/netboot/netbsd"
    #cmdline_root = "nfsroot=/full/path/to/root/directory"

cmdline_extra = "bootdev=xennet0"


# 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

--MGYHOYXEY6WxJCY8--