Merge branch 'bug/13869_disk_defaults' into release/0.10.1
[ganeti_webmgr.git] / ganeti_web / constants.py
blobe43fdc15474e4537949c8884ff5b47e8daee6ccd
1 # Copyright (C) 2010 Oregon State University et al.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
16 # USA.
18 VERSION = '0.10.1'
19 OWNER_TAG = 'gwm:owner:'
21 # Form Constants
22 EMPTY_CHOICE_FIELD = (u'', u'---------')
24 MODE_CHOICES = (
25 ('live', 'Live'),
26 ('non-live', 'Non-Live'),
29 NODE_ROLE_MAP = {
30 'M': 'Master',
31 'C': 'Master Candidate',
32 'R': 'Regular',
33 'D': 'Drained',
34 'O': 'Offline',
37 ROLE_CHOICES = (
38 EMPTY_CHOICE_FIELD,
39 (u'master-candidate', u'Master Candidate'),
40 (u'regular', u'Regular'),
41 (u'drained', u'Drained'),
42 (u'offline', u'Offline'),
45 ROLE_MAP = {
46 'C': u'master-candidate',
47 'R': u'regular',
48 'D': u'drained',
49 'O': u'offline',
52 # KVM Choices
53 KVM_BOOT_ORDER = [
54 (u'disk', u'Hard Disk'),
55 (u'cdrom', u'CD-ROM'),
56 (u'network', u'Network'),
59 KVM_FLAGS = [
60 EMPTY_CHOICE_FIELD,
61 (u'enabled', u'Enabled'),
62 (u'disabled', u'Disabled'),
65 KVM_DISK_TYPES = [
66 (u'scsi', u'SCSI'),
67 (u'sd', u'SD Card'),
68 (u'mtd', u'MTD'),
69 (u'pflash', u'PC System Flash'),
72 KVM_NIC_TYPES = [
73 (u'i82551', u'i82551'),
74 (u'i82557b', u'i82557B'),
75 (u'i82559er', u'i82559ER'),
76 (u'pcnet', u'PCnet'),
79 # Xen HVM Choices
80 HVM_BOOT_ORDER = [
81 (u'cd', u'Hard Disk, CD-ROM'),
82 (u'a', u'Floppy Drive'),
83 (u'c', u'Hard Disk'),
84 (u'd', u'CD-ROM'),
85 (u'n', u'Network'),
88 HVM_DISK_TYPES = [
89 (u'ioemu', u'ioemu'),
92 # HV Choices
93 HV_DISK_TEMPLATES = [
94 (u'plain', u'Plain'),
95 (u'drbd', u'DRBD'),
96 (u'file', u'File'),
97 (u'diskless', u'Diskless'),
98 (u'sharedfile', u'Sharedfile'),
101 # HV Choices
102 HV_DISK_TEMPLATES_SINGLE_NODE = [
103 (u'plain', u'plain'),
104 (u'file', u'file'),
105 (u'diskless', u'diskless')
108 HV_DISK_TYPES = [
109 (u'paravirtual', u'Paravirtual'),
110 (u'ide', u'IDE'),
113 HV_NIC_MODES = [
114 ('', ''),
115 (u'bridged', u'bridged'),
116 (u'routed', u'routed'),
119 HV_NIC_TYPES = [
120 (u'e1000', u'e1000'),
121 (u'rtl8139', u'RTL8139'),
122 (u'ne2k_isa', u'NE2000 (ISA)'),
123 (u'ne2k_pci', u'NE2000 (PCI)'),
124 (u'paravirtual', u'Paravirtual'),
127 HV_BOOT_ORDER = KVM_BOOT_ORDER
129 HV_DISK_CACHES = [
130 (u'none', u'None'),
131 (u'default', u'Default'),
132 (u'writethrough', u'Writethrough'),
133 (u'writeback', u'Writeback'),
136 HV_SECURITY_MODELS = [
137 (u'none', u'None'),
138 (u'user', u'User'),
139 (u'pool', u'Pool'),
142 HV_USB_MICE = [
143 (u'mouse', u'Mouse'),
144 (u'tablet', u'Tablet'),
147 ALL_DISK_TYPES = HV_DISK_TYPES + KVM_DISK_TYPES + HVM_DISK_TYPES
148 ALL_NIC_TYPES = HV_NIC_TYPES + KVM_NIC_TYPES
149 ALL_BOOT_ORDER = KVM_BOOT_ORDER + HVM_BOOT_ORDER
151 KVM_CHOICES = {
152 'disk_type': HV_DISK_TYPES + KVM_DISK_TYPES,
153 'nic_type': HV_NIC_TYPES + KVM_NIC_TYPES,
154 'boot_order': KVM_BOOT_ORDER,
157 HVM_CHOICES = {
158 'disk_type': HV_DISK_TYPES + HVM_DISK_TYPES,
159 'nic_type': HV_NIC_TYPES,
160 'boot_order': HVM_BOOT_ORDER,
163 ALL_CHOICES = {
164 'disk_type': ALL_DISK_TYPES,
165 'nic_type': ALL_NIC_TYPES,
166 'boot_order': ALL_BOOT_ORDER,
169 NO_CHOICES = {
170 'disk_type': None,
171 'nic_type': None,
172 'boot_order': None,
175 VM_CREATE_HELP = {
176 'owner': """<p>The owner indicates who this virtual machine belongs to.
177 Resources used by the virtual machine will be deducted from the
178 owner's quota.</p>""",
179 'cluster': "<p>Which ganeti cluster to deploy the new virtual machine"
180 " on.</p>",
181 'hostname': """<p>Fully qualified domain name <i>(<b>FQDN</b>)</i> to
182 assign to this virtual machine.<i>(e.g.
183 hostname.example.org)</i></p> <p>Note: Spaces and
184 certain special characters are not permitted in the
185 hostname field because they can cause errors with editing
186 or deleting the VM.</p>""",
187 'hypervisor': "<p>Which hypervisor the new virtual machine will run under"
188 ".</p>",
189 'start': """<p>Uncheck this if you don't want the instance to automatically
190 start after creation. If you do so, you can start it manually
191 on the virtual machine detail page.</p> <p>This option is only
192 available if you choose to install an operating system when
193 creating the virtual machine.</p>""",
194 'name_check': """<p>Check the virtual machine DNS name via the resolver
195 <i>(e.g. in DNS or /etc/hosts, depending on your
196 setup)</i>. Since the name check is used to compute the IP
197 address this also enables/disables IP checks <i>(e.g. if
198 the IP is pingable)</i>.</p> <p>This is useful for setups
199 that deploy virtual machines using dynamic DNS and thus
200 the name is not resolvable yet.</p> """,
201 'iallocator': """<p>Automatically select primary and secondary node to
202 allocate disks on.</p> <p>When selected it will use the
203 cluster default <a href="http://docs.ganeti.org/ganeti/current/html/iallocator.html">
204 iallocator</a> (if set by the cluster). The iallocator
205 being used will be displayed after the checkbox.</p> """,
206 'disk_template': """<p>Disk layout template for the virtual machine on the
207 cluster node.</p> <p>The available choices are:</p>
208 <ul> <li><b>plain</b> - Disk Devices will be logical
209 volumes <i>(e.g. LVM)</i></li> <li><b>drbd</b>- Disk
210 devices will be <a href="http://www.drbd.org/">DRBD</a>
211 (version 8.x) on top of LVM volumes</li>
212 <li><b>file</b> - Disk devices will be regular files
213 <i>(e.g. qcow2)</i></li> <li> <b>diskless</b> - This
214 creates a virtual machine with no disks. Its useful for
215 testing only (or other special cases).</li> </ul> <p>
216 If drbd is selected, then a primary and secondary node
217 will need to be chosen unless automatic allocation has
218 been selected as well. DRBD will allow the virtual
219 machine to use live migration and failover in case one
220 of the nodes goes offline.</p>""",
221 'pnode': """<p>The primary node to use for the virtual machine (in case
222 automatic allocation is not used).</p>""",
223 'snode': """<p>The secondary node to use for the virtual machine (in case
224 automatic allocation is not used). </p> <p> This is only
225 required when using the drbd disk template. </p> """,
226 'os': """<p>Operating system to install on the virtual machine. Your
227 choices are limited to the images configured on the cluster. </p>
228 <p> The text in <b>bold</b> signifies the Ganeti Operating System
229 Type which may be called debootstrap, image, or some other type.
230 The text that is selectable is the operating system (or os-type
231 variant) that the cluster has access to. </p> """,
232 'disk_size': """<p> Size of the system disk to allocate to this virtual
233 machine. If no units are given, megabytes is assumed. </p>
234 <p> Acceptable Formats: </p> <ul> <li> <b>M</b> or MB -
235 (megabytes) </li> <li> <b>G</b> or GB - (gigabytes) </li>
236 <li> <b>T</b> or TB - (terabytes) </li> </ul> <p><b><i>This
237 will be deducted from the owner's quota.</i></b></p>""",
238 'disk_type': """<p> This parameter determines the way the disks are
239 presented to the virtual machine. The possible options are:
240 </p> <ul> <li><b>paravirtual</b> - (HVM &amp; KVM)</li>
241 <li> <b>ioemu</b> - (default for HVM &amp; KVM) (HVM &amp;
242 KVM) </li> <li><b>ide</b> - (HVM &amp; KVM)</li>
243 <li><b>scsi</b> - (KVM)</li> <li><b>sd</b> - (KVM)</li>
244 <li><b>mtd</b> - (KVM)</li> <li><b>pflash</b> - (KVM)</li>
245 </ul><p>Valid for the Xen HVM and KVM hypervisors.</p>""",
246 'nic_mode': """ <p> This option specifies how the virtual machine connects
247 to the network. More information on this can be found in
248 the <a href="http://docs.ganeti.org/ganeti/current/html/install.html#configuring-the-network"> Ganeti tutorial documentation</a> .</p>
249 <p>When in doubt, choose
250 <b>bridged</b>.</p> <ul> <li> <b>bridged</b> - The virtual
251 machine's network interface will be attached to a software
252 bridge running on the node. </li> <li><b>routed</b> - The
253 virtual machine's network interface will be routed. </li>
254 </ul>""",
255 'nic_type': """<p> This parameter determines the way the network cards are
256 presented to the virtual machine. The possible options are:
257 </p> <ul> <li><b>rtl8139</b> - (default for Xen HVM) (HVM
258 &amp; KVM)</li> <li><b>ne2k_isa</b> - (HVM &amp; KVM)</li>
259 <li><b>ne2k_pci</b> - (HVM &amp; KVM)</li>
260 <li><b>i82551</b> - (KVM)</li> <li><b>i82557b</b> -
261 (KVM)</li> <li><b>i82559er</b> - (KVM)</li>
262 <li><b>pcnet</b> - (KVM)</li> <li><b>e1000</b> - (HVM &amp;
263 KVM)</li> <li><b>paravirtual</b> - (default for KVM) (KVM
264 &amp; HVM)</li> </ul> <p>Valid for the Xen HVM and KVM
265 hypervisors.</p> """,
266 'kernel_path': """<p> This option specifies the path (on the node) to the
267 kernel to boot the virtual machine with. Xen PVM
268 instances always require this, while for KVM if this
269 option is empty, it will cause the machine to load the
270 kernel from its disks. </p> <p>Valid for the Xen PVM
271 and KVM hypervisors.</p> """,
272 'root_path': """<p> This option specifies the name of the root device.
273 This is always needed for Xen PVM, while for KVM it is only
274 used if the kernel_path option is also specified. </p>
275 <p>Valid for the Xen PVM and KVM hypervisors.</p> """,
276 'serial_console': """<p> This boolean option specifies whether to emulate
277 a serial console for the instance. </p> <p>Valid for
278 the KVM hypervisor.</p> """,
279 'boot_order': """<p>Value denoting boot order for the virtual machine.</p>
280 <ul> <li><b>Hard Disk</b> - boot from the first disk
281 device</li> <li> <b>CD-ROM</b> - boot from the cdrom
282 (requires CD Image path being set) </li>
283 <li><b>Network</b>
284 - boot from the network (such as PXE)</li> </ul> <p>Valid
285 for the Xen HVM and KVM hypervisors.</p> """,
286 'cdrom_image_path': """<p> The path to a CDROM image on the node to attach
287 to the virtual machine. </p> <p>Valid for the Xen
288 HVM and KVM hypervisors.</p> """,
289 'cdrom2_image_path': """<p> The path to the second CDROM image, if
290 multiple CDROMs are supported by the selected
291 hypervisor. </p> """,
292 'no_install': """<p>Skip installing the operating system when creating
293 the VM. Use this option if you plan to manually set up the
294 virtual machine. </p> <p> Note that even if you aren't
295 installing an operating system, you must select one from
296 the list to fulfill Ganeti's parameter requirements. The
297 selected OS will be associated with the VM, but not
298 installed. </p> """,
299 'choices': """<p>Template - A re-usable Virtual Machine Template. Check
300 this box if you want to save the options for easy re-use
301 later.</p> <p>Virtual Machine - Start up an instance with
302 the options chosen in this Wizard""",
305 VM_HELP = {
306 'vcpus': """<p>Number of virtual cpus to allocate to this virtual
307 machine.</p> <p><b><i>This will be deducted from the owner's
308 quota.</i></b></p> """,
309 'memory': """<p> Amount of ram to allocate to this virtual machine. If no
310 units are given, megabytes is assumed.
311 </p> <p><b><i>This will
312 be deducted from the owner's quota.</i></b></p> """,
313 'nic_link': """<p>In <b>bridged</b> mode, it specifies the bridge
314 interface to attach this NIC to on the node <i>(e.g.
315 br0)</i>. </p> <p>In <b>routed</b> mode it's intended to
316 differentiate between different routing tables/virtual
317 machine groups (but the meaning is dependant on the network
318 script, see <a href="http://docs.ganeti.org/ganeti/current/man/gnt-cluster.html">
319 gnt-cluster(8)</a> for more details. </p> """,
320 'nic_mac': """<p> This option specifies a MAC address to be associated
321 with the NIC. </p> <p> Any valid MAC address may be used.
322 </p>""",
323 'template_name': """<p> The name of this template. Templates will be
324 sorted by template name when they appear in a list.
325 </p> """,
326 'description': "<p>Optional. A short description of the template.</p>",
329 VM_RENAME_HELP = {
330 'hostname': """<p>Domain name or host name to assign to this virtual
331 machine;
332 e.g. <tt>example.org</tt> or
333 <tt>subdomain.example.org</tt>.</p>""",
334 'ip_check': "<p>Whether to ensure instance's IP address is inactive.</p>",
335 'name_check': """<p> Check the virtual machine DNS name via the
336 resolver <i>(e.g. in DNS or
337 /etc/hosts, depending on your setup)</i>. Since the name
338 check is used to compute the IP address this also
339 enables/disables IP checks <i>(e.g. if the IP is
340 pingable)</i>. </p> <p> This is useful for setups that
341 deploy virtual machines using dynamic DNS and thus the
342 name is not resolvable yet. </p> <p> <b>Use with
343 caution!</b> If left unchecked you may run into name/ip
344 collisions. </p>""",