Creating a Deletion Policy

This section describes how to create a deletion policy. The system periodically deletes specific files that meet the deletion policy.

Prerequisites

A namespace has been created.

Precautions

Procedure

  1. Choose Resources > Tuning > SmartTier.

    By default, the SmartTier feature is disabled by the storage system. When you go to the SmartTier page for the first time, you need to click Enable to enable the SmartTier feature. After the SmartTier feature is enabled, you can log in to the CLI and run the following command to disable it.

    change tier_global_parameter tier_switch=off service_type=Service type

  2. Select the desired account from the Account drop-down list in the upper left corner.
  3. Click Create Policy.

    The Create Policy page is displayed.

  4. Set Policy Type to Deletion.

    Table 1 describes related parameters.

    Table 1 Deletion policy parameters

    Parameter

    Description

    Name

    Indicates the name of the deletion policy.

    NOTE:
    • The name must be unique.
    • The name can contain only letters, digits, hyphens (-), and underscores (_).
    • The name contains 1 to 63 characters.

    Execution Mode

    Indicates the execution mode of the deletion policy. Possible options are Periodical or One-off.

    NOTE:

    If the value is set to Periodical, the deletion policy is executed based on the configured period. The default execution period is 00:00 every day. You can modify the execution period in Setting a Deletion Period. If the value is set to One-off, the deletion policy is executed immediately.

    Namespace

    Indicates the namespace for which the deletion policy takes effect. Click Select. On the Namespace page that is displayed, select a desired namespace and click OK.

    Dtree

    Indicates the dtree for which the deletion policy takes effect. Click Select. On the Dtree page that is displayed, select a desired dtree and click OK.

    NOTE:

    If the Dtree parameter is not specified, the deletion policy takes effect for the entire namespace.

    Filter Policy

    Indicates the file filtering policy. Possible values are By file name, By file size, By file operation time, and By user or user group.

    • By file name

      Select Including or Excluding in File Name Filtering to determine whether files with the specified names are included or excluded in the deletion policy. Then, specify the file names to be filtered for or filtered.

      NOTE:
      • 1 to 1023 characters can be entered in the text box.
      • Wildcard (*) can match any character. The following formats are supported: example, *, *example*, *example, example*, and example*example.
      • Multiple file names are separated using commas (,).
    • By file size

      Specify the size of files to be filtered for.

    • By file operation time

      Specify a specific operation time. Possible options are crtime, mtime, ctime, and atime.

      • crtime: indicates the file creation time.
      • mtime: indicates the file modification time.
      • ctime: indicates the file property modification time.
      • atime: indicates the last file access time.
    • By user or user group

      Select the type of the desired user or user group from the User or User Group Type drop-down list and then select Including or Excluding in User Name Filtering to determine whether files of the specified user or user group are included or excluded in the deletion policy.

      • If you select LDAP domain user, LDAP domain user group, NIS domain user, or NIS domain user group in User or User Group Type, specify the user or user group name in Username or User Group Name.
      • If you select Local UNIX authentication user or Local UNIX authentication user group, click Select next to Username or User Group Name. On the Local UNIX Authentication User or Local UNIX Authentication User Group page that is displayed, select the desired user or user group and click OK.
    • By prefix

      Specify a specific prefix.

    • By tag

      Specify a specific tag. You can click to add multiple tags.

    NOTE:
    • If the object service is disabled for the selected namespace, possible options of Filter Policy include By file name, By file size, By file operation time, and By user or user group.
    • If the object service is enabled for the selected namespace, possible options of Filter Policy include By file name, By file operation time, By prefix, and By tag.
    • It is recommended that the ≤ condition of the file operation time be used together with other time policies. For example:

      Set crtime to >, 7, and days, and atime to , 1, and days. That is, the files that are created one week ago and accessed in the last day are deleted.

    • After the deletion task is started, files that meet the preset conditions are deleted one by one in the directory where the deletion policy is set. Whether a file meets the conditions is determined during file processing. To prevent a condition from changing with the task execution time (for example, the value of crtime is less than or equal to 1 hour when the task is started but the value of crtime changes to be greater than 1 hour when the file is being processed), set the condition value of to the one greater than the migration period in Setting a Deletion Period.

  5. If the object service is enabled for the selected namespace, set Object Expiration Policy.

    Table 2 describes related parameters.

    Table 2 Object expiration policy parameters

    Parameter

    Description

    Current Version

    Indicates the expiration policy of objects of the current version. Possible options are By days after creation and By specified date.

    • By days after creation

      Objects of the current version will be deleted after being created for the specified number of days.

    • By specified date

      Objects of the current version will be deleted at the specified date.

    Non-current Version

    An object will be deleted after it becomes a non-current version for the specified number of days.

    The deletion policy takes effect for files that meet both the filtering policy and object expiration policy.

  6. Click OK.