Revision 8520f4b9 test/py/ganeti.storage.drbd_unittest.py

b/test/py/ganeti.storage.drbd_unittest.py
85 85
  """Testing case for drbd.DRBD8Dev"""
86 86

  
87 87
  @staticmethod
88
  def _has_disk(data, dname, mname):
88
  def _has_disk(data, dname, mname, meta_index=0):
89 89
    """Check local disk corectness"""
90 90
    retval = (
91 91
      "local_dev" in data and
92 92
      data["local_dev"] == dname and
93 93
      "meta_dev" in data and
94 94
      data["meta_dev"] == mname and
95
      "meta_index" in data and
96
      data["meta_index"] == 0
95
      ((meta_index is None and
96
        "meta_index" not in data) or
97
       ("meta_index" in data and
98
        data["meta_index"] == meta_index)
99
      )
97 100
      )
98 101
    return retval
99 102

  
......
149 152
                                  ("192.0.2.2", 11000)),
150 153
                    "Wrong network info (8.4.x)")
151 154

  
155
  def testParser84NoDiskParams(self):
156
    """Test drbdsetup show parser for 8.4 without disk params
157

  
158
    The missing disk parameters occur after re-attaching a local disk but
159
    before setting the disk params.
160

  
161
    """
162
    data = testutils.ReadTestData("bdev-drbd-8.4-no-disk-params.txt")
163
    result = drbd_info.DRBD84ShowInfo.GetDevInfo(data)
164
    self.failUnless(self._has_disk(result, "/dev/xenvg/test.data",
165
                                   "/dev/xenvg/test.meta", meta_index=None),
166
                    "Wrong local disk info")
167
    self.failUnless(self._has_net(result, ("192.0.2.1", 11000),
168
                                  ("192.0.2.2", 11000)),
169
                    "Wrong network info (8.4.x)")
170

  
152 171
  def testParserNetIP4(self):
153 172
    """Test drbdsetup show parser for IPv4 network"""
154 173
    data = testutils.ReadTestData("bdev-drbd-net-ip4.txt")

Also available in: Unified diff