Revision efa6dd08

b/Makefile.am
1098 1098
	test/data/proc_drbd83_sync.txt \
1099 1099
	test/data/proc_drbd83_sync_want.txt \
1100 1100
	test/data/proc_drbd83_sync_krnl2.6.39.txt \
1101
	test/data/proc_drbd84.txt \
1102
	test/data/proc_drbd84_sync.txt \
1101 1103
	test/data/qa-minimal-nodes-instances-only.json \
1102 1104
	test/data/sys_drbd_usermode_helper.txt \
1103 1105
	test/data/vgreduce-removemissing-2.02.02.txt \
b/test/data/proc_drbd84.txt
1
version: 8.4.2 (api:1/proto:86-101)
2
GIT-hash: 7ad5f850d711223713d6dcadc3dd48860321070c build by root@example.com, 2013-04-10 07:45:25
3
 0: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r-----
4
    ns:1048576 nr:0 dw:0 dr:1048776 al:0 bm:64 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
5
 1: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
6
    ns:0 nr:1048576 dw:1048576 dr:0 al:0 bm:64 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0
7
 2: cs:Unconfigured
8

  
9
 4: cs:WFConnection ro:Primary/Unknown ds:UpToDate/DUnknown C r-----
10
    ns:0 nr:0 dw:0 dr:200 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:1048320
11

  
12
 6: cs:Connected ro:Secondary/Primary ds:Diskless/UpToDate C r-----
13
    ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
14

  
15
 8: cs:StandAlone ro:Secondary/Unknown ds:UpToDate/DUnknown   r-----
16
    ns:0 nr:0 dw:0 dr:200 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:1048320
b/test/data/proc_drbd84_sync.txt
1
version: 8.4.2 (api:1/proto:86-101)
2
GIT-hash: 7ad5f850d711223713d6dcadc3dd48860321070c build by root@example.com, 2013-04-10 07:45:25
3
 0: cs:StandAlone ro:Primary/Unknown ds:UpToDate/DUnknown   r-----
4
    ns:0 nr:0 dw:33318 dr:730 al:15 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:d oos:1048320
5

  
6
 3: cs:Unconfigured
7

  
8
 5: cs:SyncSource ro:Secondary/Secondary ds:UpToDate/Inconsistent C r---n-
9
    ns:716992 nr:0 dw:0 dr:719432 al:0 bm:43 lo:0 pe:33 ua:18 ap:0 ep:1 wo:f oos:335744
10
        [============>.......] sync'ed: 68.5% (335744/1048576)K
11
        finish: 0:00:05 speed: 64,800 (64,800) K/sec
b/test/hs/Test/Ganeti/Block/Drbd/Parser.hs
92 92
      UnconfiguredDevice 6
93 93
    ]
94 94

  
95
-- | Test a DRBD 8.4 file with an ongoing synchronization.
96
case_drbd84_sync :: Assertion
97
case_drbd84_sync = testFile "proc_drbd84_sync.txt" $
98
  DRBDStatus
99
    ( VersionInfo (Just "8.4.2") (Just "1") (Just "86-101") Nothing
100
        (Just "7ad5f850d711223713d6dcadc3dd48860321070c")
101
        (Just "root@example.com, 2013-04-10 07:45:25")
102
    )
103
    [ DeviceInfo 0 StandAlone (LocalRemote Primary Unknown)
104
        (LocalRemote UpToDate DUnknown) ' ' "r-----"
105
        (PerfIndicators 0 0 33318 730 15 0 0 0 0 0 (Just 1)
106
          (Just 'd') (Just 1048320))
107
        Nothing
108
        Nothing
109
        Nothing
110
        Nothing,
111
      UnconfiguredDevice 3,
112
      DeviceInfo 5 SyncSource (LocalRemote Secondary Secondary)
113
        (LocalRemote UpToDate Inconsistent) 'C' "r---n-"
114
        (PerfIndicators 716992 0 0 719432 0 43 0 33 18 0 (Just 1)
115
          (Just 'f') (Just 335744))
116
        (Just $ SyncStatus 68.5 335744 1048576 KiloByte (Time 0 0 5) 64800
117
          Nothing KiloByte Second)
118
        Nothing
119
        Nothing
120
        Nothing
121
    ]
122

  
123
-- | Test a DRBD 8.4 file.
124
case_drbd84 :: Assertion
125
case_drbd84 = testFile "proc_drbd84.txt" $
126
  DRBDStatus
127
    ( VersionInfo (Just "8.4.2") (Just "1") (Just "86-101") Nothing
128
      (Just "7ad5f850d711223713d6dcadc3dd48860321070c")
129
      (Just "root@example.com, 2013-04-10 07:45:25")
130
    )
131
    [ DeviceInfo 0 Connected (LocalRemote Primary Secondary)
132
        (LocalRemote UpToDate UpToDate) 'C' "r-----"
133
        (PerfIndicators 1048576 0 0 1048776 0 64 0 0 0 0 (Just 1)
134
          (Just 'f') (Just 0))
135
        Nothing
136
        Nothing
137
        Nothing
138
        Nothing,
139
      DeviceInfo 1 Connected (LocalRemote Secondary Primary)
140
        (LocalRemote UpToDate UpToDate) 'C' "r-----"
141
        (PerfIndicators 0 1048576 1048576 0 0 64 0 0 0 0 (Just 1)
142
          (Just 'f') (Just 0))
143
        Nothing
144
        Nothing
145
        Nothing
146
        Nothing,
147
      UnconfiguredDevice 2,
148
      DeviceInfo 4 WFConnection (LocalRemote Primary Unknown)
149
        (LocalRemote UpToDate DUnknown) 'C' "r-----"
150
        (PerfIndicators 0 0 0 200 0 0 0 0 0 0 (Just 1)
151
          (Just 'f') (Just 1048320))
152
        Nothing
153
        Nothing
154
        Nothing
155
        Nothing,
156
      DeviceInfo 6 Connected (LocalRemote Secondary Primary)
157
        (LocalRemote Diskless UpToDate) 'C' "r-----"
158
        (PerfIndicators 0 0 0 0 0 0 0 0 0 0 (Just 1) (Just 'b')
159
          (Just 0))
160
        Nothing
161
        Nothing
162
        Nothing
163
        Nothing,
164
      DeviceInfo 8 StandAlone (LocalRemote Secondary Unknown)
165
        (LocalRemote UpToDate DUnknown) ' ' "r-----"
166
        (PerfIndicators 0 0 0 200 0 0 0 0 0 0 (Just 1)
167
          (Just 'f') (Just 1048320))
168
        Nothing
169
        Nothing
170
        Nothing
171
        Nothing
172
    ]
