Revision fcee765d lib/bdev.py
b/lib/bdev.py | ||
---|---|---|
1 | 1 |
# |
2 | 2 |
# |
3 | 3 |
|
4 |
# Copyright (C) 2006, 2007 Google Inc. |
|
4 |
# Copyright (C) 2006, 2007, 2010 Google Inc.
|
|
5 | 5 |
# |
6 | 6 |
# This program is free software; you can redistribute it and/or modify |
7 | 7 |
# it under the terms of the GNU General Public License as published by |
... | ... | |
815 | 815 |
0.7 and 8.x versions of DRBD. |
816 | 816 |
|
817 | 817 |
""" |
818 |
_VERSION_RE = re.compile(r"^version: (\d+)\.(\d+)\.(\d+)" |
|
818 |
_VERSION_RE = re.compile(r"^version: (\d+)\.(\d+)\.(\d+)(?:\.\d+)?"
|
|
819 | 819 |
r" \(api:(\d+)/proto:(\d+)(?:-(\d+))?\)") |
820 | 820 |
_VALID_LINE_RE = re.compile("^ *([0-9]+): cs:([^ ]+).*$") |
821 | 821 |
_UNUSED_LINE_RE = re.compile("^ *([0-9]+): cs:Unconfigured$") |
... | ... | |
873 | 873 |
return results |
874 | 874 |
|
875 | 875 |
@classmethod |
876 |
def _GetVersion(cls): |
|
876 |
def _GetVersion(cls, proc_data):
|
|
877 | 877 |
"""Return the DRBD version. |
878 | 878 |
|
879 | 879 |
This will return a dict with keys: |
... | ... | |
885 | 885 |
- proto2 (only on drbd > 8.2.X) |
886 | 886 |
|
887 | 887 |
""" |
888 |
proc_data = cls._GetProcData() |
|
889 | 888 |
first_line = proc_data[0].strip() |
890 | 889 |
version = cls._VERSION_RE.match(first_line) |
891 | 890 |
if not version: |
... | ... | |
1034 | 1033 |
children = [] |
1035 | 1034 |
super(DRBD8, self).__init__(unique_id, children, size) |
1036 | 1035 |
self.major = self._DRBD_MAJOR |
1037 |
version = self._GetVersion() |
|
1036 |
version = self._GetVersion(self._GetProcData())
|
|
1038 | 1037 |
if version['k_major'] != 8 : |
1039 | 1038 |
_ThrowError("Mismatch in DRBD kernel version and requested ganeti" |
1040 | 1039 |
" usage: kernel is %s.%s, ganeti wants 8.x", |
... | ... | |
1260 | 1259 |
if size: |
1261 | 1260 |
args.extend(["-d", "%sm" % size]) |
1262 | 1261 |
if not constants.DRBD_BARRIERS: # disable barriers, if configured so |
1263 |
version = cls._GetVersion() |
|
1262 |
version = cls._GetVersion(cls._GetProcData())
|
|
1264 | 1263 |
# various DRBD versions support different disk barrier options; |
1265 | 1264 |
# what we aim here is to revert back to the 'drain' method of |
1266 | 1265 |
# disk flushes and to disable metadata barriers, in effect going |
Also available in: Unified diff