From 2e0b4ae3afc917b7ce0b55879310b41017f0f627 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Sun, 19 Nov 2023 17:12:51 +0530 Subject: [PATCH] mgr/vol: add comments in async_cloner It's not obvious where the clone creation is performed. It's especially obfuscated because we call the function/method for cloning indirectly. Therefore, add comments where necessary and mark it with heavy rating. Same goes for all other "subvolume snapshot clone" operations. Signed-off-by: Rishabh Dave --- src/pybind/mgr/volumes/fs/async_cloner.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pybind/mgr/volumes/fs/async_cloner.py b/src/pybind/mgr/volumes/fs/async_cloner.py index 95f7d64e1b3..af7f9bb8e0c 100644 --- a/src/pybind/mgr/volumes/fs/async_cloner.py +++ b/src/pybind/mgr/volumes/fs/async_cloner.py @@ -224,6 +224,8 @@ def do_clone(fs_client, volspec, volname, groupname, subvolname, should_cancel): with open_clone_subvolume_pair(fs_client, fs_handle, volspec, volname, groupname, subvolname) as clone_volumes: src_path = clone_volumes[1].snapshot_data_path(clone_volumes[2]) dst_path = clone_volumes[0].path + # XXX: this is where cloning (of subvolume's snapshots) actually + # happens. bulk_copy(fs_handle, src_path, dst_path, should_cancel) set_quota_on_clone(fs_handle, clone_volumes) @@ -287,9 +289,14 @@ def start_clone_sm(fs_client, volspec, volname, index, groupname, subvolname, st time.sleep(snapshot_clone_delay) log.info("Delayed cloning ({0}, {1}, {2}) -- by {3} seconds".format(volname, groupname, subvolname, snapshot_clone_delay)) while not finished: + # XXX: this is where request operation is mapped to relevant + # function. handler = state_table.get(current_state, None) if not handler: raise VolumeException(-errno.EINVAL, "invalid clone state: \"{0}\"".format(current_state)) + # XXX: this is where the requested operation for subvolume's + # snapshot clone is performed. the function for the request + # operation is run through "handler". (next_state, finished) = handler(fs_client, volspec, volname, index, groupname, subvolname, should_cancel) if next_state: log.debug("({0}, {1}, {2}) transition state [\"{3}\" => \"{4}\"]".format(volname, groupname, subvolname,\ -- 2.39.5