173

  
95 174
-- | Test a DRBD 8.3 file with a NULL caracter inside.
96 175
case_drbd83_sync_krnl2_6_39 :: Assertion
97 176
case_drbd83_sync_krnl2_6_39 = testFile "proc_drbd83_sync_krnl2.6.39.txt" $
......
404 483
testSuite "Block/Drbd/Parser"
405 484
          [ 'case_drbd80_emptyline,
406 485
            'case_drbd80_emptyversion,
486
            'case_drbd84_sync,
487
            'case_drbd84,
407 488
            'case_drbd83_sync_krnl2_6_39,
408 489
            'case_drbd83_sync,
409 490
            'case_drbd83_sync_want,
b/test/py/ganeti.block.bdev_unittest.py
245 245
    proc83_sync_data = testutils.TestDataFilename("proc_drbd83_sync.txt")
246 246
    proc83_sync_krnl_data = \
247 247
      testutils.TestDataFilename("proc_drbd83_sync_krnl2.6.39.txt")
248
    proc84_data = testutils.TestDataFilename("proc_drbd84.txt")
249
    proc84_sync_data = testutils.TestDataFilename("proc_drbd84_sync.txt")
248 250

  
249 251
    self.proc80ev_data = \
250 252
      testutils.TestDataFilename("proc_drbd80-emptyversion.txt")
......
256 258
      drbd.DRBD8Info.CreateFromFile(filename=proc83_sync_data)
257 259
    self.drbd_info83_sync_krnl = \
258 260
      drbd.DRBD8Info.CreateFromFile(filename=proc83_sync_krnl_data)
261
    self.drbd_info84 = drbd.DRBD8Info.CreateFromFile(filename=proc84_data)
262
    self.drbd_info84_sync = \
263
      drbd.DRBD8Info.CreateFromFile(filename=proc84_sync_data)
259 264

  
260 265
  def testIOErrors(self):
261 266
    """Test handling of errors while reading the proc file."""
......
289 294

  
290 295
  def testMinor0(self):
291 296
    """Test connected, primary device"""
292
    for info in [self.drbd_info, self.drbd_info83]:
297
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info84]:
293 298
      stats = info.GetMinorStatus(0)
294 299
      self.failUnless(stats.is_in_use)
295 300
      self.failUnless(stats.is_connected and stats.is_primary and
......
297 302

  
298 303
  def testMinor1(self):
299 304
    """Test connected, secondary device"""
300
    for info in [self.drbd_info, self.drbd_info83]:
305
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info84]:
301 306
      stats = info.GetMinorStatus(1)
302 307
      self.failUnless(stats.is_in_use)
303 308
      self.failUnless(stats.is_connected and stats.is_secondary and
......
305 310

  
306 311
  def testMinor2(self):
307 312
    """Test unconfigured device"""
308
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info80e]:
313
    for info in [self.drbd_info, self.drbd_info83,
314
                 self.drbd_info80e, self.drbd_info84]:
309 315
      stats = info.GetMinorStatus(2)
310 316
      self.failIf(stats.is_in_use)
311 317

  
312 318
  def testMinor4(self):
313 319
    """Test WFconn device"""
314
    for info in [self.drbd_info, self.drbd_info83]:
320
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info84]:
315 321
      stats = info.GetMinorStatus(4)
316 322
      self.failUnless(stats.is_in_use)
317 323
      self.failUnless(stats.is_wfconn and stats.is_primary and
......
320 326

  
321 327
  def testMinor6(self):
322 328
    """Test diskless device"""
323
    for info in [self.drbd_info, self.drbd_info83]:
329
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info84]:
324 330
      stats = info.GetMinorStatus(6)
325 331
      self.failUnless(stats.is_in_use)
326 332
      self.failUnless(stats.is_connected and stats.is_secondary and
......
328 334

  
329 335
  def testMinor8(self):
330 336
    """Test standalone device"""
331
    for info in [self.drbd_info, self.drbd_info83]:
337
    for info in [self.drbd_info, self.drbd_info83, self.drbd_info84]:
332 338
      stats = info.GetMinorStatus(8)
333 339
      self.failUnless(stats.is_in_use)
334 340
      self.failUnless(stats.is_standalone and
......
345 351
    self.failUnless(stats.is_in_resync)
346 352
    self.failUnless(stats.sync_percent is not None)
347 353

  
354
  def testDRBD84Sync(self):
355
    stats = self.drbd_info84_sync.GetMinorStatus(5)
356
    self.failUnless(stats.is_in_resync)
357
    self.failUnless(stats.sync_percent is not None)
358

  
348 359
  def testDRBDEmptyVersion(self):
349 360
    self.assertRaises(errors.BlockDeviceError,
350 361
                      drbd.DRBD8Info.CreateFromFile,

Also available in: Unified diff