def register_targets(monitor, options, config): """ Register SCST targets """ for (tid, t) in target.read_all_targets(monitor).items(): try: iscsi_scst.register_target(t) if len(t.volumes()) > 0: scst.add_group("Default_" + t.name()) log_verbose(options, "Target %s registered" % t.name()) except scst.ScstException as e: handle_exception(options, e)
def register_groups(monitor, options, config): """ register SCST groups """ for (group_name, g) in group.read_all_groups(monitor).items(): try: if not group_name == "Default": # The Default group is always there scst.add_group(group_name) for pattern in g.initiator_pattern(): scst.add_initiator_pattern_to_group(pattern, group_name) log_verbose(options, "Group %s registered" % group_name) except scst.ScstException as e: handle_exception(options, e)