Skip to content

Commit 275ab5a

Browse files
cmd: add skip-missing option (#415)
1 parent 93312eb commit 275ab5a

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ Flags:
200200
-R, --replication See the -R flag on zfs send for more information
201201
--resume set this flag to true when you want to try and resume a previously cancled or failed backup. It is up to the caller to ensure the same command line arguments are provided between the original backup and the resumed one.
202202
--separator string the separator to use between object component names. (default "|")
203+
-s, --skip-missing See the -s flag on zfs send for more information
203204
--uploadChunkSize int the chunk size, in MiB, to use when uploading. A minimum of 5MiB and maximum of 100MiB is enforced. (default 10)
204205
--volsize uint the maximum size (in MiB) a volume should be before splitting to a new volume. Note: zfsbackup will try its best to stay close/under this limit but it is not garaunteed. (default 200)
205206

cmd/send.go

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func init() {
7373

7474
// ZFS send command options
7575
sendCmd.Flags().BoolVarP(&jobInfo.Replication, "replication", "R", false, "See the -R flag on zfs send for more information")
76+
sendCmd.Flags().BoolVarP(&jobInfo.SkipMissing, "skip-missing", "s", false, "See the -s flag on zfs send for more information")
7677
sendCmd.Flags().BoolVarP(&jobInfo.Deduplication, "deduplication", "D", false, "See the -D flag for zfs send for more information.")
7778
sendCmd.Flags().StringVarP(&jobInfo.IncrementalSnapshot.Name, "incremental", "i", "", "See the -i flag on zfs send for more information")
7879
sendCmd.Flags().StringVarP(&fullIncremental, "intermediary", "I", "", "See the -I flag on zfs send for more information")
@@ -185,6 +186,7 @@ func ResetSendJobInfo() {
185186
resetRootFlags()
186187
// ZFS send command options
187188
jobInfo.Replication = false
189+
jobInfo.SkipMissing = false
188190
jobInfo.Deduplication = false
189191
jobInfo.IncrementalSnapshot = files.SnapshotInfo{}
190192
jobInfo.BaseSnapshot = files.SnapshotInfo{}

files/jobinfo.go

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type JobInfo struct {
5656
EncryptTo string
5757
SignFrom string
5858
Replication bool
59+
SkipMissing bool
5960
Deduplication bool
6061
Properties bool
6162
IntermediaryIncremental bool
@@ -135,6 +136,7 @@ func (j *JobInfo) String() string {
135136
output = append(
136137
output,
137138
fmt.Sprintf("Replication: %v", j.Replication),
139+
fmt.Sprintf("SkipMissing: %v", j.SkipMissing),
138140
fmt.Sprintf("Archives: %d - %d bytes (%s)", len(j.Volumes), totalWrittenBytes, humanize.IBytes(totalWrittenBytes)),
139141
fmt.Sprintf("Volume Size (Raw): %d bytes (%s)", j.ZFSStreamBytes, humanize.IBytes(j.ZFSStreamBytes)),
140142
fmt.Sprintf("Uploaded: %v (took %v)\n\n", j.StartTime, j.EndTime.Sub(j.StartTime)),

zfs/zfs.go

+5
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ func GetZFSSendCommand(ctx context.Context, j *files.JobInfo) *exec.Cmd {
120120
zfsArgs = append(zfsArgs, "-R")
121121
}
122122

123+
if j.SkipMissing {
124+
log.AppLogger.Infof("Enabling the skip-missing (-s) flag on the send.")
125+
zfsArgs = append(zfsArgs, "-s")
126+
}
127+
123128
if j.Deduplication {
124129
log.AppLogger.Infof("Enabling the deduplication (-D) flag on the send.")
125130
zfsArgs = append(zfsArgs, "-D")

0 commit comments

Comments
 (0)