Skip to content

Isn't opt_default_exclude backwards? #127

Open
@rzumer

Description

@rzumer

if [ -n "$opt_default_exclude" ]
then
# Get a list of datasets for which snapshots are explicitly enabled.
CANDIDATES=$(echo "$ZFS_LIST" | awk -F '\t' \
'tolower($2) ~ /true/ || tolower($3) ~ /true/ {print $1}')
else
# Invert the NOAUTO list.
CANDIDATES=$(echo "$ZFS_LIST" | awk -F '\t' \
'tolower($2) !~ /false/ && tolower($3) !~ /false/ {print $1}')
fi

If com.sun:auto-snapshot is true, with opt_default_exclude enabled, then every label is enabled, even if com.sun:auto-snapshot:label is false.

If com.sun:auto-snapshot is false, with opt_default_exclude disabled, then even if com.sun:auto-snapshot:label is true, it will be disabled.

This contradicts the default behavior on Solaris as documented here (See: "Choose to only take snapshots under a given schedule for a dataset and all direct descendent datasets from the command line").

I'd expect the default behavior with opt_default_exclude disabled to enable a label if com.sun:auto-snapshot:label is not false and com.sun:auto-snapshot is not false or com.sun:auto-snapshot:label is true, even if com.sun:auto-snapshot is false. That second case is not handled right now, so if you want snapshots enabled by default, but have a label "whitelist" for a given dataset/pool, you have to explicitly disable every label you use instead of being able to disable snapshots globally and override that setting for some of the labels.

With it enabled it should probably disable every label unless both com.sun:auto-snapshot and com.sun:auto-snapshot:label are true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions