Revision 09a78e1c test/py/ganeti.block.bdev_unittest.py

b/test/py/ganeti.block.bdev_unittest.py
34 34
from ganeti.block import bdev
35 35
from ganeti.block import drbd
36 36
from ganeti.block import drbd_info
37
from ganeti.block import drbd_cmdgen
37 38

  
38 39
import testutils
39 40

  
......
192 193

  
193 194
    for vmaj, vmin, vrel, opts, meta in should_fail:
194 195
      self.assertRaises(errors.BlockDeviceError,
195
                        drbd.DRBD8._ComputeDiskBarrierArgs,
196
                        drbd_cmdgen.DRBD83CmdGenerator._ComputeDiskBarrierArgs,
196 197
                        vmaj, vmin, vrel, opts, meta)
197 198

  
198 199
    # get the valid options from the frozenset(frozenset()) in constants.
......
201 202
    # Versions that do not support anything
202 203
    for vmaj, vmin, vrel in ((8, 0, 0), (8, 0, 11), (8, 2, 6)):
203 204
      for opts in valid_options:
204
        self.assertRaises(errors.BlockDeviceError,
205
                          drbd.DRBD8._ComputeDiskBarrierArgs,
206
                          vmaj, vmin, vrel, opts, True)
205
        self.assertRaises(
206
          errors.BlockDeviceError,
207
          drbd_cmdgen.DRBD83CmdGenerator._ComputeDiskBarrierArgs,
208
          vmaj, vmin, vrel, opts, True)
207 209

  
208 210
    # Versions with partial support (testing only options that are supported)
209 211
    tests = [
......
230 232
    for test in tests:
231 233
      vmaj, vmin, vrel, disabled_barriers, disable_meta_flush, expected = test
232 234
      args = \
233
        drbd.DRBD8._ComputeDiskBarrierArgs(vmaj, vmin, vrel,
234
                                           disabled_barriers,
235
                                           disable_meta_flush)
235
        drbd_cmdgen.DRBD83CmdGenerator._ComputeDiskBarrierArgs(
236
          vmaj, vmin, vrel,
237
          disabled_barriers,
238
          disable_meta_flush)
236 239
      self.failUnless(set(args) == set(expected),
237 240
                      "For test %s, got wrong results %s" % (test, args))
238 241

  
239 242
    # Unsupported or invalid versions
240 243
    for vmaj, vmin, vrel in ((0, 7, 25), (9, 0, 0), (7, 0, 0), (8, 4, 0)):
241 244
      self.assertRaises(errors.BlockDeviceError,
242
                        drbd.DRBD8._ComputeDiskBarrierArgs,
245
                        drbd_cmdgen.DRBD83CmdGenerator._ComputeDiskBarrierArgs,
243 246
                        vmaj, vmin, vrel, "n", True)
244 247

  
245 248
    # Invalid options
246 249
    for option in ("", "c", "whatever", "nbdfc", "nf"):
247 250
      self.assertRaises(errors.BlockDeviceError,
248
                        drbd.DRBD8._ComputeDiskBarrierArgs,
251
                        drbd_cmdgen.DRBD83CmdGenerator._ComputeDiskBarrierArgs,
249 252
                        8, 3, 11, option, True)
250 253

  
251 254

  

Also available in: Unified diff