mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
zcp: add zfs.sync.bookmark
Add support for bookmark creation and cloning. Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Paul Dagnelie <pcd@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Christian Schwarz <me@cschwarz.com> Closes #9571
This commit is contained in:
committed by
Brian Behlendorf
parent
a73f361fdb
commit
948f0c4419
@@ -30,6 +30,8 @@ dist_pkgdata_SCRIPTS = \
|
||||
tst.snapshot_destroy.ksh \
|
||||
tst.snapshot_neg.ksh \
|
||||
tst.snapshot_recursive.ksh \
|
||||
tst.bookmark.create.ksh \
|
||||
tst.bookmark.copy.ksh \
|
||||
tst.snapshot_simple.ksh \
|
||||
tst.terminate_by_signal.ksh
|
||||
|
||||
@@ -44,4 +46,6 @@ dist_pkgdata_DATA = \
|
||||
tst.snapshot_destroy.zcp \
|
||||
tst.snapshot_neg.zcp \
|
||||
tst.snapshot_recursive.zcp \
|
||||
tst.snapshot_simple.zcp
|
||||
tst.snapshot_simple.zcp \
|
||||
tst.bookmark.create.zcp \
|
||||
tst.bookmark.copy.zcp
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2019, 2020 by Christian Schwarz. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION: Make sure bookmark copying works in channel programs
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
fs=$TESTPOOL/$TESTFS/testchild
|
||||
snapname=testsnap
|
||||
bookname=testbookmark
|
||||
bookcopyname=testbookmark_copy
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_dataset $fs "-R"
|
||||
}
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zfs create $fs
|
||||
|
||||
log_must zfs snapshot $fs@$snapname
|
||||
log_must zfs bookmark $fs@$snapname "$fs#$bookname"
|
||||
|
||||
log_must_program_sync $TESTPOOL \
|
||||
$ZCP_ROOT/synctask_core/tst.bookmark.copy.zcp $fs $bookname $bookcopyname
|
||||
|
||||
log_pass "Simple bookmark copying works"
|
||||
@@ -0,0 +1,32 @@
|
||||
--
|
||||
-- This file and its contents are supplied under the terms of the
|
||||
-- Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
-- You may only use this file in accordance with the terms of version
|
||||
-- 1.0 of the CDDL.
|
||||
--
|
||||
-- A full copy of the text of the CDDL should have accompanied this
|
||||
-- source. A copy of the CDDL is also available via the Internet at
|
||||
-- http://www.illumos.org/license/CDDL.
|
||||
--
|
||||
|
||||
--
|
||||
-- Copyright (c) 2019, 2020 by Christian Schwarz. All rights reserved.
|
||||
--
|
||||
|
||||
-- This program should be invoked as "zfs program <pool> <prog> <fs> <source_book> <new_book>"
|
||||
|
||||
args = ...
|
||||
argv = args["argv"]
|
||||
fs = argv[1]
|
||||
source = fs .. "#" .. argv[2]
|
||||
new = fs .. "#" .. argv[3]
|
||||
assert(zfs.sync.bookmark(source, new) == 0)
|
||||
books = {}
|
||||
count = 0
|
||||
for s in zfs.list.bookmarks(fs) do
|
||||
count = count + 1
|
||||
books[s] = 1
|
||||
end
|
||||
assert(count == 2)
|
||||
assert(books[source] == 1)
|
||||
assert(books[new] == 1)
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2019, 2020 by Christian Schwarz. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION: Make sure basic bookmark functionality works in channel programs
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
fs=$TESTPOOL/$TESTFS/testchild
|
||||
snapname=testsnap
|
||||
bookname=testbookmark
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_dataset $fs "-R"
|
||||
}
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zfs create $fs
|
||||
|
||||
log_must zfs snapshot $fs@$snapname
|
||||
|
||||
log_must_program_sync $TESTPOOL \
|
||||
$ZCP_ROOT/synctask_core/tst.bookmark.create.zcp $fs $snapname $bookname
|
||||
|
||||
log_pass "Simple bookmark creation works"
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
--
|
||||
-- This file and its contents are supplied under the terms of the
|
||||
-- Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
-- You may only use this file in accordance with the terms of version
|
||||
-- 1.0 of the CDDL.
|
||||
--
|
||||
-- A full copy of the text of the CDDL should have accompanied this
|
||||
-- source. A copy of the CDDL is also available via the Internet at
|
||||
-- http://www.illumos.org/license/CDDL.
|
||||
--
|
||||
|
||||
--
|
||||
-- Copyright (c) 2019, 2020 by Christian Schwarz. All rights reserved.
|
||||
--
|
||||
|
||||
-- This program should be invoked as "zfs program <pool> <prog> <fs> <snap> <book>"
|
||||
|
||||
args = ...
|
||||
argv = args["argv"]
|
||||
assert(zfs.sync.bookmark(argv[1] .. "@" .. argv[2], argv[1] .. "#" .. argv[3]) == 0)
|
||||
books = {}
|
||||
for s in zfs.list.bookmarks(argv[1]) do
|
||||
table.insert(books, s)
|
||||
end
|
||||
assert(#books == 1)
|
||||
assert(books[1] == (argv[1] .. "#" .. argv[3]))
|
||||
Reference in New Issue
Block a user