The api user and password is required in order to use the API so let's
make these mandatory. The `ceph orch daemon add iscsi` now has them
mandatory:
ceph orch daemon add iscsi <pool> <api_user> <api_password>
If your using apply with a yaml file, the validate_add in the spec now
checks for these too.
Signed-off-by: Matthew Oliver <moliver@suse.com>
(cherry picked from commit
a36165b8dacaae3ab673a3e79f831a0de659341b)
def test_iscsi(self, cephadm_module):
with self._with_host(cephadm_module, 'test'):
ps = PlacementSpec(hosts=['test'], count=1)
- spec = IscsiServiceSpec('name', pool='pool', placement=ps)
+ spec = IscsiServiceSpec('name', pool='pool', api_user='user',
+ api_password='password', placement=ps)
c = cephadm_module.add_iscsi(spec)
[out] = wait(cephadm_module, c)
match_glob(out, "Deployed iscsi.name.* on host 'test'")
)
), CephadmOrchestrator.apply_rgw),
(NFSServiceSpec('name', pool='pool', namespace='namespace'), CephadmOrchestrator.apply_nfs),
- (IscsiServiceSpec('name', pool='pool'), CephadmOrchestrator.apply_iscsi),
+ (IscsiServiceSpec('name', pool='pool', api_user='user', api_password='password'),
+ CephadmOrchestrator.apply_iscsi),
]
)
@mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}'))
@_cli_write_command(
'orch daemon add iscsi',
'name=pool,type=CephString '
+ 'name=api_user,type=CephString '
+ 'name=api_password,type=CephString '
'name=trusted_ip_list,type=CephString,req=false '
'name=placement,type=CephString,req=false',
'Start iscsi daemon(s)')
def _iscsi_add(self,
pool: str,
+ api_user: str,
+ api_password: str,
trusted_ip_list: Optional[str] = None,
placement: Optional[str] = None,
inbuf: Optional[str] = None) -> HandleCommandResult:
spec = IscsiServiceSpec(
service_id='iscsi',
pool=pool,
+ api_user=api_user,
+ api_password=api_password,
trusted_ip_list=trusted_ip_list,
placement=PlacementSpec.from_string(placement),
)
@_cli_write_command(
'orch apply iscsi',
'name=pool,type=CephString '
+ 'name=api_user,type=CephString '
+ 'name=api_password,type=CephString '
'name=trusted_ip_list,type=CephString,req=false '
'name=placement,type=CephString,req=false '
'name=unmanaged,type=CephBool,req=false',
'Scale an iSCSI service')
def _apply_iscsi(self,
pool: str,
+ api_user: str,
+ api_password: str,
trusted_ip_list: Optional[str] = None,
placement: Optional[str] = None,
unmanaged: bool = False,
spec = IscsiServiceSpec(
service_id='iscsi',
pool=pool,
+ api_user=api_user,
+ api_password=api_password,
trusted_ip_list=trusted_ip_list,
placement=PlacementSpec.from_string(placement),
unmanaged=unmanaged,
if not self.api_secure and self.ssl_cert and self.ssl_key:
self.api_secure = True
- def validate_add(self):
- servicespec_validate_add(self)
+ def validate(self):
+ super(IscsiServiceSpec, self).validate()
if not self.pool:
raise ServiceSpecValidationError(
'Cannot add ISCSI: No Pool specified')
+ if not self.api_user:
+ raise ServiceSpecValidationError(
+ 'Cannot add ISCSI: No Api user specified')
+ if not self.api_password:
+ raise ServiceSpecValidationError(
+ 'Cannot add ISCSI: No Api password specified')