Closed jimklimov closed 5 months ago
how about assuming case user@host:destds unless user actually is a local rootds ?
how about assuming case user@host:destds unless user actually is a local rootds ?
For practical purposes, we proclaim preference for the former: we are more likely to look at funny local snapshot names, than to back up to (or otherwise care about) remote pools' ROOT datasets.
Yep, so we declare that user@host:destds
means local pool named user
(and its root dataset), and its snapshot host:destds
.
what I mean is that the code could actually test(!) if a given string actually is a local root dataset
Ah, must have misread your earlier comment. Yes, I've had such thoughts too - just did not get to implementing them :)
Instead, wondered whether we should be concerned about:
host
part can be resolved, but for systems with intermittent networking (VPN?) this may also not be bullet-proofzfs
tool and/or special tweaks to the common method?On the opposite side, where can such string with user@host:rootds
meaning a remote user at a remote host pop up? Only in DST
schedules, or something else? We can just document that backing up to root datasets of remote pools is not supported, a child dataset tree for this backed-up environment is recommended (so the same target can store backups of other systems), and that's it... right?
you are right this might be fragile ... another idea is this:
we know the actual src and destination configurations ... they do not include snapshots, so at that time things are still clear ...
so I guess we just need to alter the parsing flow
I guess we just need to alter the parsing flow
As noted earlier, for the least intrusive change, I am currently inclined in favor of further arguments (caller knows if the context deals with possible snapshots or strictly "live" dataset names), maybe wrapped as separate method names for the two use-cases and minimal syntax changes for callers.
Not sure if such refinement has to be part of this PR, or if you deem this one as an improvement with its own merit already (less-broken state of codebase) and it can be merged as a stepping-block to someone (else) making and diligently testing that change. Coding the change does not feel that hard, but testing and chizeling would likely need more time than I could currently share.
It may also be worthwhile to use ZnapZend::Config
definitions of the splitting method for strings coming from the config, as opposed to those generally juggled by ZnapZend::ZFS
. OOP-wise, these strings reflect sort of different object classes. But other than such an idea, I have not much more about implementing something of the sort.
Cheers, is the update okay? :)
Includes PRs #619 (see for most context of the initial problem) and #620 (so also addresses spellchecker passing after these changes).
After some tinkering with the splitter logic vs. conjured-up test cases, just one case remained where we can only define our preference (at least, lacking some other method arguments or wholly a new class to convey the information explicitly): how to treat
X@Y:Z
strings - are they a remoteuser@host:rootds
or a localrootds@funny:snapname
?So the self-test defines this one use-case as a "bogus" one with somewhat reasonably "hard-coded" specific expectations:
...and so the self-tests for the parser are enabled as part of standard test runs here.
Also this uncovered deficiencies in
ZnapZend::Config
variant of the parser which got fixed now by the regex proposed in #585 (and improved upon here forZnapZend::ZFS
). It does not have to care about snapshots, so is a lot simpler.