ia64/xen-unstable

view tools/examples/netbsd @ 1372:5a6113c65ead

bitkeeper revision 1.891.1.12 (40a248b0WTGoOa9206iWkyGN0mTPNw)

Allow forcing of IRQ trigger-type to edge or level
(NB. DANGEROUS!).
author kaf24@scramble.cl.cam.ac.uk
date Wed May 12 15:54:24 2004 +0000 (2004-05-12)
parents a6e98694ed63
children
line source
2 ##### Edit this python file to reflect the configuration of your system
4 ##### This example script expects a variable called 'vmid' to be set.
6 def config_usage ():
7 print >>sys.stderr,"""
8 The config file '%s' requires the following variable to be defined:
9 vmid -- Numeric identifier for the new domain, used to calculate
10 the VM's IP address and root partition. E.g. -Dvmid=1
12 Additionally the following variable may be defined:
13 image -- Path to kernel image, can be gzip'ed. [/boot/netbsd]
14 mem -- Memory size. [16]
15 name -- Domain name. [NetBSD VM vmid]
16 ip -- Primary IP address for domain. [this domain's IP + vmid]
17 nfsserv -- NFS server IP address. [169.254.1.0]
18 nfsroot -- Path to nfs root filesystem. [/netboot/netbsd]
19 """ % config_file
22 try:
23 vmid=int(vmid) # convert to integer
24 except:
25 print >>sys.stderr,"%s: This script expects 'vmid' to be set using -D vmid=X" % config_file
26 assert()
28 if vmid == 0:
29 print >>sys.stderr,"%s: 'vmid' must be greater than 0" % config_file
30 assert()
33 # STEP 1. Specify kernel image file. Can be gzip'ed.
34 if image == "": image = "/boot/netbsd"
36 builder_fn='netbsd' # this is a NetBSD domain
39 # STEP 2. The initial memory allocation (in megabytes) for the new domain.
40 try:
41 mem_size = int(mem)
42 except:
43 mem_size = 16
46 # STEP 3. A handy name for your new domain.
47 try:
48 domain_name = name
49 except:
50 domain_name = "NetBSD VM %d" % vmid
53 # STEP 4. Specify IP address(es), for the new domain. You need to
54 # configure IP addrs within the domain just as you do normally. This
55 # is just to let Xen know about them so it can route packets
56 # appropriately.
58 #vfr_ipaddr = ["111.222.333.444","222.333.444.555"]
59 try:
60 vfr_ipaddr = [ip, xenctl.utils.add_offset_to_ip('169.254.1.0',vmid),]
61 except:
62 vfr_ipaddr = [xenctl.utils.add_offset_to_ip(xenctl.utils.get_current_ipaddr(),vmid),
63 xenctl.utils.add_offset_to_ip('169.254.1.0',vmid),]
66 # STEP 5a. Identify any physcial partitions or virtual disks you want the
67 # domain to have access to, and what you want them accessible as
68 # e.g. vbd_list = [ ('phy:sda1','sda1', 'w'),
69 # ('phy:sda%d' % (3+vmid), 'hda2', 'r'),
70 # ('vd:as73gd784dh','hda1','w'),
71 # ('phy:cdrom','hdd','r')
73 #vbd_list = [ ('phy:sda%d'%(7+vmid),'sda1','w' ),
74 # ('phy:sda6','sda6','r') ]
78 # STEP 5b. Set the VBD expertise level. Most people should leave this
79 # on 0, at least to begin with - this script can detect most dangerous
80 # disk sharing between domains and with this set to zero it will only
81 # allow read only sharing.
83 vbd_expert = 0
86 # STEP 6. Build the command line for the new domain. Edit as req'd.
87 # You only need the ip= line if you're NFS booting or the root file system
88 # doesn't set it later e.g. in ifcfg-eth0 or via DHCP
89 # You can use 'extrabit' to set the runlevel and custom environment
90 # variables used by custom rc scripts (e.g. VMID=, usr= )
92 netmask = xenctl.utils.get_current_ipmask()
93 gateway = xenctl.utils.get_current_ipgw()
94 try:
95 nfsserv
96 except:
97 nfsserv = '169.254.1.0'
99 cmdline_ip = "ip="+vfr_ipaddr[0]+":"+nfsserv+":"+gateway+":"+netmask+"::eth0:off"
100 try:
101 cmdline_root = "nfsroot="+nfsserv+":"+nfsroot
102 except:
103 cmdline_root = "nfsroot="+nfsserv+":/netboot/netbsd"
104 #cmdline_root = "nfsroot=/full/path/to/root/directory"
106 cmdline_extra = "bootdev=xennet0"
109 # STEP 7. Set according to whether you want the script to watch the domain
110 # and auto-restart it should it die or exit.
112 auto_restart = False
113 #auto_restart = True