Name (type.id) where: type is osd|mon|client|mds id is a base10 int, if type == osd, or a string otherwise Also accept '*'
| 516 | |
| 517 | |
| 518 | class CephName(CephArgtype): |
| 519 | """ |
| 520 | Name (type.id) where: |
| 521 | type is osd|mon|client|mds |
| 522 | id is a base10 int, if type == osd, or a string otherwise |
| 523 | |
| 524 | Also accept '*' |
| 525 | """ |
| 526 | def __init__(self) -> None: |
| 527 | self.nametype: Optional[str] = None |
| 528 | self.nameid: Optional[str] = None |
| 529 | |
| 530 | def valid(self, s, partial=False): |
| 531 | if s == '*': |
| 532 | self.val = s |
| 533 | return |
| 534 | elif s == "mgr": |
| 535 | self.nametype = "mgr" |
| 536 | self.val = s |
| 537 | return |
| 538 | elif s == "mon": |
| 539 | self.nametype = "mon" |
| 540 | self.val = s |
| 541 | return |
| 542 | if s.find('.') == -1: |
| 543 | raise ArgumentFormat('CephName: no . in {0}'.format(s)) |
| 544 | else: |
| 545 | t, i = s.split('.', 1) |
| 546 | if t not in ('osd', 'mon', 'client', 'mds', 'mgr'): |
| 547 | raise ArgumentValid('unknown type ' + t) |
| 548 | if t == 'osd': |
| 549 | if i != '*': |
| 550 | try: |
| 551 | int(i) |
| 552 | except ValueError: |
| 553 | raise ArgumentFormat(f'osd id {i} not integer') |
| 554 | self.nametype = t |
| 555 | self.val = s |
| 556 | self.nameid = i |
| 557 | |
| 558 | def __str__(self): |
| 559 | return '<name (type.id)>' |
| 560 | |
| 561 | |
| 562 | class CephOsdName(CephArgtype): |
no outgoing calls
no test coverage detected