Revision 8520f4b9

b/Makefile.am
1117 1117
	test/data/bdev-drbd-8.0.txt \
1118 1118
	test/data/bdev-drbd-8.3.txt \
1119 1119
	test/data/bdev-drbd-8.4.txt \
1120
	test/data/bdev-drbd-8.4-no-disk-params.txt \
1120 1121
	test/data/bdev-drbd-disk.txt \
1121 1122
	test/data/bdev-drbd-net-ip4.txt \
1122 1123
	test/data/bdev-drbd-net-ip6.txt \
b/test/data/bdev-drbd-8.4-no-disk-params.txt
1
resource resource0 {
2
    options {
3
    }
4
    net {
5
        cram-hmac-alg           "md5";
6
        shared-secret           "shared_secret_123";
7
        after-sb-0pri           discard-zero-changes;
8
        after-sb-1pri           consensus;
9
    }
10
    _remote_host {
11
        address                 ipv4 192.0.2.2:11000;
12
    }
13
    _this_host {
14
        address                 ipv4 192.0.2.1:11000;
15
        volume 0 {
16
            device                      minor 0;
17
            disk                        "/dev/xenvg/test.data";
18
            meta-disk                   "/dev/xenvg/test.meta";
19
            disk {
20
            }
21
        }
22
    }
23
}
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