Giter VIP home page Giter VIP logo

Comments (6)

steven-ray avatar steven-ray commented on July 4, 2024 1

I know this is a bit old, but am just running into this same issue. I need to be able to clean expired snapshots without having to specify all prefixes. This should be able to be done with the -P option, or by default without it. Only specifying -p should refine.

In looking at the source in core.sh, a recommended fix would be to change line 441 in the ValidPrefix() function from this:

    437 # Check validity of a prefix
    438 ValidPrefix() {
    439     local snapshot_prefix="$1"
    440
    441     [ -z "$PREFIXES" ] && [ -z "$snapshot_prefix" ] && return 0
    442
    443     local i
    444     for i in $PREFIXES; do
    445         [ "$snapshot_prefix" = "$i" ] && return 0
    446     done
    447
    448     return 1
    449 }

to this:

    437 # Check validity of a prefix
    438 ValidPrefix() {
    439     local snapshot_prefix="$1"
    440
    441     [ -z "$PREFIXES" ] && return 0
    442
    443     local i
    444     for i in $PREFIXES; do
    445         [ "$snapshot_prefix" = "$i" ] && return 0
    446     done
    447
    448     return 1
    449 }

The -P option nulls the $PREFIXES variable and it becomes the same as not specifying a -p option. If $PREFIXES is null, we shouldn't be looking for null prefixes in the snapshot name, but rather, we should be ignoring the prefix and returning a valid response with return 0.

Thoughts?

from zfsnap.

wolffstarr avatar wolffstarr commented on July 4, 2024

One of the other issues points out that you need to include a prefix (-p whatever). There's an option that is supposed to disable requiring prefixes (-P) but it does not appear to be working for me; I get the same behavior as when I run the above commands. Running zfsnap v2.0.0.beta2.

from zfsnap.

aqw avatar aqw commented on July 4, 2024

@petr-fischer zfSnap v1 is a bit before my time, and I don't remember/know all of the syntax for it. My best advice is to upgrade to zfsnap v2, as it is much better tested and featureful. I've been saying it for too long now... I really need to set aside an evening and release v2 in order to leave v1 behind. Shame on me. ;-)

@graudeejs You use FreeBSD, correct? How should we go about getting v2 in their ports tree? The syntax did break, so I'm not sure if they'd be ok with a normal upgrade path or if they'd prefer a new package. So many of our users are from FreeBSD, it'd really help to get them on latest.

@wolffstarr I'm a bit confused with your problem, as petr-fischer's commands won't work with zfsnap v2; the syntax has changed. Can you be more specific, with some simple examples, of how you expect prefixes to work and how they behave differently than you'd expect?

---Alex

from zfsnap.

petr-fischer avatar petr-fischer commented on July 4, 2024

@Alexqw Thanks for info! Just looking at the FreeBSD port tree, and there is zfsnap2 package (right way, if syntax was changed!). This package is news to me (added to the port tree on 2016-06-30). Actual version in the ports tree is "2.0.0-beta2" (git tag: af91bd2). So I can comfortably test v2 without issues (or rather wait for v2 final release!). Good news. Thanks (you can close this issue)!

from zfsnap.

wolffstarr avatar wolffstarr commented on July 4, 2024

@Alexqw: Doh! My apologies, I completely missed the lack of "destroy" after zfsnap. Which, to be fair, I tend to forget to do when I'm typing the command too.

As for prefixes, my assumption originally (which was based on the wording of the prefix options) was that, if I want just a specific prefix I would include "-p prefixname" in the command, and without that it would impact all snapshots regardless of prefix. When leaving out the -p option simply caused the command (for example, "zfsnap destroy -v -r tank/Dataset") to fail silently, I found Issue #74 which indicated -p is required. Again, looking at the output of "zfsnap destroy -h", the -P option says "disable filtering for prefixes", which I would expect to mean "ignore all prefixes". However, this too also fails silently, probably because it's not running a valid command. Adding -v doesn't cause any output either.

So I would expect "zfsnap destroy -r -v tank" to recursively remove all snapshots made for the zpool "tank" and any datasets under it, regardless of prefix. If that would work for snapshots that don't have a prefix, then I would expect -P to mean "apply to all prefixes".

from zfsnap.

graudeejs avatar graudeejs commented on July 4, 2024

@Alexqw zfsnap2 is in FreeBSD port already thanks to [email protected]
https://www.freshports.org/sysutils/zfsnap2/

from zfsnap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.