forked from oVirt/ovirt-imageio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
storage.py
113 lines (99 loc) · 2.5 KB
/
storage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# SPDX-FileCopyrightText: Red Hat, Inc.
# SPDX-License-Identifier: GPL-2.0-or-later
"""
userstorage configuration
"""
from userstorage import File, Mount, LoopDevice
GiB = 1024**3
BASE_DIR = "/var/tmp/imageio-storage"
BACKENDS = {
# This storage is generally not interesting for testing, but since it does
# not support fallocate(), it is a good way to test the fallback to manualy
# writing zeroes.
"file-512-ext2": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-512-ext2",
size=GiB,
sector_size=512,
),
fstype="ext2",
)
),
"file-512-ext4": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-512-ext4",
size=GiB,
sector_size=512,
),
fstype="ext4",
)
),
"file-512-xfs": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-512-xfs",
size=GiB,
sector_size=512,
# Fails to mount on Jenkins when running on slave with kernel
# 3.10. Let's make it optional so we can test other storage.
required=False,
),
fstype="xfs",
)
),
"file-4k-ext2": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-4k-ext2",
size=GiB,
sector_size=4096,
required=False,
),
fstype="ext2",
)
),
"file-4k-ext4": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-4k-ext4",
size=GiB,
sector_size=4096,
required=False,
),
fstype="ext4",
)
),
"file-4k-xfs": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-4k-xfs",
size=GiB,
sector_size=4096,
required=False,
),
fstype="xfs",
)
),
"block-512": LoopDevice(
base_dir=BASE_DIR,
name="block-512",
size=GiB,
sector_size=512,
required=False,
),
"block-4k": LoopDevice(
base_dir=BASE_DIR,
name="block-4k",
size=GiB,
sector_size=4096,
required=False,
),
}