Decrease the number of pgs in a pool
(self, pool_name, by, min_pgs)
| 2398 | return True |
| 2399 | |
| 2400 | def contract_pool(self, pool_name, by, min_pgs): |
| 2401 | """ |
| 2402 | Decrease the number of pgs in a pool |
| 2403 | """ |
| 2404 | with self.lock: |
| 2405 | self.log('contract_pool %s by %s min %s' % ( |
| 2406 | pool_name, str(by), str(min_pgs))) |
| 2407 | assert isinstance(pool_name, str) |
| 2408 | assert isinstance(by, int) |
| 2409 | assert pool_name in self.pools |
| 2410 | if self.get_num_creating() > 0: |
| 2411 | self.log('too many creating') |
| 2412 | return False |
| 2413 | proj = self.pools[pool_name] - by |
| 2414 | if proj < min_pgs: |
| 2415 | self.log('would drop below min_pgs, proj %d, currently %d' % (proj,self.pools[pool_name],)) |
| 2416 | return False |
| 2417 | self.log("decrease pool size by %d" % (by,)) |
| 2418 | new_pg_num = self.pools[pool_name] - by |
| 2419 | self.set_pool_property(pool_name, "pg_num", new_pg_num) |
| 2420 | self.pools[pool_name] = new_pg_num |
| 2421 | return True |
| 2422 | |
| 2423 | def stop_pg_num_changes(self): |
| 2424 | """ |
no test coverage detected