[CRIU] [PATCH] zdtm: Make sure the root dirs are not present
Tycho Andersen
tycho.andersen at canonical.com
Mon Feb 29 09:42:18 PST 2016
On Mon, Feb 29, 2016 at 05:09:20PM +0300, Cyrill Gorcunov wrote:
> When creating root for NS testing we should make
> sure that directories we're about to create are
> not present (created already). For this sake
> use os.access helper.
>
> With this patch I can run test on my local machine.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> Andrew, does it make sense?
How did you get these directories already? Have you run `make clean`
by chance? The clean scripts can clean some of the directories, but
not all of them because some things are owned by root.
> test/zdtm.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/test/zdtm.py b/test/zdtm.py
> index 1ace91953667..7e93d5b977f3 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -161,8 +161,9 @@ class ns_flavor:
>
> def __construct_root(self):
> for dir in self.__root_dirs:
> - os.mkdir(self.root + dir)
> - os.chmod(self.root + dir, 0777)
> + if not os.access(self.root + dir, os.F_OK):
> + os.mkdir(self.root + dir)
> + os.chmod(self.root + dir, 0777)
>
> for ldir in [ "/bin", "/sbin", "/lib", "/lib64" ]:
> os.symlink(".." + ldir, self.root + "/usr" + ldir)
> --
> 2.5.0
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list