mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-22 17:49:13 +00:00
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
31 lines
740 B
Python
Executable file
31 lines
740 B
Python
Executable file
import os
|
|
import tempfile, random
|
|
|
|
def mount(src, dst, shared, private, slave):
|
|
cmd = "mount"
|
|
if shared:
|
|
cmd += " --make-shared"
|
|
if private:
|
|
cmd += " --make-private"
|
|
if slave:
|
|
cmd += " --make-slave"
|
|
if src:
|
|
cmd += " --bind '%s' '%s'" % (src, dst)
|
|
else:
|
|
cmd += " -t tmpfs none '%s'" % (dst)
|
|
|
|
print cmd
|
|
ret = os.system(cmd)
|
|
if ret:
|
|
print "failed"
|
|
|
|
root = tempfile.mkdtemp(prefix = "root.mount", dir = "/tmp")
|
|
mount(None, root, 1, 0, 0)
|
|
mounts = [root]
|
|
|
|
for i in xrange(10):
|
|
dstdir = random.choice(mounts)
|
|
dst = tempfile.mkdtemp(prefix = "mount", dir = dstdir)
|
|
src = random.choice(mounts + [None])
|
|
mount(src, dst, random.randint(0,100) > 50, random.randint(0,100) > 90, random.randint(0,100) > 50)
|
|
mounts.append(dst)
|