def get_user_in_target(self, target_name): """ gets all user in a target. The data is gathered over the target monitor """ t = target.read_target_by_name(self.monitor, target_name) if not t: return None return iscsi_scst.get_users_in_target(t)
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)))