direct-io.hg

view tools/examples/xmexample2 @ 9683:bdcc838b9a72

Add small memory warning message to domain configuration examples.

Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com>
author stekloff@dyn9047022152.beaverton.ibm.com
date Wed Apr 19 22:58:24 2006 +0100 (2006-04-19)
parents 55d464295da3
children 6a285d7d7b39
line source
1 # -*- mode: python; -*-
2 #============================================================================
3 # Example Python setup script for 'xm create'.
4 # This script sets the parameters used when a domain is created using 'xm create'.
5 #
6 # This is a relatively advanced script that uses a parameter, vmid, to control
7 # the settings. So this script can be used to start a set of domains by
8 # setting the vmid parameter on the 'xm create' command line. For example:
9 #
10 # xm create vmid=1
11 # xm create vmid=2
12 # xm create vmid=3
13 #
14 # The vmid is purely a script variable, and has no effect on the the domain
15 # id assigned to the new domain.
16 #============================================================================
18 # Define script variables here.
19 # xm_vars is defined automatically, use xm_vars.var() to define a variable.
21 # This function checks that 'vmid' has been given a valid value.
22 # It is called automatically by 'xm create'.
23 def vmid_check(var, val):
24 val = int(val)
25 if val <= 0:
26 raise ValueError
27 return val
29 # Define the 'vmid' variable so that 'xm create' knows about it.
30 xm_vars.var('vmid',
31 use="Virtual machine id. Integer greater than 0.",
32 check=vmid_check)
34 # Check the defined variables have valid values..
35 xm_vars.check()
37 #----------------------------------------------------------------------------
38 # Kernel image file.
39 kernel = "/boot/vmlinuz-2.6.10-xenU"
41 # Optional ramdisk.
42 #ramdisk = "/boot/initrd.gz"
44 # The domain build function. Default is 'linux'.
45 #builder='linux'
47 # Initial memory allocation (in megabytes) for the new domain.
48 #
49 # WARNING: Creating a domain with insufficient memory may cause out of
50 # memory errors. The domain needs enough memory to boot kernel
51 # and modules. Allocating less than 32MBs is not recommended.
52 memory = 64
54 # A name for the new domain. All domains have to have different names,
55 # so we use the vmid to create a name.
56 name = "VM%d" % vmid
58 # List of which CPUS this domain is allowed to use, default Xen picks
59 #cpus = "" # leave to Xen to pick
60 #cpus = "0" # all vcpus run on CPU0
61 #cpus = "0-3,5,^1" # run on cpus 0,2,3,5
62 #cpus = "%s" % vmid # set based on vmid (mod number of CPUs)
64 # Number of Virtual CPUS to use, default is 1
65 #vcpus = 1
66 vcpus = 4 # make your domain a 4-way
68 #----------------------------------------------------------------------------
69 # Define network interfaces.
71 # By default, no network interfaces are configured. You may have one created
72 # with sensible defaults using an empty vif clause:
73 #
74 # vif = [ '' ]
75 #
76 # or optionally override backend, bridge, ip, mac, script, type, or vifname:
77 #
78 # vif = [ 'mac=00:16:3e:00:00:11, bridge=xenbr0' ]
79 #
80 # or more than one interface may be configured:
81 #
82 # vif = [ '', 'bridge=xenbr1' ]
84 vif = [ '' ]
86 #----------------------------------------------------------------------------
87 # Define the disk devices you want the domain to have access to, and
88 # what you want them accessible as.
89 # Each disk entry is of the form phy:UNAME,DEV,MODE
90 # where UNAME is the device, DEV is the device name the domain will see,
91 # and MODE is r for read-only, w for read-write.
93 # This makes the disk device depend on the vmid - assuming
94 # that devices sda7, sda8 etc. exist. The device is exported
95 # to all domains as sda1.
96 # All domains get sda6 read-only (to use for /usr, see below).
97 disk = [ 'phy:sda%d,sda1,w' % (7+vmid),
98 'phy:sda6,sda6,r' ]
100 #----------------------------------------------------------------------------
101 # Define to which TPM instance the user domain should communicate.
102 # The vtpm entry is of the form 'instance=INSTANCE,backend=DOM'
103 # where INSTANCE indicates the instance number of the TPM the VM
104 # should be talking to and DOM provides the domain where the backend
105 # is located.
106 # Note that no two virtual machines should try to connect to the same
107 # TPM instance. The handling of all TPM instances does require
108 # some management effort in so far that VM configration files (and thus
109 # a VM) should be associated with a TPM instance throughout the lifetime
110 # of the VM / VM configuration file. The instance number must be
111 # greater or equal to 1.
112 #vtpm = ['instance=%d,backend=0' % (vmid) ]
114 #----------------------------------------------------------------------------
115 # Set the kernel command line for the new domain.
116 # You only need to define the IP parameters and hostname if the domain's
117 # IP config doesn't, e.g. in ifcfg-eth0 or via DHCP.
118 # You can use 'extra' to set the runlevel and custom environment
119 # variables used by custom rc scripts (e.g. VMID=, usr= ).
121 # Set if you want dhcp to allocate the IP address.
122 #dhcp="dhcp"
123 # Set netmask.
124 #netmask=
125 # Set default gateway.
126 #gateway=
127 # Set the hostname.
128 #hostname= "vm%d" % vmid
130 # Set root device.
131 root = "/dev/sda1 ro"
133 # Root device for nfs.
134 #root = "/dev/nfs"
135 # The nfs server.
136 #nfs_server = '169.254.1.0'
137 # Root directory on the nfs server.
138 #nfs_root = '/full/path/to/root/directory'
140 # Sets runlevel 4 and the device for /usr.
141 extra = "4 VMID=%d usr=/dev/sda6" % vmid
143 #----------------------------------------------------------------------------
144 # Configure the behaviour when a domain exits. There are three 'reasons'
145 # for a domain to stop: poweroff, reboot, and crash. For each of these you
146 # may specify:
147 #
148 # "destroy", meaning that the domain is cleaned up as normal;
149 # "restart", meaning that a new domain is started in place of the old
150 # one;
151 # "preserve", meaning that no clean-up is done until the domain is
152 # manually destroyed (using xm destroy, for example); or
153 # "rename-restart", meaning that the old domain is not cleaned up, but is
154 # renamed and a new domain started in its place.
155 #
156 # The default is
157 #
158 # on_poweroff = 'destroy'
159 # on_reboot = 'restart'
160 # on_crash = 'restart'
161 #
162 # For backwards compatibility we also support the deprecated option restart
163 #
164 # restart = 'onreboot' means on_poweroff = 'destroy'
165 # on_reboot = 'restart'
166 # on_crash = 'destroy'
167 #
168 # restart = 'always' means on_poweroff = 'restart'
169 # on_reboot = 'restart'
170 # on_crash = 'restart'
171 #
172 # restart = 'never' means on_poweroff = 'destroy'
173 # on_reboot = 'destroy'
174 # on_crash = 'destroy'
176 #on_poweroff = 'destroy'
177 #on_reboot = 'restart'
178 #on_crash = 'restart'
180 #============================================================================