Beispiel #1
0
def unregister_users_direct(options, config):
    """ unregisters the users configured at SCST. This
	function bypasses the information given by the monitor. Therefore
	this function can be used to unregister the users if dedupv1d is not
	available
    """
    try:
        for (tid, t) in iscsi_scst.get_targets().items():
            target_users = iscsi_scst.get_users_in_target(t)
            for u in target_users:
                try:
                    log_verbose(options, "Remove user %s from %s" % (u.name, t.name()))
                    iscsi_scst.rm_user_from_target(u, t)
                except scst.ScstException as e:
                    log_error(options, "Failed to remove user %s from %s: %s" % (u.name, t.name(), str(e)))
    except scst.ScstException as e:
        log_error(options, "Failed to remove users: %s" % (str(e)))
Beispiel #2
0
def unregister_users(monitor, options, config):
    """ unregisters the users of the dedupv1d
    """
    for (user_name, u) in scst_user.read_all_users(monitor).items():
        try:
            for target_name in u.targets():
                t = target.read_target_by_name(monitor, target_name)

                if not iscsi_scst.is_target_registered(t):
                    continue
                if not iscsi_scst.is_user_in_target(user_name, t):
                    continue

                iscsi_scst.rm_user_from_target(u, t)

            log_verbose(options, "User %s unregistered" % user_name)
        except scst.ScstException as e:
            handle_exception(options, e)