Skip to content

Commit 0e2d218

Browse files
committed
Test case for sjbronner's striped LV parsing work
1 parent 349e806 commit 0e2d218

File tree

2 files changed

+98
-0
lines changed

2 files changed

+98
-0
lines changed

spec/fixtures/striped

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
contents = "Text Format Volume Group"
2+
version = 1
3+
4+
description = "vgcfgbackup -f /tmp/faffen2"
5+
6+
striped {
7+
id = "zAPMOi-5QlD-fp1M-FMgz-biha-TQIP-X9TfqX"
8+
seqno = 436
9+
format = "lvm2" # informational
10+
status = ["RESIZEABLE", "READ", "WRITE"]
11+
flags = []
12+
extent_size = 8192 # 4 Megabytes
13+
max_lv = 0
14+
max_pv = 0
15+
metadata_copies = 0
16+
17+
physical_volumes {
18+
19+
pv0 {
20+
id = "j7ZiWs-1fHB-aAwq-yL29-pBOk-H4hR-AOIe0P"
21+
device = "/dev/dm-0" # Hint only
22+
23+
status = ["ALLOCATABLE"]
24+
flags = []
25+
dev_size = 1952545832 # 931.046 Gigabytes
26+
pe_start = 384
27+
pe_count = 238347 # 931.043 Gigabytes
28+
}
29+
30+
pv1 {
31+
id = "afl7D7-Rpy1-Is3H-SFxo-d03x-s8dE-lEgZWU"
32+
device = "/dev/dm-1" # Hint only
33+
34+
status = ["ALLOCATABLE"]
35+
flags = []
36+
dev_size = 1952545832 # 931.046 Gigabytes
37+
pe_start = 384
38+
pe_count = 238347 # 931.043 Gigabytes
39+
}
40+
}
41+
42+
logical_volumes {
43+
44+
swap {
45+
id = "BOfqkb-V4jw-7cBX-UR3D-SN3f-wWvd-NwysSj"
46+
status = ["READ", "WRITE", "VISIBLE"]
47+
flags = []
48+
segment_count = 1
49+
50+
segment1 {
51+
start_extent = 0
52+
extent_count = 2048 # 8 Gigabytes
53+
54+
type = "striped"
55+
stripe_count = 1 # linear
56+
57+
stripes = [
58+
"pv0", 0
59+
]
60+
}
61+
}
62+
63+
root {
64+
id = "8sbW3s-qB1u-6IlS-ABSj-PAMU-UxRk-I18ECh"
65+
status = ["READ", "WRITE", "VISIBLE"]
66+
flags = []
67+
segment_count = 1
68+
69+
segment1 {
70+
start_extent = 0
71+
extent_count = 3840 # 15 Gigabytes
72+
73+
type = "striped"
74+
stripe_count = 2
75+
stripe_size = 128 # 64 Kilobytes
76+
77+
stripes = [
78+
"pv0", 21504,
79+
"pv1", 21504
80+
]
81+
}
82+
}
83+
}
84+
}

spec/vg_cfg_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,18 @@
164164
end
165165
end
166166
end
167+
168+
context "striped config" do
169+
let(:vg_name) { "striped" }
170+
171+
it "parses successfully" do
172+
expect { vgcfg }.to_not raise_error
173+
end
174+
175+
it "contains logical volumes" do
176+
expect(vgcfg.logical_volumes).to be_a(Hash)
177+
178+
vgcfg.logical_volumes.values.each { |lv| expect(lv).to be_an(LVM::LVConfig) }
179+
end
180+
end
167181
end

0 commit comments

Comments
 (0)