Revision 65fc2388
b/lib/constants.py | ||
---|---|---|
583 | 583 |
|
584 | 584 |
# drbd constants |
585 | 585 |
DRBD_HMAC_ALG = "md5" |
586 |
DRBD_NET_PROTOCOL = "C" |
|
586 |
DRBD_DEFAULT_NET_PROTOCOL = "C" |
|
587 |
DRBD_MIGRATION_NET_PROTOCOL = "C" |
|
587 | 588 |
DRBD_STATUS_FILE = "/proc/drbd" |
588 | 589 |
|
589 | 590 |
#: Size of DRBD meta block device |
... | ... | |
1208 | 1209 |
LDP_DEFAULT_METAVG = "default-metavg" |
1209 | 1210 |
LDP_DISK_CUSTOM = "disk-custom" |
1210 | 1211 |
LDP_NET_CUSTOM = "net-custom" |
1212 |
LDP_PROTOCOL = "protocol" |
|
1211 | 1213 |
LDP_DYNAMIC_RESYNC = "dynamic-resync" |
1212 | 1214 |
LDP_PLAN_AHEAD = "c-plan-ahead" |
1213 | 1215 |
LDP_FILL_TARGET = "c-fill-target" |
... | ... | |
1223 | 1225 |
LDP_DEFAULT_METAVG: VTYPE_STRING, |
1224 | 1226 |
LDP_DISK_CUSTOM: VTYPE_STRING, |
1225 | 1227 |
LDP_NET_CUSTOM: VTYPE_STRING, |
1228 |
LDP_PROTOCOL: VTYPE_STRING, |
|
1226 | 1229 |
LDP_DYNAMIC_RESYNC: VTYPE_BOOL, |
1227 | 1230 |
LDP_PLAN_AHEAD: VTYPE_INT, |
1228 | 1231 |
LDP_FILL_TARGET: VTYPE_INT, |
... | ... | |
1243 | 1246 |
DRBD_DEFAULT_METAVG = "metavg" |
1244 | 1247 |
DRBD_DISK_CUSTOM = "disk-custom" |
1245 | 1248 |
DRBD_NET_CUSTOM = "net-custom" |
1249 |
DRBD_PROTOCOL = "protocol" |
|
1246 | 1250 |
DRBD_DYNAMIC_RESYNC = "dynamic-resync" |
1247 | 1251 |
DRBD_PLAN_AHEAD = "c-plan-ahead" |
1248 | 1252 |
DRBD_FILL_TARGET = "c-fill-target" |
... | ... | |
1260 | 1264 |
DRBD_DEFAULT_METAVG: VTYPE_STRING, |
1261 | 1265 |
DRBD_DISK_CUSTOM: VTYPE_STRING, |
1262 | 1266 |
DRBD_NET_CUSTOM: VTYPE_STRING, |
1267 |
DRBD_PROTOCOL: VTYPE_STRING, |
|
1263 | 1268 |
DRBD_DYNAMIC_RESYNC: VTYPE_BOOL, |
1264 | 1269 |
DRBD_PLAN_AHEAD: VTYPE_INT, |
1265 | 1270 |
DRBD_FILL_TARGET: VTYPE_INT, |
... | ... | |
2184 | 2189 |
LDP_DEFAULT_METAVG: DEFAULT_VG, |
2185 | 2190 |
LDP_DISK_CUSTOM: "", |
2186 | 2191 |
LDP_NET_CUSTOM: "", |
2192 |
LDP_PROTOCOL: DRBD_DEFAULT_NET_PROTOCOL, |
|
2187 | 2193 |
LDP_DYNAMIC_RESYNC: False, |
2188 | 2194 |
|
2189 | 2195 |
# The default values for the DRBD dynamic resync speed algorithm |
... | ... | |
2225 | 2231 |
DRBD_DEFAULT_METAVG: _DRBD_DEFAULTS[LDP_DEFAULT_METAVG], |
2226 | 2232 |
DRBD_DISK_CUSTOM: _DRBD_DEFAULTS[LDP_DISK_CUSTOM], |
2227 | 2233 |
DRBD_NET_CUSTOM: _DRBD_DEFAULTS[LDP_NET_CUSTOM], |
2234 |
DRBD_PROTOCOL: _DRBD_DEFAULTS[LDP_PROTOCOL], |
|
2228 | 2235 |
DRBD_DYNAMIC_RESYNC: _DRBD_DEFAULTS[LDP_DYNAMIC_RESYNC], |
2229 | 2236 |
DRBD_PLAN_AHEAD: _DRBD_DEFAULTS[LDP_PLAN_AHEAD], |
2230 | 2237 |
DRBD_FILL_TARGET: _DRBD_DEFAULTS[LDP_FILL_TARGET], |
b/lib/objects.py | ||
---|---|---|
865 | 865 |
constants.LDP_DEFAULT_METAVG: dt_params[constants.DRBD_DEFAULT_METAVG], |
866 | 866 |
constants.LDP_DISK_CUSTOM: dt_params[constants.DRBD_DISK_CUSTOM], |
867 | 867 |
constants.LDP_NET_CUSTOM: dt_params[constants.DRBD_NET_CUSTOM], |
868 |
constants.LDP_PROTOCOL: dt_params[constants.DRBD_PROTOCOL], |
|
868 | 869 |
constants.LDP_DYNAMIC_RESYNC: dt_params[constants.DRBD_DYNAMIC_RESYNC], |
869 | 870 |
constants.LDP_PLAN_AHEAD: dt_params[constants.DRBD_PLAN_AHEAD], |
870 | 871 |
constants.LDP_FILL_TARGET: dt_params[constants.DRBD_FILL_TARGET], |
b/lib/storage/drbd.py | ||
---|---|---|
377 | 377 |
base.ThrowError("drbd%d: can't attach local disk: %s", |
378 | 378 |
minor, result.output) |
379 | 379 |
|
380 |
def _AssembleNet(self, minor, net_info, protocol,
|
|
381 |
dual_pri=False, hmac=None, secret=None):
|
|
380 |
def _AssembleNet(self, minor, net_info, dual_pri=False, hmac=None,
|
|
381 |
secret=None): |
|
382 | 382 |
"""Configure the network part of the device. |
383 | 383 |
|
384 | 384 |
@type minor: int |
... | ... | |
386 | 386 |
@type net_info: (string, int, string, int) |
387 | 387 |
@param net_info: tuple containing the local address, local port, remote |
388 | 388 |
address and remote port |
389 |
@type protocol: string |
|
390 |
@param protocol: either "ipv4" or "ipv6" |
|
391 | 389 |
@type dual_pri: boolean |
392 | 390 |
@param dual_pri: whether two primaries should be allowed or not |
393 | 391 |
@type hmac: string |
... | ... | |
403 | 401 |
self._ShutdownNet(minor) |
404 | 402 |
return |
405 | 403 |
|
404 |
if dual_pri: |
|
405 |
protocol = constants.DRBD_MIGRATION_NET_PROTOCOL |
|
406 |
else: |
|
407 |
protocol = self.params[constants.LDP_PROTOCOL] |
|
408 |
|
|
406 | 409 |
# Workaround for a race condition. When DRBD is doing its dance to |
407 | 410 |
# establish a connection with its peer, it also sends the |
408 | 411 |
# synchronization speed over the wire. In some cases setting the |
... | ... | |
747 | 750 |
|
748 | 751 |
self._AssembleNet(self.minor, |
749 | 752 |
(self._lhost, self._lport, self._rhost, self._rport), |
750 |
constants.DRBD_NET_PROTOCOL, dual_pri=multimaster,
|
|
751 |
hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
|
|
753 |
dual_pri=multimaster, hmac=constants.DRBD_HMAC_ALG,
|
|
754 |
secret=self._secret) |
|
752 | 755 |
|
753 | 756 |
def Attach(self): |
754 | 757 |
"""Check if our minor is configured. |
... | ... | |
818 | 821 |
|
819 | 822 |
if match_l and not match_r and "local_addr" not in info: |
820 | 823 |
# disk matches, but not attached to network, attach and recheck |
821 |
self._AssembleNet(minor, net_data, constants.DRBD_NET_PROTOCOL,
|
|
822 |
hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
|
|
824 |
self._AssembleNet(minor, net_data, hmac=constants.DRBD_HMAC_ALG,
|
|
825 |
secret=self._secret) |
|
823 | 826 |
if self._MatchesNet(self._GetShowInfo(minor)): |
824 | 827 |
break |
825 | 828 |
else: |
... | ... | |
855 | 858 |
# note: _AssembleNet also handles the case when we don't want |
856 | 859 |
# local storage (i.e. one or more of the _[lr](host|port) is |
857 | 860 |
# None) |
858 |
self._AssembleNet(minor, net_data, constants.DRBD_NET_PROTOCOL,
|
|
859 |
hmac=constants.DRBD_HMAC_ALG, secret=self._secret)
|
|
861 |
self._AssembleNet(minor, net_data, hmac=constants.DRBD_HMAC_ALG,
|
|
862 |
secret=self._secret) |
|
860 | 863 |
if self._MatchesNet(self._GetShowInfo(minor)): |
861 | 864 |
break |
862 | 865 |
else: |
... | ... | |
884 | 887 |
if self._lhost and self._lport and self._rhost and self._rport: |
885 | 888 |
self._AssembleNet(minor, |
886 | 889 |
(self._lhost, self._lport, self._rhost, self._rport), |
887 |
constants.DRBD_NET_PROTOCOL, |
|
888 | 890 |
hmac=constants.DRBD_HMAC_ALG, secret=self._secret) |
889 | 891 |
self._SetFromMinor(minor) |
890 | 892 |
|
Also available in: Unified diff