1 |
charliebrady |
1.1 |
# multipath.py |
2 |
|
|
# multipath device formats |
3 |
|
|
# |
4 |
|
|
# Copyright (C) 2009 Red Hat, Inc. |
5 |
|
|
# |
6 |
|
|
# This program is free software; you can redistribute it and/or modify |
7 |
|
|
# it under the terms of the GNU General Public License as published by |
8 |
|
|
# the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
# (at your option) any later version. |
10 |
|
|
# |
11 |
|
|
# This program is distributed in the hope that it will be useful, |
12 |
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
# GNU General Public License for more details. |
15 |
|
|
# |
16 |
|
|
# You should have received a copy of the GNU General Public License |
17 |
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
18 |
|
|
# |
19 |
|
|
# Any Red Hat trademarks that are incorporated in the source code or |
20 |
|
|
# documentation are not subject to the GNU General Public License and |
21 |
|
|
# may only be used or replicated with the express permission of |
22 |
|
|
# Red Hat, Inc. |
23 |
|
|
# |
24 |
|
|
# Red Hat Author(s): Peter Jones <pjones@redhat.com> |
25 |
|
|
# |
26 |
|
|
|
27 |
|
|
from ..storage_log import log_method_call |
28 |
|
|
from ..errors import * |
29 |
|
|
from . import DeviceFormat, register_device_format |
30 |
|
|
|
31 |
|
|
import gettext |
32 |
|
|
_ = lambda x: gettext.ldgettext("anaconda", x) |
33 |
|
|
|
34 |
|
|
import logging |
35 |
|
|
log = logging.getLogger("storage") |
36 |
|
|
|
37 |
|
|
class MultipathMember(DeviceFormat): |
38 |
|
|
""" A multipath member disk. """ |
39 |
|
|
_type = "multipath_member" |
40 |
|
|
_name = "multipath member device" |
41 |
|
|
_udev_types = ["multipath_member"] |
42 |
|
|
_formattable = False # can be formatted |
43 |
|
|
_supported = True # is supported |
44 |
|
|
_linuxNative = False # for clearpart |
45 |
|
|
_packages = ["device-mapper-multipath"] # required packages |
46 |
|
|
_resizable = False # can be resized |
47 |
|
|
_bootable = False # can be used as boot |
48 |
|
|
_maxSize = 0 # maximum size in MB |
49 |
|
|
_minSize = 0 # minimum size in MB |
50 |
|
|
_hidden = True # hide devices with this formatting? |
51 |
|
|
|
52 |
|
|
def __init__(self, *args, **kwargs): |
53 |
|
|
""" Create a DeviceFormat instance. |
54 |
|
|
|
55 |
|
|
Keyword Arguments: |
56 |
|
|
|
57 |
|
|
device -- path to the underlying device |
58 |
|
|
uuid -- this format's UUID |
59 |
|
|
exists -- indicates whether this is an existing format |
60 |
|
|
|
61 |
|
|
On initialization this format is like DeviceFormat |
62 |
|
|
|
63 |
|
|
""" |
64 |
|
|
log_method_call(self, *args, **kwargs) |
65 |
|
|
DeviceFormat.__init__(self, *args, **kwargs) |
66 |
|
|
|
67 |
|
|
# Initialize the attribute that will hold the block object. |
68 |
|
|
self._member = None |
69 |
|
|
|
70 |
|
|
def __str__(self): |
71 |
|
|
s = DeviceFormat.__str__(self) |
72 |
|
|
s += (" member = %(member)r" % {"member": self.member}) |
73 |
|
|
return s |
74 |
|
|
|
75 |
|
|
def _getMember(self): |
76 |
|
|
return self._member |
77 |
|
|
|
78 |
|
|
def _setMember(self, member): |
79 |
|
|
self._member = member |
80 |
|
|
|
81 |
|
|
member = property(lambda s: s._getMember(), |
82 |
|
|
lambda s,m: s._setMember(m)) |
83 |
|
|
|
84 |
|
|
def create(self, *args, **kwargs): |
85 |
|
|
log_method_call(self, device=self.device, |
86 |
|
|
type=self.type, status=self.status) |
87 |
|
|
raise MultipathMemberError("creation of multipath members is non-sense") |
88 |
|
|
|
89 |
|
|
def destroy(self, *args, **kwargs): |
90 |
|
|
log_method_call(self, device=self.device, |
91 |
|
|
type=self.type, status=self.status) |
92 |
|
|
raise MultipathMemberError("destruction of multipath members is non-sense") |
93 |
|
|
|
94 |
|
|
register_device_format(MultipathMember) |
95 |
|
|
|