-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Refinement] create_standby: refine copy_tree to support container mode #268
Conversation
…eplace copy_tree.py
…djust test_copy.py(->test_persist_file_handling.py)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous test_copy_tree.py
is moved to create_standby/test_persis_files_handling.py
, with test setup now as follow:
creating two folders(src
, dst
) to simulate active slot
and to-be-updated standby slot
. Specific files/dirs under src
are required to be preserved from src
to dst
, which specified by the canonical path(a.k.a, path rooted at '/').
For example, we create src/A/B/C
and want to preserve A/B/C
to dst
, then we will setup test as follow:
create_files
will createsrc
anddst
folders asactive slot
andstandby slot
,create_files
will createA/B/C
undersrc
folder,PersistFilesHandler
is setup with test passwd/group db andsrc_rootfs=src, dst_rootfs=dst
,PersistFilesHandler.preserve_persist_entry
is called with params:_persist_entry="/A/B/C"
,- check
src/A/B/C
againstdst/A/B/C
.
Important
All test assertion cases are all unchanged(i.e., uid/gid mapping check, mode check , etc), besides the rules of src as active slot
and dst as standby slot
are applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Description
During implementing the support for container mode, I found that
copy_tree.py
module(which is for handling preserving files from active slot to standby slot) doesn't support container mode(a.k.a, it expects that the src path is always rooted at/
).Note
The changes in this PR are cherry-picked from the container mode implementation working branch.
This PR implements a drop-in replacement for
copy_tree
module atcreate_standby.common.PersistFilesHandler
, which supports handling files preserving under container mode and simplify the implementation.Check list
Changes
copy_tree
module is re-implemented ascreate_standby.common.PersistFilesHandler
,utils.unix
package.Behavior changes
Does this PR introduce behavior change(s)?
Breaking change
Does this PR introduce breaking change?