def pause_raid_group_media_scan(session, raid_id, return_type=None, **kwargs): """ Pauses a currently running RAID group media scan. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) path = '/api/raid_groups/{0}/pause_scrub.json'.format(raid_id) return session.post_api(path=path, return_type=return_type, **kwargs)
def get_raid_group(session, raid_id, return_type=None, **kwargs): """ Retrieves details for a single RAID group. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) path = '/api/raid_groups/{0}.json'.format(raid_id) return session.get_api(path=path, return_type=return_type, **kwargs)
def start_raid_group_media_scan(session, raid_id, return_type=None, **kwargs): """ Starts a media scan that will repair any inconsistencies with parity. Only valid for RAID5 and RAID6. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) path = '/api/raid_groups/{0}/scrub.json'.format(raid_id) return session.post_api(path=path, return_type=return_type, **kwargs)
def repair_raid_group(session, raid_id, return_type=None, **kwargs): """ Repairs a degraded RAID group with an available drive. This function will first attempt to detect if there are any available drives, and will only proceed if one is found. This function should be used with caution. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The drive 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) path = '/api/raid_groups/{0}/repair.json'.format(raid_id) return session.post_api(path=path, return_type=return_type, **kwargs)
def add_hot_spare_to_raid_group(session, raid_id, drive_id, force='NO', return_type=None, **kwargs): """ Attaches a drive as a hot spare to an existing RAID group, as identified by the drive_id attribute. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type drive_id: str :param drive_id: The drive 'name' value as returned by get_all_drives. For example: 'volume-00002a73'. Required. :type force: str :param force: If set to 'YES', ignore non-critical warnings and force the VPSA to accept the request. If 'NO', return message on warning and abort. Set to 'NO' by default. Optional. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) verify_drives(drive_id) force = verify_boolean(force, "force") body_values = {'disk': drive_id, 'force': force} path = '/api/raid_groups/{0}/hot_spares.json'.format(raid_id) return session.post_api(path=path, body=body_values, return_type=return_type, **kwargs)
def update_raid_group_resync_speed(session, raid_id, minimum, maximum, return_type=None, **kwargs): """ Updates the speed at which a RAID group will rebuild using the minimum and maximum arguments. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The drive 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type minimum: int :param minimum: Minimum speed in MB per second. Resync is done at minimum speed while there are Server IOs. Required. :type maximum: int :param maximum: Maximum speed in MB per second. Resync is done at maximum speed when there are no Server IOs. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) minimum, maximum = verify_min_max(minimum, maximum) body_values = {'min': minimum, 'max': maximum} path = '/api/raid_groups/{0}/resync_speed.json'.format(raid_id) return session.post_api(path=path, body=body_values, return_type=return_type, **kwargs)
def get_drives_in_raid_group(session, raid_id, start=None, limit=None, return_type=None, **kwargs): """ Retrieves details for all drives in a RAID group. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type start: int :param start: The offset to start displaying drives from. Optional. :type: limit: int :param limit: The maximum number of drives to return. Optional. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) parameters = verify_start_limit(start, limit) path = '/api/raid_groups/{0}/disks.json'.format(raid_id) return session.get_api(path=path, parameters=parameters, return_type=return_type, **kwargs)
def get_raid_group_performance(session, raid_id, interval=1, return_type=None, **kwargs): """ Retrieves metering statistics for the RAID group for the specified interval. Default interval is one second. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :param raid_id: The RAID group 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type interval: int :param interval: The interval to collect statistics for, in seconds. Optional (will be set to 1 second by default). :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) interval = verify_interval(interval) path = '/api/raid_groups/{0}/performance.json'.format(raid_id) parameters = {'interval': interval} return session.get_api(path=path, parameters=parameters, return_type=return_type, **kwargs)
def rename_raid_group(session, raid_id, display_name, return_type=None, **kwargs): """ Sets the "display_name" RAID group parameter to a new value. :type session: zadarapy.session.Session :param session: A valid zadarapy.session.Session object. Required. :type raid_id: str :param raid_id: The drive 'name' value as returned by get_all_raid_groups. For example: 'RaidGroup-1'. Required. :type display_name: str :param display_name: The new "display_name" to set. May not contain a single quote (') character. Required. :type return_type: str :param return_type: If this is set to the string 'json', this function will return a JSON string. Otherwise, it will return a Python dictionary. Optional (will return a Python dictionary by default). :rtype: dict, str :returns: A dictionary or JSON data set as a string depending on return_type parameter. """ verify_raid_id(raid_id) display_name = verify_field(display_name, "display_name") body_values = {'newname': display_name} path = '/api/raid_groups/{0}/rename.json'.format(raid_id) return session.post_api(path=path, body=body_values, return_type=return_type, **kwargs)