Handle the creation and removal of a ceph cluster. On startup: Create directories needed for the cluster. Create remote journals for all osds. Create and set keyring. Copy the monmap to the test systems. Setup mon nodes. Setup mds nodes.
(ctx, config)
| 681 | |
| 682 | @contextlib.contextmanager |
| 683 | def cluster(ctx, config): |
| 684 | """ |
| 685 | Handle the creation and removal of a ceph cluster. |
| 686 | |
| 687 | On startup: |
| 688 | Create directories needed for the cluster. |
| 689 | Create remote journals for all osds. |
| 690 | Create and set keyring. |
| 691 | Copy the monmap to the test systems. |
| 692 | Setup mon nodes. |
| 693 | Setup mds nodes. |
| 694 | Mkfs osd nodes. |
| 695 | Add keyring information to monmaps |
| 696 | Mkfs mon nodes. |
| 697 | |
| 698 | On exit: |
| 699 | If errors occurred, extract a failure message and store in ctx.summary. |
| 700 | Unmount all test files and temporary journaling files. |
| 701 | Save the monitor information and archive all ceph logs. |
| 702 | Cleanup the keyring setup, and remove all monitor map and data files left over. |
| 703 | |
| 704 | :param ctx: Context |
| 705 | :param config: Configuration |
| 706 | """ |
| 707 | if ctx.config.get('use_existing_cluster', False) is True: |
| 708 | log.info("'use_existing_cluster' is true; skipping cluster creation") |
| 709 | yield |
| 710 | |
| 711 | testdir = teuthology.get_testdir(ctx) |
| 712 | cluster_name = config['cluster'] |
| 713 | data_dir = '{tdir}/{cluster}.data'.format(tdir=testdir, cluster=cluster_name) |
| 714 | log.info('Creating ceph cluster %s...', cluster_name) |
| 715 | log.info('config %s', config) |
| 716 | log.info('ctx.config %s', ctx.config) |
| 717 | run.wait( |
| 718 | ctx.cluster.run( |
| 719 | args=[ |
| 720 | 'install', '-d', '-m0755', '--', |
| 721 | data_dir, |
| 722 | ], |
| 723 | wait=False, |
| 724 | ) |
| 725 | ) |
| 726 | |
| 727 | run.wait( |
| 728 | ctx.cluster.run( |
| 729 | args=[ |
| 730 | 'sudo', |
| 731 | 'install', '-d', '-m0777', '--', '/var/run/ceph', |
| 732 | ], |
| 733 | wait=False, |
| 734 | ) |
| 735 | ) |
| 736 | |
| 737 | devs_to_clean = {} |
| 738 | remote_to_roles_to_devs = {} |
| 739 | osds = ctx.cluster.only(teuthology.is_type('osd', cluster_name)) |
| 740 | for remote, roles_for_host in osds.remotes.items(): |
no test coverage detected