mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-06-25 10:38:00 +03:00
ZTS: test zfs.sync.clone() for filesystems and volumes
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Rob Norris <robn@despairlabs.com> Sponsored-by: https://despairlabs.com/sponsor/ Closes #17426
This commit is contained in:
parent
fbfda270d5
commit
1987498b66
@ -140,7 +140,7 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
|
||||
'tst.promote_multiple', 'tst.promote_simple', 'tst.rollback_mult',
|
||||
'tst.rollback_one', 'tst.set_props', 'tst.snapshot_destroy', 'tst.snapshot_neg',
|
||||
'tst.snapshot_recursive', 'tst.snapshot_rename', 'tst.snapshot_simple',
|
||||
'tst.bookmark.create', 'tst.bookmark.copy',
|
||||
'tst.bookmark.create', 'tst.bookmark.copy', 'tst.clone',
|
||||
'tst.terminate_by_signal'
|
||||
]
|
||||
tags = ['functional', 'channel_program', 'synctask_core']
|
||||
|
@ -84,7 +84,7 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
|
||||
'tst.promote_multiple', 'tst.promote_simple', 'tst.rollback_mult',
|
||||
'tst.rollback_one', 'tst.set_props', 'tst.snapshot_destroy',
|
||||
'tst.snapshot_neg', 'tst.snapshot_recursive', 'tst.snapshot_simple',
|
||||
'tst.bookmark.create', 'tst.bookmark.copy']
|
||||
'tst.bookmark.create', 'tst.bookmark.copy', 'tst.clone']
|
||||
tags = ['functional', 'channel_program', 'synctask_core']
|
||||
|
||||
[tests/functional/cli_root/zdb]
|
||||
|
@ -124,6 +124,7 @@ nobase_dist_datadir_zfs_tests_tests_DATA += \
|
||||
functional/channel_program/lua_core/tst.timeout.zcp \
|
||||
functional/channel_program/synctask_core/tst.bookmark.copy.zcp \
|
||||
functional/channel_program/synctask_core/tst.bookmark.create.zcp \
|
||||
functional/channel_program/synctask_core/tst.clone.zcp \
|
||||
functional/channel_program/synctask_core/tst.get_index_props.out \
|
||||
functional/channel_program/synctask_core/tst.get_index_props.zcp \
|
||||
functional/channel_program/synctask_core/tst.get_number_props.out \
|
||||
@ -569,6 +570,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
|
||||
functional/channel_program/synctask_core/setup.ksh \
|
||||
functional/channel_program/synctask_core/tst.bookmark.copy.ksh \
|
||||
functional/channel_program/synctask_core/tst.bookmark.create.ksh \
|
||||
functional/channel_program/synctask_core/tst.clone.ksh \
|
||||
functional/channel_program/synctask_core/tst.destroy_fs.ksh \
|
||||
functional/channel_program/synctask_core/tst.destroy_snap.ksh \
|
||||
functional/channel_program/synctask_core/tst.get_count_and_limit.ksh \
|
||||
|
55
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.clone.ksh
Executable file
55
tests/zfs-tests/tests/functional/channel_program/synctask_core/tst.clone.ksh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/ksh -p
|
||||
# SPDX-License-Identifier: CDDL-1.0
|
||||
#
|
||||
# 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) 2016, 2017 by Delphix. All rights reserved.
|
||||
# Copyright (c) 2025, Rob Norris <robn@despairlabs.com>
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION: Make sure basic cloning functionality works in channel programs
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
base=$TESTPOOL/$TESTFS/base
|
||||
|
||||
function cleanup
|
||||
{
|
||||
destroy_dataset $base "-R"
|
||||
}
|
||||
|
||||
log_onexit cleanup
|
||||
|
||||
log_must zfs create $base
|
||||
|
||||
# test filesystem cloning
|
||||
log_must zfs create $base/fs
|
||||
log_must zfs snapshot $base/fs@snap
|
||||
|
||||
log_must_program_sync $TESTPOOL \
|
||||
$ZCP_ROOT/synctask_core/tst.clone.zcp $base/fs@snap $base/newfs
|
||||
|
||||
# test zvol cloning
|
||||
log_must zfs create -s -V 100G $base/vol
|
||||
log_must zfs snapshot $base/vol@snap
|
||||
|
||||
log_must_program_sync $TESTPOOL \
|
||||
$ZCP_ROOT/synctask_core/tst.clone.zcp $base/vol@snap $base/newvol
|
||||
|
||||
# make sure the dev node was created
|
||||
block_device_wait $ZVOL_DEVDIR/$base/newvol
|
||||
|
||||
log_pass "Cloning works"
|
@ -0,0 +1,28 @@
|
||||
-- SPDX-License-Identifier: CDDL-1.0
|
||||
--
|
||||
-- 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) 2016, 2017 by Delphix. All rights reserved.
|
||||
-- Copyright (c) 2025, Rob Norris <robn@despairlabs.com>
|
||||
--
|
||||
|
||||
-- This program should be invoked as "zfs program <pool> <prog> <fs> <snap> <new>"
|
||||
|
||||
args = ...
|
||||
argv = args["argv"]
|
||||
assert(zfs.sync.clone(argv[1], argv[2]) == 0)
|
||||
clones = {}
|
||||
for c in zfs.list.clones(argv[1]) do
|
||||
table.insert(clones, c)
|
||||
end
|
||||
assert(#clones == 1)
|
||||
assert(clones[1] == argv[2])
|
Loading…
Reference in New Issue
Block a user