diff options
author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2014-08-04 08:36:24 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-08-11 10:53:10 +0100 |
commit | 5a8bcfb56244c8095efe080b3730927d0398845a (patch) | |
tree | 7adccfb2a5f43e6a16551da62aa083035c88ebc3 /scripts/lib/mic/3rdparty/pykickstart/commands/raid.py | |
parent | c9b5ea08734c5bb588de0505e6b762691ac9223a (diff) | |
download | poky-5a8bcfb56244c8095efe080b3730927d0398845a.tar.gz |
wic: Remove unused 3rdparty/commands
wic doesn't use anything but partition and bootloader, so remove the
rest.
(From OE-Core rev: b6ae106b5d28180a5890e837c87f3e91e5917638)
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands/raid.py')
-rw-r--r-- | scripts/lib/mic/3rdparty/pykickstart/commands/raid.py | 365 |
1 files changed, 0 insertions, 365 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py b/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py deleted file mode 100644 index 0f4c92a107..0000000000 --- a/scripts/lib/mic/3rdparty/pykickstart/commands/raid.py +++ /dev/null | |||
@@ -1,365 +0,0 @@ | |||
1 | # | ||
2 | # Chris Lumens <clumens@redhat.com> | ||
3 | # | ||
4 | # Copyright 2005, 2006, 2007, 2008, 2011 Red Hat, Inc. | ||
5 | # | ||
6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
8 | # General Public License v.2. This program is distributed in the hope that it | ||
9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
11 | # See the GNU General Public License for more details. | ||
12 | # | ||
13 | # You should have received a copy of the GNU General Public License along with | ||
14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
16 | # trademarks that are incorporated in the source code or documentation are not | ||
17 | # subject to the GNU General Public License and may only be used or replicated | ||
18 | # with the express permission of Red Hat, Inc. | ||
19 | # | ||
20 | from pykickstart.base import * | ||
21 | from pykickstart.errors import * | ||
22 | from pykickstart.options import * | ||
23 | |||
24 | import gettext | ||
25 | import warnings | ||
26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
27 | |||
28 | class FC3_RaidData(BaseData): | ||
29 | removedKeywords = BaseData.removedKeywords | ||
30 | removedAttrs = BaseData.removedAttrs | ||
31 | |||
32 | def __init__(self, *args, **kwargs): | ||
33 | BaseData.__init__(self, *args, **kwargs) | ||
34 | self.device = kwargs.get("device", None) | ||
35 | self.fstype = kwargs.get("fstype", "") | ||
36 | self.level = kwargs.get("level", "") | ||
37 | self.format = kwargs.get("format", True) | ||
38 | self.spares = kwargs.get("spares", 0) | ||
39 | self.preexist = kwargs.get("preexist", False) | ||
40 | self.mountpoint = kwargs.get("mountpoint", "") | ||
41 | self.members = kwargs.get("members", []) | ||
42 | |||
43 | def __eq__(self, y): | ||
44 | return self.device == y.device | ||
45 | |||
46 | def _getArgsAsStr(self): | ||
47 | retval = "" | ||
48 | |||
49 | if self.device != "": | ||
50 | retval += " --device=%s" % self.device | ||
51 | if self.fstype != "": | ||
52 | retval += " --fstype=\"%s\"" % self.fstype | ||
53 | if self.level != "": | ||
54 | retval += " --level=%s" % self.level | ||
55 | if not self.format: | ||
56 | retval += " --noformat" | ||
57 | if self.spares != 0: | ||
58 | retval += " --spares=%d" % self.spares | ||
59 | if self.preexist: | ||
60 | retval += " --useexisting" | ||
61 | |||
62 | return retval | ||
63 | |||
64 | def __str__(self): | ||
65 | retval = BaseData.__str__(self) | ||
66 | retval += "raid %s%s %s\n" % (self.mountpoint, self._getArgsAsStr(), | ||
67 | " ".join(self.members)) | ||
68 | return retval | ||
69 | |||
70 | class FC4_RaidData(FC3_RaidData): | ||
71 | removedKeywords = FC3_RaidData.removedKeywords | ||
72 | removedAttrs = FC3_RaidData.removedAttrs | ||
73 | |||
74 | def __init__(self, *args, **kwargs): | ||
75 | FC3_RaidData.__init__(self, *args, **kwargs) | ||
76 | self.fsopts = kwargs.get("fsopts", "") | ||
77 | |||
78 | def _getArgsAsStr(self): | ||
79 | retval = FC3_RaidData._getArgsAsStr(self) | ||
80 | |||
81 | if self.fsopts != "": | ||
82 | retval += " --fsoptions=\"%s\"" % self.fsopts | ||
83 | |||
84 | return retval | ||
85 | |||
86 | class FC5_RaidData(FC4_RaidData): | ||
87 | removedKeywords = FC4_RaidData.removedKeywords | ||
88 | removedAttrs = FC4_RaidData.removedAttrs | ||
89 | |||
90 | def __init__(self, *args, **kwargs): | ||
91 | FC4_RaidData.__init__(self, *args, **kwargs) | ||
92 | self.bytesPerInode = kwargs.get("bytesPerInode", 4096) | ||
93 | |||
94 | def _getArgsAsStr(self): | ||
95 | retval = FC4_RaidData._getArgsAsStr(self) | ||
96 | |||
97 | if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: | ||
98 | retval += " --bytes-per-inode=%d" % self.bytesPerInode | ||
99 | |||
100 | return retval | ||
101 | |||
102 | class RHEL5_RaidData(FC5_RaidData): | ||
103 | removedKeywords = FC5_RaidData.removedKeywords | ||
104 | removedAttrs = FC5_RaidData.removedAttrs | ||
105 | |||
106 | def __init__(self, *args, **kwargs): | ||
107 | FC5_RaidData.__init__(self, *args, **kwargs) | ||
108 | self.encrypted = kwargs.get("encrypted", False) | ||
109 | self.passphrase = kwargs.get("passphrase", "") | ||
110 | |||
111 | def _getArgsAsStr(self): | ||
112 | retval = FC5_RaidData._getArgsAsStr(self) | ||
113 | |||
114 | if self.encrypted: | ||
115 | retval += " --encrypted" | ||
116 | |||
117 | if self.passphrase != "": | ||
118 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
119 | |||
120 | return retval | ||
121 | |||
122 | F7_RaidData = FC5_RaidData | ||
123 | |||
124 | class F9_RaidData(FC5_RaidData): | ||
125 | removedKeywords = FC5_RaidData.removedKeywords + ["bytesPerInode"] | ||
126 | removedAttrs = FC5_RaidData.removedAttrs + ["bytesPerInode"] | ||
127 | |||
128 | def __init__(self, *args, **kwargs): | ||
129 | FC5_RaidData.__init__(self, *args, **kwargs) | ||
130 | self.deleteRemovedAttrs() | ||
131 | |||
132 | self.fsprofile = kwargs.get("fsprofile", "") | ||
133 | self.encrypted = kwargs.get("encrypted", False) | ||
134 | self.passphrase = kwargs.get("passphrase", "") | ||
135 | |||
136 | def _getArgsAsStr(self): | ||
137 | retval = FC5_RaidData._getArgsAsStr(self) | ||
138 | |||
139 | if self.fsprofile != "": | ||
140 | retval += " --fsprofile=\"%s\"" % self.fsprofile | ||
141 | if self.encrypted: | ||
142 | retval += " --encrypted" | ||
143 | |||
144 | if self.passphrase != "": | ||
145 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
146 | |||
147 | return retval | ||
148 | |||
149 | class F12_RaidData(F9_RaidData): | ||
150 | removedKeywords = F9_RaidData.removedKeywords | ||
151 | removedAttrs = F9_RaidData.removedAttrs | ||
152 | |||
153 | def __init__(self, *args, **kwargs): | ||
154 | F9_RaidData.__init__(self, *args, **kwargs) | ||
155 | self.deleteRemovedAttrs() | ||
156 | |||
157 | self.escrowcert = kwargs.get("escrowcert", "") | ||
158 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
159 | |||
160 | def _getArgsAsStr(self): | ||
161 | retval = F9_RaidData._getArgsAsStr(self) | ||
162 | |||
163 | if self.encrypted and self.escrowcert != "": | ||
164 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
165 | |||
166 | if self.backuppassphrase: | ||
167 | retval += " --backuppassphrase" | ||
168 | return retval | ||
169 | |||
170 | F13_RaidData = F12_RaidData | ||
171 | |||
172 | F14_RaidData = F13_RaidData | ||
173 | |||
174 | class F15_RaidData(F14_RaidData): | ||
175 | removedKeywords = F14_RaidData.removedKeywords | ||
176 | removedAttrs = F14_RaidData.removedAttrs | ||
177 | |||
178 | def __init__(self, *args, **kwargs): | ||
179 | F14_RaidData.__init__(self, *args, **kwargs) | ||
180 | self.deleteRemovedAttrs() | ||
181 | |||
182 | self.label = kwargs.get("label", "") | ||
183 | |||
184 | def _getArgsAsStr(self): | ||
185 | retval = F14_RaidData._getArgsAsStr(self) | ||
186 | |||
187 | if self.label != "": | ||
188 | retval += " --label=%s" % self.label | ||
189 | |||
190 | return retval | ||
191 | |||
192 | class FC3_Raid(KickstartCommand): | ||
193 | removedKeywords = KickstartCommand.removedKeywords | ||
194 | removedAttrs = KickstartCommand.removedAttrs | ||
195 | |||
196 | def __init__(self, writePriority=131, *args, **kwargs): | ||
197 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
198 | self.op = self._getParser() | ||
199 | |||
200 | # A dict of all the RAID levels we support. This means that if we | ||
201 | # support more levels in the future, subclasses don't have to | ||
202 | # duplicate too much. | ||
203 | self.levelMap = { "RAID0": "RAID0", "0": "RAID0", | ||
204 | "RAID1": "RAID1", "1": "RAID1", | ||
205 | "RAID5": "RAID5", "5": "RAID5", | ||
206 | "RAID6": "RAID6", "6": "RAID6" } | ||
207 | |||
208 | self.raidList = kwargs.get("raidList", []) | ||
209 | |||
210 | def __str__(self): | ||
211 | retval = "" | ||
212 | |||
213 | for raid in self.raidList: | ||
214 | retval += raid.__str__() | ||
215 | |||
216 | return retval | ||
217 | |||
218 | def _getParser(self): | ||
219 | def raid_cb (option, opt_str, value, parser): | ||
220 | parser.values.format = False | ||
221 | parser.values.preexist = True | ||
222 | |||
223 | def device_cb (option, opt_str, value, parser): | ||
224 | if value[0:2] == "md": | ||
225 | parser.values.ensure_value(option.dest, value[2:]) | ||
226 | else: | ||
227 | parser.values.ensure_value(option.dest, value) | ||
228 | |||
229 | def level_cb (option, opt_str, value, parser): | ||
230 | if self.levelMap.has_key(value): | ||
231 | parser.values.ensure_value(option.dest, self.levelMap[value]) | ||
232 | |||
233 | op = KSOptionParser() | ||
234 | op.add_option("--device", action="callback", callback=device_cb, | ||
235 | dest="device", type="string", nargs=1, required=1) | ||
236 | op.add_option("--fstype", dest="fstype") | ||
237 | op.add_option("--level", dest="level", action="callback", | ||
238 | callback=level_cb, type="string", nargs=1) | ||
239 | op.add_option("--noformat", action="callback", callback=raid_cb, | ||
240 | dest="format", default=True, nargs=0) | ||
241 | op.add_option("--spares", dest="spares", action="store", type="int", | ||
242 | nargs=1, default=0) | ||
243 | op.add_option("--useexisting", dest="preexist", action="store_true", | ||
244 | default=False) | ||
245 | return op | ||
246 | |||
247 | def parse(self, args): | ||
248 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
249 | |||
250 | if len(extra) == 0: | ||
251 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Mount point required for %s") % "raid") | ||
252 | if len(extra) == 1: | ||
253 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Partitions required for %s") % "raid") | ||
254 | |||
255 | rd = self.handler.RaidData() | ||
256 | self._setToObj(self.op, opts, rd) | ||
257 | rd.lineno = self.lineno | ||
258 | |||
259 | # --device can't just take an int in the callback above, because it | ||
260 | # could be specificed as "mdX", which causes optparse to error when | ||
261 | # it runs int(). | ||
262 | rd.device = int(rd.device) | ||
263 | rd.mountpoint = extra[0] | ||
264 | rd.members = extra[1:] | ||
265 | |||
266 | # Check for duplicates in the data list. | ||
267 | if rd in self.dataList(): | ||
268 | warnings.warn(_("A RAID device with the name %s has already been defined.") % rd.device) | ||
269 | |||
270 | return rd | ||
271 | |||
272 | def dataList(self): | ||
273 | return self.raidList | ||
274 | |||
275 | class FC4_Raid(FC3_Raid): | ||
276 | removedKeywords = FC3_Raid.removedKeywords | ||
277 | removedAttrs = FC3_Raid.removedAttrs | ||
278 | |||
279 | def _getParser(self): | ||
280 | op = FC3_Raid._getParser(self) | ||
281 | op.add_option("--fsoptions", dest="fsopts") | ||
282 | return op | ||
283 | |||
284 | class FC5_Raid(FC4_Raid): | ||
285 | removedKeywords = FC4_Raid.removedKeywords | ||
286 | removedAttrs = FC4_Raid.removedAttrs | ||
287 | |||
288 | def _getParser(self): | ||
289 | op = FC4_Raid._getParser(self) | ||
290 | op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", | ||
291 | type="int", nargs=1) | ||
292 | return op | ||
293 | |||
294 | class RHEL5_Raid(FC5_Raid): | ||
295 | removedKeywords = FC5_Raid.removedKeywords | ||
296 | removedAttrs = FC5_Raid.removedAttrs | ||
297 | |||
298 | def __init__(self, writePriority=131, *args, **kwargs): | ||
299 | FC5_Raid.__init__(self, writePriority, *args, **kwargs) | ||
300 | |||
301 | self.levelMap.update({"RAID10": "RAID10", "10": "RAID10"}) | ||
302 | |||
303 | def _getParser(self): | ||
304 | op = FC5_Raid._getParser(self) | ||
305 | op.add_option("--encrypted", action="store_true", default=False) | ||
306 | op.add_option("--passphrase") | ||
307 | return op | ||
308 | |||
309 | class F7_Raid(FC5_Raid): | ||
310 | removedKeywords = FC5_Raid.removedKeywords | ||
311 | removedAttrs = FC5_Raid.removedAttrs | ||
312 | |||
313 | def __init__(self, writePriority=131, *args, **kwargs): | ||
314 | FC5_Raid.__init__(self, writePriority, *args, **kwargs) | ||
315 | |||
316 | self.levelMap.update({"RAID10": "RAID10", "10": "RAID10"}) | ||
317 | |||
318 | class F9_Raid(F7_Raid): | ||
319 | removedKeywords = F7_Raid.removedKeywords | ||
320 | removedAttrs = F7_Raid.removedAttrs | ||
321 | |||
322 | def _getParser(self): | ||
323 | op = F7_Raid._getParser(self) | ||
324 | op.add_option("--bytes-per-inode", deprecated=1) | ||
325 | op.add_option("--fsprofile") | ||
326 | op.add_option("--encrypted", action="store_true", default=False) | ||
327 | op.add_option("--passphrase") | ||
328 | return op | ||
329 | |||
330 | class F12_Raid(F9_Raid): | ||
331 | removedKeywords = F9_Raid.removedKeywords | ||
332 | removedAttrs = F9_Raid.removedAttrs | ||
333 | |||
334 | def _getParser(self): | ||
335 | op = F9_Raid._getParser(self) | ||
336 | op.add_option("--escrowcert") | ||
337 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
338 | return op | ||
339 | |||
340 | class F13_Raid(F12_Raid): | ||
341 | removedKeywords = F12_Raid.removedKeywords | ||
342 | removedAttrs = F12_Raid.removedAttrs | ||
343 | |||
344 | def __init__(self, writePriority=131, *args, **kwargs): | ||
345 | F12_Raid.__init__(self, writePriority, *args, **kwargs) | ||
346 | |||
347 | self.levelMap.update({"RAID4": "RAID4", "4": "RAID4"}) | ||
348 | |||
349 | class F14_Raid(F13_Raid): | ||
350 | removedKeywords = F13_Raid.removedKeywords | ||
351 | removedAttrs = F13_Raid.removedAttrs | ||
352 | |||
353 | def _getParser(self): | ||
354 | op = F13_Raid._getParser(self) | ||
355 | op.remove_option("--bytes-per-inode") | ||
356 | return op | ||
357 | |||
358 | class F15_Raid(F14_Raid): | ||
359 | removedKeywords = F14_Raid.removedKeywords | ||
360 | removedAttrs = F14_Raid.removedAttrs | ||
361 | |||
362 | def _getParser(self): | ||
363 | op = F14_Raid._getParser(self) | ||
364 | op.add_option("--label") | ||
365 | return op | ||