Thanks to visit codestin.com
Credit goes to github.com

Skip to content

pyznap v1.6.0 - 'pv' doesn't support '-D' with CentOS 7.9/EPEL #88

@LnxGnome

Description

@LnxGnome

Sometime... I'll have a filesystem skipped by a bad 'pv' argument. This happened on 38 of 274 filesystems this run.

Mar 12 00:00:29 INFO: Updating bakpool/tx8pool02/abc with recent snapshot root@host1:tx8pool01/abc@autosnap_2022-03-12_00:01:53_daily (~2.4M)...
Mar 12 00:00:29 DEBUG: Using mbuffer on source: 'mbuffer -q -s 128K -m 2M'...
Mar 12 00:00:29 DEBUG: Using pv on source: 'pv -f -w 100 -s 2511168 -D 60 -i 60'...
Mar 12 00:00:29 DEBUG: Using mbuffer on dest: 'mbuffer -q -s 128K -m 2M'...
  pv: invalid option -- 'D'
Try `pv --help' for more information.
mbuffer: error: outputThread: error writing to <stdout> at offset 0x0: Broken pipe
mbuffer: warning: error during output to <stdout>: Broken pipe
Mar 12 00:00:31 ERROR: Error while sending to bakpool/tx8pool02/abc: cannot receive: failed to read from stream...

Cron calls a script that makes sure a backup is not running, if so, it executes:
/usr/local/bin/pyznap --config /etc/pyznap/bakpool-tx8pool02 -v send

/etc/pyznap/bakpool-tx8pool02 (config called in script)

[ssh:22:root@host1:tx8pool01]
key = /root/.ssh/id_rsa-root.host1
daily = 7
snap = yes
dest = bakpool/tx8pool02
compress = none
# exclude = tx8pool01/apple/timemachine, tx8pool01/backups, tx8pool01/export/BACKUP, tx8pool01/export/iso, tx8pool01/vms, tx8pool01/windows, tx8pool01/zvols/os, tx8pool01/export/repos
exclude = tx8pool01/apple/timemachine* tx8pool01/backups* tx8pool01/export/BACKUP* tx8pool01/export/iso* tx8pool01/vms* tx8pool01/windows* tx8pool01/zvols/os* tx8pool01/export/repos*

It would be nice to have an option to disable 'pv' for testing.

It would be nice to be able to control the options being sent to 'pv'.

pyznap 1.6.0 from yboetz/pynap 'Releases'

# lsb_release -sir
CentOS 7.9.2009

# pv -V
pv 1.4.6 - Copyright(C) 2012 Andrew Wood <[email protected]>

(latest pv from epel)
'# rpm -qi pv'

Name        : pv
Version     : 1.4.6
Release     : 1.el7

# pv -h

Usage: pv [OPTION] [FILE]...
Concatenate FILE(s), or standard input, to standard output,
with monitoring.

  -p, --progress           show progress bar
  -t, --timer              show elapsed time
  -e, --eta                show estimated time of arrival (completion)
  -r, --rate               show data transfer rate counter
  -a, --average-rate       show data transfer average rate counter
  -b, --bytes              show number of bytes transferred
  -F, --format FORMAT      set output format to FORMAT
  -n, --numeric            output percentages, not visual information
  -q, --quiet              do not output any transfer information at all

  -W, --wait               display nothing until first byte transferred
  -s, --size SIZE          set estimated data size to SIZE bytes
  -l, --line-mode          count lines instead of bytes
  -i, --interval SEC       update every SEC seconds
  -w, --width WIDTH        assume terminal is WIDTH characters wide
  -H, --height HEIGHT      assume terminal is HEIGHT rows high
  -N, --name NAME          prefix visual information with NAME
  -f, --force              output even if standard error is not a terminal
  -c, --cursor             use cursor positioning escape sequences

  -L, --rate-limit RATE    limit transfer to RATE bytes per second
  -B, --buffer-size BYTES  use a buffer size of BYTES
  -E, --skip-errors        skip read errors in input
  -S, --stop-at-size       stop after --size bytes have been transferred
  -R, --remote PID         update settings of process PID

  -P, --pidfile FILE       save process ID in FILE

  -h, --help               show this help and exit
  -V, --version            show version information and exit

Untested Workaround:
# diff -u /root/pyzfs.py /usr/local/lib/python3.6/site-packages/pyznap/pyzfs.py

--- /root/pyzfs.py	2022-02-11 07:50:23.835587978 -0500
+++ /usr/local/lib/python3.6/site-packages/pyznap/pyzfs.py	2022-03-13 00:35:18.089522117 -0500
@@ -418,7 +418,7 @@
         if pv and stream_size >= 1024**2: # don't use pv if stream size is too small
             pv_cmd = pv(stream_size)
             if not sys.stdout.isatty():
-                pv_cmd += ['-D', '60', '-i', '60'] # if stdout is redirected, only update pv every 60s
+                pv_cmd += ['-i', '60'] # if stdout is redirected, only update pv every 60s
             logger.debug("Using pv on source: '{:s}'...".format(' '.join(pv_cmd)))
             cmd += ['|'] + pv_cmd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions