cloud: ovirt: Don't require all iscsi params to be passed to host (#33133)

This commit is contained in:
Ondra Machacek 2017-11-22 19:47:51 +01:00 committed by René Moser
commit e763146f0c
2 changed files with 12 additions and 10 deletions

View file

@ -499,12 +499,13 @@ def main():
) )
elif state == 'iscsidiscover': elif state == 'iscsidiscover':
host_id = get_id_by_name(hosts_service, module.params['name']) host_id = get_id_by_name(hosts_service, module.params['name'])
iscsi_param = module.params['iscsi']
iscsi_targets = hosts_service.service(host_id).iscsi_discover( iscsi_targets = hosts_service.service(host_id).iscsi_discover(
iscsi=otypes.IscsiDetails( iscsi=otypes.IscsiDetails(
port=int(module.params['iscsi']['port']) if module.params['iscsi']['port'].isdigit() else None, port=int(iscsi_param.get('port', 3260)),
username=module.params['iscsi']['username'], username=iscsi_param.get('username'),
password=module.params['iscsi']['password'], password=iscsi_param.get('password'),
address=module.params['iscsi']['address'], address=iscsi_param.get('address'),
), ),
) )
ret = { ret = {
@ -514,14 +515,15 @@ def main():
} }
elif state == 'iscsilogin': elif state == 'iscsilogin':
host_id = get_id_by_name(hosts_service, module.params['name']) host_id = get_id_by_name(hosts_service, module.params['name'])
iscsi_param = module.params['iscsi']
ret = hosts_module.action( ret = hosts_module.action(
action='iscsi_login', action='iscsi_login',
iscsi=otypes.IscsiDetails( iscsi=otypes.IscsiDetails(
port=int(module.params['iscsi']['port']) if module.params['iscsi']['port'].isdigit() else None, port=int(iscsi_param.get('port', 3260)),
username=module.params['iscsi']['username'], username=iscsi_param.get('username'),
password=module.params['iscsi']['password'], password=iscsi_param.get('password'),
address=module.params['iscsi']['address'], address=iscsi_param.get('address'),
target=module.params['iscsi']['target'], target=iscsi_param.get('target'),
), ),
) )
elif state == 'started': elif state == 'started':

View file

@ -304,7 +304,7 @@ class StorageDomainModule(BaseModule):
otypes.LogicalUnit( otypes.LogicalUnit(
id=lun_id, id=lun_id,
address=storage.get('address'), address=storage.get('address'),
port=storage.get('port', 3260), port=int(storage.get('port', 3260)),
target=storage.get('target'), target=storage.get('target'),
username=storage.get('username'), username=storage.get('username'),
password=storage.get('password'), password=storage.get('password'),