Validate entire job, not just op
[ganeti_webmgr.git] / ganeti_web / util / proxy / constants.py
blobd27a4cc69f9bb3f2a0b76085cdcac43a9d14eff1
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.
19 __all__ = ['INSTANCE', 'INSTANCES', 'XEN_PVM_INSTANCE', 'XEN_HVM_INSTANCE',
20 'XEN_INSTANCES', 'NODE', 'NODES', 'NODES_BULK', 'INFO', 'XEN_INFO',
21 'OPERATING_SYSTEMS', 'XEN_OPERATING_SYSTEMS', 'JOB', 'JOB_RUNNING',
22 'JOB_ERROR', 'JOB_DELETE_SUCCESS', 'JOB_LOG', 'INSTANCES_BULK',
23 'NODES_MAP']
25 from response_map import ResponseMap
27 INSTANCES = ['gimager.example.bak', 'gimager2.example.bak']
28 INSTANCE = {
29 'admin_state': False,
30 'beparams': {'auto_balance': True, 'memory': 512, 'vcpus': 2},
31 'ctime': 1285799513.4741000,
32 'disk.sizes': [5120],
33 'disk_template': 'plain',
34 'disk_usage': 5120,
35 'hvparams': {'acpi': True,
36 'boot_order': 'disk',
37 'cdrom_image_path': '',
38 'disk_cache': 'default',
39 'disk_type': 'paravirtual',
40 'initrd_path': '',
41 'kernel_args': 'ro',
42 'kernel_path': '/root/bzImage',
43 'kvm_flag': '',
44 'mem_path': '',
45 'migration_downtime': 30,
46 'nic_type': 'paravirtual',
47 'root_path': '/dev/vda2',
48 'security_domain': '',
49 'security_model': 'none',
50 'serial_console': True,
51 'usb_mouse': '',
52 'use_chroot': False,
53 'use_localtime': False,
54 'vhost_net': False,
55 'vnc_bind_address': '0.0.0.0',
56 'vnc_password_file': '',
57 'vnc_tls': False,
58 'vnc_x509_path': '',
59 'vnc_x509_verify': False},
60 'mtime': 1285883187.8692000,
61 'name': 'gimager.example.bak',
62 'network_port': 11165,
63 'nic.bridges': ['br42'],
64 'nic.ips': [None],
65 'nic.links': ['br42'],
66 'nic.macs': ['aa:00:00:c5:47:2e'],
67 'nic.modes': ['bridged'],
68 'oper_ram': '-',
69 'oper_state': False,
70 'oper_vcpus': '-',
71 'os': 'image+gentoo-hardened-cf',
72 'pnode': 'gtest1.example.bak',
73 'serial_no': 8,
74 'snodes': [],
75 'status': 'running',
76 'tags': [],
77 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'}
79 XEN_INSTANCES = ['hvm.example', 'pvm.example']
80 XEN_HVM_INSTANCE = {
81 'admin_state': False,
82 'beparams': {
83 'auto_balance': True,
84 'memory': 512,
85 'vcpus': 2
87 'ctime': 1304546866.803153,
88 'custom_beparams': {
89 'memory': 512,
90 'vcpus': 2
92 'custom_hvparams': {
93 'boot_order': 'c',
94 'cdrom_image_path': '',
95 'disk_type': 'paravirtual',
96 'nic_type': 'rtl8139'
98 'custom_nicparams': [
100 'link': 'br42',
101 'mode': 'bridged'
104 'disk.sizes': [
105 1024
107 'disk_template': 'plain',
108 'disk_usage': 1024,
109 'hvparams': {
110 'acpi': True,
111 'blockdev_prefix': 'hd',
112 'boot_order': 'c',
113 'cdrom_image_path': '',
114 'device_model': '/usr/lib/xen/bin/qemu-dm',
115 'disk_type': 'paravirtual',
116 'kernel_path': '/usr/lib/xen/boot/hvmloader',
117 'nic_type': 'rtl8139',
118 'pae': True,
119 'use_localtime': False,
120 'vnc_bind_address': '0.0.0.0',
121 'vnc_password_file': '/etc/ganeti/vnc-cluster-password'
123 'mtime': 1305055017.671782,
124 'name': 'hvm.example',
125 'network_port': 11003,
126 'nic.bridges': [
127 'br42'
129 'nic.ips': [
130 None
132 'nic.links': [
133 'br42'
135 'nic.macs': [
136 'aa:00:00:c5:47:2e'
138 'nic.modes': [
139 'bridged'
141 'oper_ram': None,
142 'oper_state': False,
143 'oper_vcpus': None,
144 'os': 'debootstrap+default',
145 'pnode': 'gtest3.example.bak',
146 'serial_no': 5,
147 'snodes': [],
148 'status': 'ADMIN_down',
149 'tags': [],
150 'uuid': '4e4241fd-8aa1-4efb-b378-69e658c480f7'
152 XEN_PVM_INSTANCE = {
153 'admin_state': False,
154 'beparams': {
155 'auto_balance': True,
156 'memory': 512,
157 'vcpus': 2
159 'ctime': 1304546944.3501799,
160 'custom_beparams': {
161 'memory': 512,
162 'vcpus': 2
164 'custom_hvparams': {
165 'kernel_path': '/boot/vmlinuz-2.6-xenU',
166 'root_path': '/dev/xvda1'
168 'custom_nicparams': [
170 'link': 'br42',
171 'mode': 'bridged'
174 'disk.sizes': [
175 1024
177 'disk_template': 'plain',
178 'disk_usage': 1024,
179 'hvparams': {
180 'blockdev_prefix': 'sd',
181 'bootloader_args': '',
182 'bootloader_path': '',
183 'initrd_path': '/boot/initrd-2.6-xenU',
184 'kernel_args': 'ro',
185 'kernel_path': '/boot/vmlinuz-2.6-xenU',
186 'root_path': '/dev/xvda1',
187 'use_bootloader': False
189 'mtime': 1305055018.4669311,
190 'name': 'pvm.example',
191 'network_port': None,
192 'nic.bridges': [
193 'br42'
195 'nic.ips': [
196 None
198 'nic.links': [
199 'br42'
201 'nic.macs': [
202 'aa:00:00:c5:47:2e'
204 'nic.modes': [
205 'bridged'
207 'oper_ram': None,
208 'oper_state': False,
209 'oper_vcpus': None,
210 'os': 'debootstrap+default',
211 'pnode': 'gtest3.example.bak',
212 'serial_no': 5,
213 'snodes': [],
214 'status': 'ADMIN_down',
215 'tags': [],
216 'uuid': '4b570908-6094-4dab-bbb0-b67aab517128'
219 NODES = ['gtest1.example.bak', 'gtest2.example.bak', 'gtest3.example.bak']
220 NODES_BULK = [
221 {'cnodes': 1,
222 'csockets': 1,
223 'ctime': None,
224 'ctotal': 2,
225 'dfree': 56092,
226 'drained': False,
227 'dtotal': 66460,
228 'master_candidate': True,
229 'mfree': 1187,
230 'mnode': 586,
231 'mtime': None,
232 'mtotal': 1997,
233 'name': 'gtest1.example.bak',
234 'offline': False,
235 'pinst_cnt': 2,
236 'pinst_list': ['gimager.example.bak', 'gimager3.example.bak'],
237 'pip': '10.1.0.136',
238 'role': 'M',
239 'serial_no': 1,
240 'sinst_cnt': 0,
241 'sinst_list': [],
242 'sip': '192.168.16.136',
243 'tags': [],
244 'uuid': '1fee760b-b240-4d7a-a514-5c9441877a01'},
245 {'cnodes': 1,
246 'csockets': 1,
247 'ctime': None,
248 'ctotal': 2,
249 'dfree': 56092,
250 'drained': False,
251 'dtotal': 66460,
252 'master_candidate': True,
253 'mfree': 1187,
254 'mnode': 586,
255 'mtime': None,
256 'mtotal': 1997,
257 'name': 'gtest2.example.bak',
258 'offline': False,
259 'pinst_cnt': 0,
260 'pinst_list': [],
261 'pip': '10.1.0.136',
262 'role': 'M',
263 'serial_no': 1,
264 'sinst_cnt': 0,
265 'sinst_list': [],
266 'sip': '192.168.16.136',
267 'tags': [],
268 'uuid': '1fee760b-b240-4d7a-a514-5c9441877a01'},
269 {'cnodes': None,
270 'csockets': None,
271 'ctime': 1272388723.7258999,
272 'ctotal': None,
273 'dfree': None,
274 'drained': False,
275 'dtotal': None,
276 'master_candidate': False,
277 'mfree': None,
278 'mnode': None,
279 'mtime': 1293527598.306725,
280 'mtotal': None,
281 'name': 'gtest3.example.bak',
282 'offline': True,
283 'pinst_cnt': 0,
284 'pinst_list': [],
285 'pip': '10.192.0.179',
286 'role': 'O',
287 'serial_no': 2,
288 'sinst_cnt': 0,
289 'sinst_list': [],
290 'sip': '192.168.166.179',
291 'tags': [],
292 'uuid': '5b1001e7-2595-47d4-a1ae-5a6da7b461ca'}
296 NODE = {'cnodes': 1,
297 'csockets': 3,
298 'ctime': 1285799513.4741000,
299 'ctotal': 2,
300 'dfree': 2222,
301 'drained': False,
302 'dtotal': 6666,
303 'master_candidate': True,
304 'mfree': 1111,
305 'mnode': 586,
306 'mtime': 1285883187.8692000,
307 'mtotal': 9999,
308 'name': 'gtest1.example.bak',
309 'offline': False,
310 'pinst_cnt': 2,
311 'pinst_list': ['gimager.example.bak', 'gimager3.example.bak'],
312 'pip': '10.1.0.136',
313 'role': 'M',
314 'serial_no': 1,
315 'sinst_cnt': 0,
316 'sinst_list': [],
317 'sip': '192.168.16.136',
318 'tags': [],
319 'uuid': '1fee760b-b240-4d7a-a514-5c9441877a01'}
320 INFO = {'architecture': ['64bit', 'x86_64'],
321 'beparams': {'default': {'auto_balance': True,
322 'memory': 512, 'vcpus': 2}},
323 'candidate_pool_size': 10,
324 'config_version': 2020000,
325 'ctime': 1270685309.818239,
326 'default_hypervisor': 'kvm',
327 'default_iallocator': '',
328 'drbd_usermode_helper': None,
329 'enabled_hypervisors': ['kvm'],
330 'export_version': 0,
331 'file_storage_dir': '/var/lib/ganeti-storage/file',
332 'hvparams': {'kvm': {'acpi': True,
333 'boot_order': 'disk',
334 'cdrom_image_path': '',
335 'disk_cache': 'default',
336 'disk_type': 'paravirtual',
337 'initrd_path': '',
338 'kernel_args': 'ro',
339 'kernel_path': '',
340 'kvm_flag': '',
341 'migration_bandwidth': 32,
342 'migration_downtime': 30,
343 'migration_mode': 'live',
344 'migration_port': 8102,
345 'nic_type': 'paravirtual',
346 'root_path': '/dev/vda2',
347 'security_domain': '',
348 'security_model': 'none',
349 'serial_console': True,
350 'usb_mouse': '',
351 'use_chroot': False,
352 'use_localtime': False,
353 'vhost_net': False,
354 'vnc_bind_address': '0.0.0.0',
355 'vnc_password_file': '',
356 'vnc_tls': False,
357 'vnc_x509_path': '',
358 'vnc_x509_verify': False}},
359 'maintain_node_health': False,
360 'master': 'gtest1.example.bak',
361 'master_netdev': 'br42',
362 'mtime': 1283552454.2998919,
363 'name': 'ganeti-test.example.bak',
364 'nicparams': {'default': {'link': 'br42', 'mode': 'bridged'}},
365 'os_api_version': 20,
366 'os_hvp': {},
367 'osparams': {},
368 'protocol_version': 40,
369 'reserved_lvs': [],
370 'software_version': '2.2.0~rc1',
371 'tags': [],
372 'uid_pool': [],
373 'uuid': 'a22576ba-9158-4336-8590-a497306f84b9',
374 'volume_group_name': 'ganeti'}
375 XEN_INFO = {'architecture': ['64bit', 'x86_64'],
376 'beparams': {'default': {'auto_balance': True,
377 'memory': 512, 'vcpus': 2}},
378 'blacklisted_os': [],
379 'candidate_pool_size': 10,
380 'config_version': 2040000,
381 'ctime': 1301603254.797797,
382 'default_hypervisor': 'xen-pvm',
383 'default_iallocator': '',
384 'drbd_usermode_helper': '',
385 'enabled_hypervisors': ['xen-pvm', 'xen-hvm'],
386 'export_version': 0,
387 'file_storage_dir': '/srv/ganeti/file-storage',
388 'hidden_os': [],
389 'hvparams': {'xen-hvm': {'acpi': True,
390 'blockdev_prefix': 'hd',
391 'boot_order': 'cd',
392 'cdrom_image_path': '',
393 'device_model':
394 '/usr/lib/xen/bin/qemu-dm',
395 'disk_type': 'paravirtual',
396 'kernel_path':
397 '/usr/lib/xen/boot/hvmloader',
398 'migration_mode': 'non-live',
399 'migration_port': 8002,
400 'nic_type': 'rtl8139',
401 'pae': True,
402 'use_localtime': False,
403 'vnc_bind_address': '0.0.0.0',
404 'vnc_password_file':
405 '/etc/ganeti/vnc-cluster-password'},
406 'xen-pvm': {'blockdev_prefix': 'sd',
407 'bootloader_args': '',
408 'bootloader_path': '',
409 'initrd_path': '/boot/initrd-2.6-xenU',
410 'kernel_args': 'ro',
411 'kernel_path': '/boot/vmlinuz-2.6-xenU',
412 'migration_mode': 'live',
413 'migration_port': 8002,
414 'root_path': '/dev/xvda1',
415 'use_bootloader': False}},
416 'maintain_node_health': False,
417 'master': 'gtest3.example.bak',
418 'master_netdev': 'br42',
419 'mtime': 1301954099.043431,
420 'name': 'ganeti-xen.example.bak',
421 'ndparams': {'oob_program': ''},
422 'nicparams': {'default': {'link': 'br42', 'mode': 'bridged'}},
423 'os_api_version': 20,
424 'os_hvp': {},
425 'osparams': {},
426 'prealloc_wipe_disks': False,
427 'primary_ip_version': 4,
428 'protocol_version': 2040000,
429 'reserved_lvs': [],
430 'software_version': '2.4.1',
431 'tags': [],
432 'uid_pool': [],
433 'uuid': '355c4147-bbcd-4213-9e84-7095343b1595',
434 'volume_group_name': 'ganeti'}
436 OPERATING_SYSTEMS = ['image+debian-osgeo', 'image+ubuntu-lucid']
437 XEN_OPERATING_SYSTEMS = ['debootstrap+default', 'image+default']
439 JOB = {'end_ts': [1291845036, 492131],
440 'id': '1',
441 'oplog': [[]],
442 'opresult': [None],
443 'ops': [{'OP_ID': 'OP_INSTANCE_SHUTDOWN',
444 'debug_level': 0,
445 'dry_run': False,
446 'instance_name': 'gimager.example.bak',
447 'timeout': 120}],
448 'opstatus': ['success'],
449 'received_ts': [1291845002, 555722],
450 'start_ts': [1291845002, 595336],
451 'status': 'success',
452 'summary': ['INSTANCE_SHUTDOWN(gimager.example.bak)']}
454 JOB_RUNNING = {'end_ts': [1291845036, 492131],
455 'id': '1',
456 'oplog': [[]],
457 'opresult': [None],
458 'ops': [{'OP_ID': 'OP_INSTANCE_SHUTDOWN',
459 'debug_level': 0,
460 'dry_run': False,
461 'instance_name': 'gimager.example.bak',
462 'timeout': 120}],
463 'opstatus': ['running'],
464 'received_ts': [1291845002, 555722],
465 'start_ts': [1291845002, 595336],
466 'status': 'running',
467 'summary': ['INSTANCE_SHUTDOWN(gimager.example.bak)']}
469 JOB_ERROR = {'end_ts': [1291836084, 802444],
470 'id': '1',
471 'oplog': [[]],
472 'opresult': [['OpExecError',
473 ['Could not reboot instance: \
474 Cannot reboot instance gimager.example.bak \
475 that is not running']]],
476 'ops': [{'OP_ID': 'OP_INSTANCE_REBOOT',
477 'debug_level': 0,
478 'dry_run': False,
479 'ignore_secondaries': False,
480 'instance_name': 'gimager.example.bak',
481 'reboot_type': 'hard',
482 'shutdown_timeout': 120}],
483 'opstatus': ['error'],
484 'received_ts': [1291836084, 639295],
485 'start_ts': [1291836084, 673097],
486 'status': 'error',
487 'summary': ['INSTANCE_REBOOT(gimager.example.bak)']}
488 JOB_DELETE_SUCCESS = {'status': 'success',
489 'ops': [{'dry_run': False,
490 'instance_name': 'test.gwm.example.org',
491 'debug_level': 0,
492 'OP_ID': 'OP_INSTANCE_REMOVE',
493 'ignore_failures': False, 'shutdown_timeout': 120}],
494 'end_ts': [1295224140, 247101],
495 'start_ts': [1295224139, 507156],
496 'summary': ['INSTANCE_REMOVE(kennym4.gwm.example.org)'],
497 'received_ts': [1295224139, 489597], 'opresult': [None],
498 'opstatus': ['success'],
499 'oplog': [[]], 'id': '17050'}
501 JOB_LOG = {'end_ts': [1292007990, 759365],
502 'id': '121061',
503 'oplog': [[[1,
504 [1292007953, 699881],
505 'message',
506 ' - INFO: Selected nodes for instance '
507 'gimager3.example.bak via \
508 iallocator hail: gtest2.example.bak'],
510 [1292007953, 979254],
511 'message',
512 '* creating instance disks...'],
514 [1292007954, 276561],
515 'message',
516 'adding instance gimager3.example.bak '
517 'to cluster config'],
519 [1292007954, 357390],
520 'message',
521 ' - INFO: Waiting for instance '
522 'gimager3.example.bak to sync \
523 disks.'],
525 [1292007954, 496430],
526 'message',
527 " - INFO: Instance gimager3.example.bak's "
528 "disks are in sync."],
530 [1292007954, 498135],
531 'message',
532 '* running the instance OS create scripts...'],
533 [7, [1292007990, 267330],
534 'message', '* starting instance...']]],
535 'opresult': [['gtest2.example.bak']],
536 'ops': [{'OP_ID': 'OP_INSTANCE_CREATE',
537 'beparams': {},
538 'debug_level': 0,
539 'disk_template': 'plain',
540 'disks': [{'size': 2000}],
541 'dry_run': False,
542 'file_driver': 'loop',
543 'file_storage_dir': None,
544 'force_variant': False,
545 'hvparams': {'boot_order': 'disk',
546 'cdrom_image_path': '',
547 'kernel_path': '',
548 'root_path': '/dev/vda2',
549 'serial_console': True},
550 'hypervisor': 'kvm',
551 'iallocator': 'hail',
552 'identify_defaults': False,
553 'instance_name': 'gimager3.example.bak',
554 'ip_check': True,
555 'mode': 'create',
556 'name_check': True,
557 'nics': [{}],
558 'no_install': None,
559 'os_type': 'image+ubuntu-maverick',
560 'osparams': {},
561 'pnode': 'gtest2.example.bak',
562 'snode': None,
563 'source_handshake': None,
564 'source_instance_name': None,
565 'source_x509_ca': None,
566 'src_node': None,
567 'src_path': None,
568 'start': True,
569 'wait_for_sync': True}],
570 'opstatus': ['success'],
571 'received_ts': [1292007950, 338883],
572 'start_ts': [1292007950, 367402],
573 'status': 'success',
574 'summary': ['INSTANCE_CREATE(gimager3.example.bak)']}
576 INSTANCES_BULK = [{'admin_state': False,
577 'beparams': {'auto_balance': True,
578 'memory': 512, 'vcpus': 2},
579 'ctime': 1285799513.4741089,
580 'disk.sizes': [5120],
581 'disk_template': 'plain',
582 'disk_usage': 5120,
583 'hvparams': {'acpi': True,
584 'boot_order': 'disk',
585 'cdrom_image_path': '',
586 'disk_cache': 'default',
587 'disk_type': 'paravirtual',
588 'initrd_path': '',
589 'kernel_args': 'ro',
590 'kernel_path': '/root/bzImage',
591 'kvm_flag': '',
592 'migration_downtime': 30,
593 'nic_type': 'paravirtual',
594 'root_path': '/dev/vda2',
595 'security_domain': '',
596 'security_model': 'none',
597 'serial_console': True,
598 'usb_mouse': '',
599 'use_chroot': False,
600 'use_localtime': False,
601 'vhost_net': False,
602 'vnc_bind_address': '0.0.0.0',
603 'vnc_password_file': '',
604 'vnc_tls': False,
605 'vnc_x509_path': '',
606 'vnc_x509_verify': False},
607 'mtime': 1285883187.8692000,
608 'name': 'vm1.example.bak',
609 'network_port': 11165,
610 'nic.bridges': ['br42'],
611 'nic.ips': [None],
612 'nic.links': ['br42'],
613 'nic.macs': ['aa:00:00:c5:47:2e'],
614 'nic.modes': ['bridged'],
615 'oper_ram': '-',
616 'oper_state': False,
617 'oper_vcpus': '-',
618 'os': 'image+gentoo-hardened-cf',
619 'pnode': 'gtest1.example.bak',
620 'serial_no': 8,
621 'snodes': [],
622 'status': 'running',
623 'tags': [],
624 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'},
625 {'admin_state': False,
626 'beparams': {'auto_balance': True, 'memory': 512,
627 'vcpus': 2},
628 'ctime': 1285799513.4741089,
629 'disk.sizes': [5120],
630 'disk_template': 'plain',
631 'disk_usage': 5120,
632 'hvparams': {'acpi': True,
633 'boot_order': 'disk',
634 'cdrom_image_path': '',
635 'disk_cache': 'default',
636 'disk_type': 'paravirtual',
637 'initrd_path': '',
638 'kernel_args': 'ro',
639 'kernel_path': '/root/bzImage',
640 'kvm_flag': '',
641 'migration_downtime': 30,
642 'nic_type': 'paravirtual',
643 'root_path': '/dev/vda2',
644 'security_domain': '',
645 'security_model': 'none',
646 'serial_console': True,
647 'usb_mouse': '',
648 'use_chroot': False,
649 'use_localtime': False,
650 'vhost_net': False,
651 'vnc_bind_address': '0.0.0.0',
652 'vnc_password_file': '',
653 'vnc_tls': False,
654 'vnc_x509_path': '',
655 'vnc_x509_verify': False},
656 'mtime': 1285883187.8692000,
657 'name': 'vm2.example.bak',
658 'network_port': 11165,
659 'nic.bridges': ['br42'],
660 'nic.ips': [None],
661 'nic.links': ['br42'],
662 'nic.macs': ['aa:00:00:c5:47:2e'],
663 'nic.modes': ['bridged'],
664 'oper_ram': '-',
665 'oper_state': False,
666 'oper_vcpus': '-',
667 'os': 'image+gentoo-hardened-cf',
668 'pnode': 'gtest1.example.bak',
669 'serial_no': 8,
670 'snodes': [],
671 'status': 'running',
672 'tags': [],
673 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'}
676 # map nodes response for bulk argument
677 NODES_MAP = ResponseMap([
678 (((), {}), NODES),
679 (((False,), {}), NODES),
680 (((), {'bulk': False}), NODES),
681 (((True,), {}), NODES_BULK),
682 (((), {'bulk': True}), NODES_BULK),