diff --git a/rtslib/target.py b/rtslib/target.py index 4115dc6..540b152 100644 --- a/rtslib/target.py +++ b/rtslib/target.py @@ -1191,6 +1191,7 @@ def __init__(self, fabric_module, wwn=None, mode='any'): if wwn is not None: wwn = str(wwn).strip() + wwn = wwn.replace("_","-") elif fabric_module.spec['wwn_list']: existing_wwns = set([child.wwn for child in fabric_module.targets]) free_wwns = fabric_module.spec['wwn_list'] - existing_wwns diff --git a/rtslib/utils.py b/rtslib/utils.py index 6974235..bec7e1d 100644 --- a/rtslib/utils.py +++ b/rtslib/utils.py @@ -519,7 +519,8 @@ def generate_wwn(wwn_type): if wwn_type == 'unit_serial': return str(uuid.uuid4()) elif wwn_type == 'iqn': - localname = socket.gethostname().split(".")[0] + localname_raw = socket.gethostname().split(".")[0] + localname = localname_raw.replace("_","-") localarch = os.uname()[4].replace("_","") prefix = "iqn.2003-01.org.linux-iscsi.%s.%s" % (localname, localarch) prefix = prefix.strip().lower()