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

Function parse_client_feature_range

qa/tasks/ceph_fuse.py:191–217  ·  view source on GitHub ↗
(client_feature_range)

Source from the content-addressed store, hash-verified

189 FuseMount.cleanup_stale_netnses_and_bridge(remote)
190
191 def parse_client_feature_range(client_feature_range):
192 def intify(val):
193 try:
194 return int(val)
195 except ValueError:
196 log.warn(f'failed to decode feature bit {val}')
197 raise
198 feature_bits = []
199 pvalue = re.compile(r'(\d+)')
200 prange = re.compile(r'\[(\d+)\-(\d+)\]')
201 if (isinstance(client_feature_range, int)):
202 # everything upto (and including) this feature bit
203 feature_bits.extend(range(0, client_feature_range+1))
204 elif isinstance(client_feature_range, str):
205 for feat in client_feature_range.split(','):
206 m = pvalue.match(feat)
207 if m:
208 feature_bits.append(intify(m.group(1)))
209 continue
210 m = prange.match(feat)
211 if m:
212 feature_bits.extend(range(intify(m.group(1)), intify(m.group(2))+1))
213 continue
214 raise ValueError(f'Invalid feature range or value "{feat}"')
215 else:
216 raise TypeError("client_feature_range must be of type int or str")
217 return sorted(set(feature_bits))
218
219 # Mount any clients we have been asked to (default to mount all)
220 log.info('Mounting ceph-fuse clients...')

Callers 1

taskFunction · 0.85

Calls 9

intifyFunction · 0.85
sortedFunction · 0.85
extendMethod · 0.80
setFunction · 0.50
compileMethod · 0.45
splitMethod · 0.45
matchMethod · 0.45
appendMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected