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 SmartTier 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 a 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

    Name of the deletion policy.

    NOTE:
    • The name must be unique.
    • The name can contain only letters, digits, special characters !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~, and spaces, and cannot start or end with a space.
    • The value contains 1 to 255 characters.

    Execution Mode

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

    NOTE:

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

    Namespace

    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

    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

    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 specified names are included or excluded in the policy. Then, specify the file names to be filtered for or filtered.

      NOTE:
      • In the text box, 1 to 1023 characters can be entered.
      • 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.
        NOTE:

        If the object protocol is enabled for the selected namespace, the crtime parameter is not supported.

    • 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 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 set to , 1, and hours when the task is started but the value of crtime changes to >, 1, and hours 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

    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
      • If the specified date is earlier than or is the current date, objects of the current version uploaded earlier than the specified date will be deleted.
      • If the specified date is later than the current date, objects of the current version uploaded earlier than the specified date will be deleted after the specified date is reached. This option applies to policies whose execution mode is Periodical.
    • Delete expired object delete markers

      If you select Delete expired object delete markers, you can determine whether to delete the delete markers of objects without historical versions.

      • If you select Yes, the delete markers of objects without historical versions will be deleted.
      • If you select No, this setting does not affect the current version and can be queried through the S3 bucket life cycle interface.

    Noncurrent 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.