]> git.proxmox.com Git - ceph.git/blob - ceph/qa/tasks/mds_pre_upgrade.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / qa / tasks / mds_pre_upgrade.py
1 """
2 Prepare MDS cluster for upgrade.
3 """
4
5 import logging
6 import time
7
8 from tasks.cephfs.filesystem import Filesystem
9
10 log = logging.getLogger(__name__)
11
12 def task(ctx, config):
13 """
14 Prepare MDS cluster for upgrade.
15
16 This task reduces ranks to 1 and stops all standbys.
17 """
18
19 if config is None:
20 config = {}
21 assert isinstance(config, dict), \
22 'snap-upgrade task only accepts a dict for configuration'
23
24 fs = Filesystem(ctx)
25 status = fs.getinfo()
26
27 fs.set_max_mds(1)
28 fs.reach_max_mds()
29
30 # Stop standbys now to minimize time rank 0 is down in subsequent:
31 # tasks:
32 # - ceph.stop: [mds.*]
33 rank0 = fs.get_rank(rank=0, status=status)
34 for daemon in ctx.daemons.iter_daemons_of_role('mds', fs.mon_manager.cluster):
35 if rank0['name'] != daemon.id_:
36 daemon.stop()
37
38 for i in range(1, 10):
39 time.sleep(5) # time for FSMap to update
40 status = fs.getinfo()
41 if len(list(status.get_standbys())) == 0:
42 break
43 assert(len(list(status.get_standbys())) == 0)