MCPcopy Create free account
hub / github.com/ceph/ceph / setUp

Method setUp

qa/tasks/cephfs/cephfs_test_case.py:121–207  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

119 self.run_ceph_cmd("osd", "blacklist", "rm", addr)
120
121 def setUp(self):
122 super(CephFSTestCase, self).setUp()
123
124 self.config_set('mon', 'mon_allow_pool_delete', True)
125
126 if len(self.mds_cluster.mds_ids) < self.MDSS_REQUIRED:
127 self.skipTest("Only have {0} MDSs, require {1}".format(
128 len(self.mds_cluster.mds_ids), self.MDSS_REQUIRED
129 ))
130
131 if len(self.mounts) < self.CLIENTS_REQUIRED:
132 self.skipTest("Only have {0} clients, require {1}".format(
133 len(self.mounts), self.CLIENTS_REQUIRED
134 ))
135
136 if self.REQUIRE_ONE_CLIENT_REMOTE:
137 if self.mounts[0].client_remote.hostname in self.mds_cluster.get_mds_hostnames():
138 self.skipTest("Require first client to be on separate server from MDSs")
139
140 # Create friendly mount_a, mount_b attrs
141 for i in range(0, self.CLIENTS_REQUIRED):
142 setattr(self, "mount_{0}".format(chr(ord('a') + i)), self.mounts[i])
143
144 self.mds_cluster.clear_firewall()
145
146 # Unmount all clients, we are about to blow away the filesystem
147 for mount in self.mounts:
148 if mount.is_mounted():
149 mount.umount_wait(force=True)
150 self._save_mount_details()
151
152 # To avoid any issues with e.g. unlink bugs, we destroy and recreate
153 # the filesystem rather than just doing a rm -rf of files
154 self.mds_cluster.delete_all_filesystems()
155 self.mds_cluster.mds_restart() # to reset any run-time configs, etc.
156 self.fs = None # is now invalid!
157 self.backup_fs = None
158 self.recovery_fs = None
159
160 self._remove_blocklist()
161
162 client_mount_ids = [m.client_id for m in self.mounts]
163 # In case there were any extra auth identities around from a previous
164 # test, delete them
165 for entry in self.auth_list():
166 ent_type, ent_id = entry['entity'].split(".")
167 if ent_type == "client" and ent_id not in client_mount_ids and not (ent_id == "admin" or ent_id[:6] == 'mirror'):
168 self.run_ceph_cmd("auth", "del", entry['entity'])
169
170 if self.REQUIRE_FILESYSTEM:
171 self.fs = self.mds_cluster.newfs(create=True)
172
173 # In case some test messed with auth caps, reset them
174 for client_id in client_mount_ids:
175 cmd = ['auth', 'caps', f'client.{client_id}', 'mon','allow r',
176 'osd', f'allow rw tag cephfs data={self.fs.name}',
177 'mds', 'allow']
178

Callers

nothing calls this directly

Calls 15

_save_mount_detailsMethod · 0.95
_remove_blocklistMethod · 0.95
auth_listMethod · 0.95
get_mds_hostnamesMethod · 0.80
mds_restartMethod · 0.80
run_ceph_cmdMethod · 0.80
get_ceph_cmd_resultMethod · 0.80
wait_for_daemonsMethod · 0.80
mount_waitMethod · 0.80
mds_asokMethod · 0.80
listFunction · 0.50
setFunction · 0.50

Tested by

no test coverage detected