forked from third-party-mirrors/zfs_autobackup
working on send pipe
This commit is contained in:
parent
8ea178af1f
commit
521d1078bd
33
tests/test_sendrecvpipes.py
Normal file
33
tests/test_sendrecvpipes.py
Normal file
@ -0,0 +1,33 @@
|
||||
from basetest import *
|
||||
import time
|
||||
|
||||
class TestSendRecvPipes(unittest2.TestCase):
|
||||
"""test input/output pipes for zfs send and recv"""
|
||||
|
||||
def setUp(self):
|
||||
prepare_zpools()
|
||||
self.longMessage=True
|
||||
|
||||
|
||||
|
||||
def test_send_basics(self):
|
||||
"""send basics (remote/local send pipe)"""
|
||||
|
||||
with patch('time.strftime', return_value="20101111000000"):
|
||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--send-pipe=dd bs=1M", "--send-pipe=dd bs=2M"]).run())
|
||||
|
||||
with patch('time.strftime', return_value="20101111000001"):
|
||||
self.assertFalse(ZfsAutobackup(["test", "test_target1", "--no-progress", "--ssh-source=localhost", "--send-pipe=dd bs=1M", "--send-pipe=dd bs=2M"]).run())
|
||||
|
||||
# r=shelltest("zfs list -H -o name -r -t snapshot test_target1")
|
||||
# #NOTE: it wont backup test_target1/a/test_source2/fs2/sub to test_target1/b since it doesnt have the zfs_autobackup property anymore.
|
||||
# self.assertMultiLineEqual(r,"""
|
||||
# test_target1/a/test_source1/fs1@test-20101111000000
|
||||
# test_target1/a/test_source1/fs1/sub@test-20101111000000
|
||||
# test_target1/a/test_source2/fs2/sub@test-20101111000000
|
||||
# test_target1/b/test_source1/fs1@test-20101111000000
|
||||
# test_target1/b/test_source1/fs1/sub@test-20101111000000
|
||||
# test_target1/b/test_source2/fs2/sub@test-20101111000000
|
||||
# test_target1/b/test_target1/a/test_source1/fs1@test-20101111000000
|
||||
# test_target1/b/test_target1/a/test_source1/fs1/sub@test-20101111000000
|
||||
# """)
|
@ -2,6 +2,7 @@ from basetest import *
|
||||
import time
|
||||
|
||||
class TestZfsAutobackup31(unittest2.TestCase):
|
||||
"""various new 3.1 features"""
|
||||
|
||||
def setUp(self):
|
||||
prepare_zpools()
|
||||
|
@ -557,20 +557,19 @@ class ZfsDataset:
|
||||
cmd.append(self.name)
|
||||
|
||||
# #add custom output pipes?
|
||||
# if output_pipes:
|
||||
# #local so do our own piping
|
||||
# if self.zfs_node.is_local():
|
||||
# output_pipe = self.zfs_node.run(cmd)
|
||||
# for pipe_cmd in output_pipes:
|
||||
# output_pipe=self.zfs_node.run(pipe_cmd, inp=output_pipe, )
|
||||
# return output_pipe
|
||||
# #remote, so add with actual | and let remote shell handle it
|
||||
# else:
|
||||
# for pipe_cmd in output_pipes:
|
||||
# cmd.append("|")
|
||||
# cmd.extend(pipe_cmd)
|
||||
#local so do our own piping
|
||||
if self.zfs_node.is_local():
|
||||
output_pipe = self.zfs_node.run(cmd, pipe=True, readonly=True)
|
||||
for pipe_cmd in output_pipes:
|
||||
output_pipe=self.zfs_node.run(pipe_cmd.split(" "), inp=output_pipe, pipe=True, readonly=False)
|
||||
#remote, so add with actual | and let remote shell handle it
|
||||
else:
|
||||
for pipe_cmd in output_pipes:
|
||||
cmd.append("|")
|
||||
cmd.extend(pipe_cmd.split(" "))
|
||||
output_pipe = self.zfs_node.run(cmd, pipe=True, readonly=True)
|
||||
|
||||
return self.zfs_node.run(cmd, pipe=True, readonly=True)
|
||||
return output_pipe
|
||||
|
||||
def recv_pipe(self, pipe, features, filter_properties=None, set_properties=None, ignore_exit_code=False):
|
||||
"""starts a zfs recv for this snapshot and uses pipe as input
|
||||
|
Loading…
x
Reference in New Issue
Block a user