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,
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',
25 from response_map
import ResponseMap
27 INSTANCES
= ['gimager.example.bak', 'gimager2.example.bak']
30 'beparams': {'auto_balance': True, 'memory': 512, 'vcpus': 2},
31 'ctime': 1285799513.4741000,
33 'disk_template': 'plain',
35 'hvparams': {'acpi': True,
37 'cdrom_image_path': '',
38 'disk_cache': 'default',
39 'disk_type': 'paravirtual',
42 'kernel_path': '/root/bzImage',
45 'migration_downtime': 30,
46 'nic_type': 'paravirtual',
47 'root_path': '/dev/vda2',
48 'security_domain': '',
49 'security_model': 'none',
50 'serial_console': True,
53 'use_localtime': False,
55 'vnc_bind_address': '0.0.0.0',
56 'vnc_password_file': '',
59 'vnc_x509_verify': False},
60 'mtime': 1285883187.8692000,
61 'name': 'gimager.example.bak',
62 'network_port': 11165,
63 'nic.bridges': ['br42'],
65 'nic.links': ['br42'],
66 'nic.macs': ['aa:00:00:c5:47:2e'],
67 'nic.modes': ['bridged'],
71 'os': 'image+gentoo-hardened-cf',
72 'pnode': 'gtest1.example.bak',
77 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'}
79 XEN_INSTANCES
= ['hvm.example', 'pvm.example']
87 'ctime': 1304546866.803153,
94 'cdrom_image_path': '',
95 'disk_type': 'paravirtual',
107 'disk_template': 'plain',
111 'blockdev_prefix': 'hd',
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',
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,
144 'os': 'debootstrap+default',
145 'pnode': 'gtest3.example.bak',
148 'status': 'ADMIN_down',
150 'uuid': '4e4241fd-8aa1-4efb-b378-69e658c480f7'
153 'admin_state': False,
155 'auto_balance': True,
159 'ctime': 1304546944.3501799,
165 'kernel_path': '/boot/vmlinuz-2.6-xenU',
166 'root_path': '/dev/xvda1'
168 'custom_nicparams': [
177 'disk_template': 'plain',
180 'blockdev_prefix': 'sd',
181 'bootloader_args': '',
182 'bootloader_path': '',
183 'initrd_path': '/boot/initrd-2.6-xenU',
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,
210 'os': 'debootstrap+default',
211 'pnode': 'gtest3.example.bak',
214 'status': 'ADMIN_down',
216 'uuid': '4b570908-6094-4dab-bbb0-b67aab517128'
219 NODES
= ['gtest1.example.bak', 'gtest2.example.bak', 'gtest3.example.bak']
228 'master_candidate': True,
233 'name': 'gtest1.example.bak',
236 'pinst_list': ['gimager.example.bak', 'gimager3.example.bak'],
242 'sip': '192.168.16.136',
244 'uuid': '1fee760b-b240-4d7a-a514-5c9441877a01'},
252 'master_candidate': True,
257 'name': 'gtest2.example.bak',
266 'sip': '192.168.16.136',
268 'uuid': '1fee760b-b240-4d7a-a514-5c9441877a01'},
271 'ctime': 1272388723.7258999,
276 'master_candidate': False,
279 'mtime': 1293527598.306725,
281 'name': 'gtest3.example.bak',
285 'pip': '10.192.0.179',
290 'sip': '192.168.166.179',
292 'uuid': '5b1001e7-2595-47d4-a1ae-5a6da7b461ca'}
298 'ctime': 1285799513.4741000,
303 'master_candidate': True,
306 'mtime': 1285883187.8692000,
308 'name': 'gtest1.example.bak',
311 'pinst_list': ['gimager.example.bak', 'gimager3.example.bak'],
317 'sip': '192.168.16.136',
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'],
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',
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,
352 'use_localtime': False,
354 'vnc_bind_address': '0.0.0.0',
355 'vnc_password_file': '',
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,
368 'protocol_version': 40,
370 'software_version': '2.2.0~rc1',
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'],
387 'file_storage_dir': '/srv/ganeti/file-storage',
389 'hvparams': {'xen-hvm': {'acpi': True,
390 'blockdev_prefix': 'hd',
392 'cdrom_image_path': '',
394 '/usr/lib/xen/bin/qemu-dm',
395 'disk_type': 'paravirtual',
397 '/usr/lib/xen/boot/hvmloader',
398 'migration_mode': 'non-live',
399 'migration_port': 8002,
400 'nic_type': 'rtl8139',
402 'use_localtime': False,
403 'vnc_bind_address': '0.0.0.0',
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',
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,
426 'prealloc_wipe_disks': False,
427 'primary_ip_version': 4,
428 'protocol_version': 2040000,
430 'software_version': '2.4.1',
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],
443 'ops': [{'OP_ID': 'OP_INSTANCE_SHUTDOWN',
446 'instance_name': 'gimager.example.bak',
448 'opstatus': ['success'],
449 'received_ts': [1291845002, 555722],
450 'start_ts': [1291845002, 595336],
452 'summary': ['INSTANCE_SHUTDOWN(gimager.example.bak)']}
454 JOB_RUNNING
= {'end_ts': [1291845036, 492131],
458 'ops': [{'OP_ID': 'OP_INSTANCE_SHUTDOWN',
461 'instance_name': 'gimager.example.bak',
463 'opstatus': ['running'],
464 'received_ts': [1291845002, 555722],
465 'start_ts': [1291845002, 595336],
467 'summary': ['INSTANCE_SHUTDOWN(gimager.example.bak)']}
469 JOB_ERROR
= {'end_ts': [1291836084, 802444],
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',
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],
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',
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],
504 [1292007953, 699881],
506 ' - INFO: Selected nodes for instance '
507 'gimager3.example.bak via \
508 iallocator hail: gtest2.example.bak'],
510 [1292007953, 979254],
512 '* creating instance disks...'],
514 [1292007954, 276561],
516 'adding instance gimager3.example.bak '
517 'to cluster config'],
519 [1292007954, 357390],
521 ' - INFO: Waiting for instance '
522 'gimager3.example.bak to sync \
525 [1292007954, 496430],
527 " - INFO: Instance gimager3.example.bak's "
528 "disks are in sync."],
530 [1292007954, 498135],
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',
539 'disk_template': 'plain',
540 'disks': [{'size': 2000}],
542 'file_driver': 'loop',
543 'file_storage_dir': None,
544 'force_variant': False,
545 'hvparams': {'boot_order': 'disk',
546 'cdrom_image_path': '',
548 'root_path': '/dev/vda2',
549 'serial_console': True},
551 'iallocator': 'hail',
552 'identify_defaults': False,
553 'instance_name': 'gimager3.example.bak',
559 'os_type': 'image+ubuntu-maverick',
561 'pnode': 'gtest2.example.bak',
563 'source_handshake': None,
564 'source_instance_name': None,
565 'source_x509_ca': None,
569 'wait_for_sync': True}],
570 'opstatus': ['success'],
571 'received_ts': [1292007950, 338883],
572 'start_ts': [1292007950, 367402],
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',
583 'hvparams': {'acpi': True,
584 'boot_order': 'disk',
585 'cdrom_image_path': '',
586 'disk_cache': 'default',
587 'disk_type': 'paravirtual',
590 'kernel_path': '/root/bzImage',
592 'migration_downtime': 30,
593 'nic_type': 'paravirtual',
594 'root_path': '/dev/vda2',
595 'security_domain': '',
596 'security_model': 'none',
597 'serial_console': True,
600 'use_localtime': False,
602 'vnc_bind_address': '0.0.0.0',
603 'vnc_password_file': '',
606 'vnc_x509_verify': False},
607 'mtime': 1285883187.8692000,
608 'name': 'vm1.example.bak',
609 'network_port': 11165,
610 'nic.bridges': ['br42'],
612 'nic.links': ['br42'],
613 'nic.macs': ['aa:00:00:c5:47:2e'],
614 'nic.modes': ['bridged'],
618 'os': 'image+gentoo-hardened-cf',
619 'pnode': 'gtest1.example.bak',
624 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'},
625 {'admin_state': False,
626 'beparams': {'auto_balance': True, 'memory': 512,
628 'ctime': 1285799513.4741089,
629 'disk.sizes': [5120],
630 'disk_template': 'plain',
632 'hvparams': {'acpi': True,
633 'boot_order': 'disk',
634 'cdrom_image_path': '',
635 'disk_cache': 'default',
636 'disk_type': 'paravirtual',
639 'kernel_path': '/root/bzImage',
641 'migration_downtime': 30,
642 'nic_type': 'paravirtual',
643 'root_path': '/dev/vda2',
644 'security_domain': '',
645 'security_model': 'none',
646 'serial_console': True,
649 'use_localtime': False,
651 'vnc_bind_address': '0.0.0.0',
652 'vnc_password_file': '',
655 'vnc_x509_verify': False},
656 'mtime': 1285883187.8692000,
657 'name': 'vm2.example.bak',
658 'network_port': 11165,
659 'nic.bridges': ['br42'],
661 'nic.links': ['br42'],
662 'nic.macs': ['aa:00:00:c5:47:2e'],
663 'nic.modes': ['bridged'],
667 'os': 'image+gentoo-hardened-cf',
668 'pnode': 'gtest1.example.bak',
673 'uuid': '27bac3d3-f634-4dee-aa60-ed2eeb5f2287'}
676 # map nodes response for bulk argument
677 NODES_MAP
= ResponseMap([
679 (((False,), {}), NODES
),
680 (((), {'bulk': False}), NODES
),
681 (((True,), {}), NODES_BULK
),
682 (((), {'bulk': True}), NODES_BULK
),