Fix error when sorting Job list by object.
[ganeti_webmgr.git] / ganeti_web / constants.py
blobec05555f9e1a831dcd76c08cf0605d3ecba9d009
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.9.2'
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 (u'', u''),
115 (u'routed', u'Routed'),
116 (u'bridged', u'Bridged')
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: It is strongly
184 recommended to leave the DNS Name Check box checked, to
185 confirm that your selected hostname is valid. Spaces and
186 certain special characters are not permitted in the
187 hostname field because they can cause errors with editing
188 or deleting the VM.</p>""",
189 'hypervisor': "<p>Which hypervisor the new virtual machine will run under"
190 ".</p>",
191 'start': """<p>Uncheck this if you don't want the instance to automatically
192 start after creation. If you do so, you can start it manually
193 on the virtual machine detail page.</p> <p>This option is only
194 available if you choose to install an operating system when
195 creating the virtual machine.</p>""",
196 'name_check': """<p>Check the virtual machine DNS name via the resolver
197 <i>(e.g. in DNS or /etc/hosts, depending on your
198 setup)</i>. Since the name check is used to compute the IP
199 address this also enables/disables IP checks <i>(e.g. if
200 the IP is pingable)</i>.</p> <p>This is useful for setups
201 that deploy virtual machines using dynamic DNS and thus
202 the name is not resolvable yet.</p> """,
203 'iallocator': """<p>Automatically select primary and secondary node to
204 allocate disks on.</p> <p>When selected it will use the
205 cluster default <a
206 href="http://docs.ganeti.org/ganeti/current/html
207 /iallocator.html">
208 iallocator</a> (if set by the cluster). The iallocator
209 being used will be displayed after the checkbox.</p> """,
210 'disk_template': """<p>Disk layout template for the virtual machine on the
211 cluster node.</p> <p>The available choices are:</p>
212 <ul> <li><b>plain</b> - Disk Devices will be logical
213 volumes <i>(e.g. LVM)</i></li> <li><b>drbd</b>- Disk
214 devices will be <a href="http://www.drbd.org/">DRBD</a>
215 (version 8.x) on top of LVM volumes</li>
216 <li><b>file</b> - Disk devices will be regular files
217 <i>(e.g. qcow2)</i></li> <li> <b>diskless</b> - This
218 creates a virtual machine with no disks. Its useful for
219 testing only (or other special cases).</li> </ul> <p>
220 If drbd is selected, then a primary and secondary node
221 will need to be chosen unless automatic allocation has
222 been selected as well. DRBD will allow the virtual
223 machine to use live migration and failover in case one
224 of the nodes goes offline.</p>""",
225 'pnode': """<p>The primary node to use for the virtual machine (in case
226 automatic allocation is not used).</p>""",
227 'snode': """<p>The secondary node to use for the virtual machine (in case
228 automatic allocation is not used). </p> <p> This is only
229 required when using the drbd disk template. </p> """,
230 'os': """<p>Operating system to install on the virtual machine. Your
231 choices are limited to the images configured on the cluster. </p>
232 <p> The text in <b>bold</b> signifies the Ganeti Operating System
233 Type which may be called debootstrap, image, or some other type.
234 The text that is selectable is the operating system (or os-type
235 variant) that the cluster has access to. </p> """,
236 'disk_size': """<p> Size of the system disk to allocate to this virtual
237 machine. If no units are given, megabytes is assumed. </p>
238 <p> Acceptable Formats: </p> <ul> <li> <b>M</b> or MB -
239 (megabytes) </li> <li> <b>G</b> or GB - (gigabytes) </li>
240 <li> <b>T</b> or TB - (terabytes) </li> </ul> <p><b><i>This
241 will be deducted from the owner's quota.</i></b></p>""",
242 'disk_type': """<p> This parameter determines the way the disks are
243 presented to the virtual machine. The possible options are:
244 </p> <ul> <li><b>paravirtual</b> - (HVM &amp; KVM)</li>
245 <li> <b>ioemu</b> - (default for HVM &amp; KVM) (HVM &amp;
246 KVM) </li> <li><b>ide</b> - (HVM &amp; KVM)</li>
247 <li><b>scsi</b> - (KVM)</li> <li><b>sd</b> - (KVM)</li>
248 <li><b>mtd</b> - (KVM)</li> <li><b>pflash</b> - (KVM)</li>
249 </ul><p>Valid for the Xen HVM and KVM hypervisors.</p>""",
250 'nic_mode': """ <p> This option specifies how the virtual machine connects
251 to the network. More information on this can be found in
252 the <a
253 href="http://docs.ganeti.org/ganeti/current/html
254 /install.html#configuring-the-network">Ganeti
255 tutorial documentation</a>. </p> <p>When in doubt, choose
256 <b>bridged</b>.</p> <ul> <li> <b>bridged</b> - The virtual
257 machine's network interface will be attached to a software
258 bridge running on the node. </li> <li><b>routed</b> - The
259 virtual machine's network interface will be routed. </li>
260 </ul>""",
261 'nic_type': """<p> This parameter determines the way the network cards are
262 presented to the virtual machine. The possible options are:
263 </p> <ul> <li><b>rtl8139</b> - (default for Xen HVM) (HVM
264 &amp; KVM)</li> <li><b>ne2k_isa</b> - (HVM &amp; KVM)</li>
265 <li><b>ne2k_pci</b> - (HVM &amp; KVM)</li>
266 <li><b>i82551</b> - (KVM)</li> <li><b>i82557b</b> -
267 (KVM)</li> <li><b>i82559er</b> - (KVM)</li>
268 <li><b>pcnet</b> - (KVM)</li> <li><b>e1000</b> - (HVM &amp;
269 KVM)</li> <li><b>paravirtual</b> - (default for KVM) (KVM
270 &amp; HVM)</li> </ul> <p>Valid for the Xen HVM and KVM
271 hypervisors.</p> """,
272 'kernel_path': """<p> This option specifies the path (on the node) to the
273 kernel to boot the virtual machine with. Xen PVM
274 instances always require this, while for KVM if this
275 option is empty, it will cause the machine to load the
276 kernel from its disks. </p> <p>Valid for the Xen PVM
277 and KVM hypervisors.</p> """,
278 'root_path': """<p> This option specifies the name of the root device.
279 This is always needed for Xen PVM, while for KVM it is only
280 used if the kernel_path option is also specified. </p>
281 <p>Valid for the Xen PVM and KVM hypervisors.</p> """,
282 'serial_console': """<p> This boolean option specifies whether to emulate
283 a serial console for the instance. </p> <p>Valid for
284 the KVM hypervisor.</p> """,
285 'boot_order': """<p>Value denoting boot order for the virtual machine.</p>
286 <ul> <li><b>Hard Disk</b> - boot from the first disk
287 device</li> <li> <b>CD-ROM</b> - boot from the cdrom
288 (requires CD Image path being set) </li>
289 <li><b>Network</b>
290 - boot from the network (such as PXE)</li> </ul> <p>Valid
291 for the Xen HVM and KVM hypervisors.</p> """,
292 'cdrom_image_path': """<p> The path to a CDROM image on the node to attach
293 to the virtual machine. </p> <p>Valid for the Xen
294 HVM and KVM hypervisors.</p> """,
295 'cdrom2_image_path': """<p> The path to the second CDROM image, if
296 multiple CDROMs are supported by the selected
297 hypervisor. </p> """,
298 'no_install': """<p>Skip installing the operating system when creating
299 the VM. Use this option if you plan to manually set up the
300 virtual machine. </p> <p> Note that even if you aren't
301 installing an operating system, you must select one from
302 the list to fulfill Ganeti's parameter requirements. The
303 selected OS will be associated with the VM, but not
304 installed. </p> """,
305 'choices': """<p>Template - A re-usable Virtual Machine Template. Check
306 this box if you want to save the options for easy re-use
307 later.</p> <p>Virtual Machine - Start up an instance with
308 the options chosen in this Wizard""",
311 VM_HELP = {
312 'vcpus': """<p>Number of virtual cpus to allocate to this virtual
313 machine.</p> <p><b><i>This will be deducted from the owner's
314 quota.</i></b></p> """,
315 'memory': """<p> Amount of ram to allocate to this virtual machine. If no
316 units are given, megabytes is assumed.
317 </p> <p><b><i>This will
318 be deducted from the owner's quota.</i></b></p> """,
319 'nic_link': """<p>In <b>bridged</b> mode, it specifies the bridge
320 interface to attach this NIC to on the node <i>(e.g.
321 br0)</i>. </p> <p>In <b>routed</b> mode it's intended to
322 differentiate between different routing tables/virtual
323 machine groups (but the meaning is dependant on the network
324 script, see <a
325 href="http://docs.ganeti.org/ganeti/current/man
326 /gnt-cluster.html">
327 gnt-cluster(8)</a> for more details. </p> """,
328 'nic_mac': """<p> This option specifies a MAC address to be associated
329 with the NIC. </p> <p> Any valid MAC address may be used.
330 </p>""",
331 'template_name': """<p> The name of this template. Templates will be
332 sorted by template name when they appear in a list.
333 </p> """,
334 'description': "<p>Optional. A short description of the template.</p>",
337 VM_RENAME_HELP = {
338 'hostname': """<p>Domain name or host name to assign to this virtual
339 machine;
340 e.g. <tt>example.org</tt> or
341 <tt>subdomain.example.org</tt>.</p>""",
342 'ip_check': "<p>Whether to ensure instance's IP address is inactive.</p>",
343 'name_check': """<p> Check the virtual machine DNS name via the
344 resolver <i>(e.g. in DNS or
345 /etc/hosts, depending on your setup)</i>. Since the name
346 check is used to compute the IP address this also
347 enables/disables IP checks <i>(e.g. if the IP is
348 pingable)</i>. </p> <p> This is useful for setups that
349 deploy virtual machines using dynamic DNS and thus the
350 name is not resolvable yet. </p> <p> <b>Use with
351 caution!</b> If left unchecked you may run into name/ip
352 collisions. </p>""",