]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/vol: add comments in async_cloner
authorRishabh Dave <ridave@redhat.com>
Sun, 19 Nov 2023 11:42:51 +0000 (17:12 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 22 Mar 2024 16:57:35 +0000 (22:27 +0530)
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 <ridave@redhat.com>
(cherry picked from commit 2e0b4ae3afc917b7ce0b55879310b41017f0f627)

src/pybind/mgr/volumes/fs/async_cloner.py

index 5761a9cb945efffda58301a9e52e1e1f272d3c9d..b80e56a053c923c0c14029ed84b738fa450174d0 100644 (file)
@@ -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,\