summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@linux.intel.com>2013-08-24 15:31:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-01 22:56:03 +0100
commit9fc88f96d40b17c90bac53b90045a87b2d2cff84 (patch)
tree63010e5aabf895697655baf89bd668d6752b3f97 /scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py
parent53a1d9a788fd9f970af980da2ab975cca60685c4 (diff)
downloadpoky-9fc88f96d40b17c90bac53b90045a87b2d2cff84.tar.gz
wic: Add mic w/pykickstart
This is the starting point for the implemention described in [YOCTO 3847] which came to the conclusion that it would make sense to use kickstart syntax to implement image creation in OpenEmbedded. I subsequently realized that there was an existing tool that already implemented image creation using kickstart syntax, the Tizen/Meego mic tool. As such, it made sense to use that as a starting point - this commit essentially just copies the relevant Python code from the MIC tool to the scripts/lib dir, where it can be accessed by the previously created wic tool. Most of this will be removed or renamed by later commits, since we're initially focusing on partitioning only. Care should be taken so that we can easily add back any additional functionality should we decide later to expand the tool, though (we may also want to contribute our local changes to the mic tool to the Tizen project if it makes sense, and therefore should avoid gratuitous changes to the original code if possible). Added the /mic subdir from Tizen mic repo as a starting point: git clone git://review.tizen.org/tools/mic.git For reference, the top commit: commit 20164175ddc234a17b8a12c33d04b012347b1530 Author: Gui Chen <gui.chen@intel.com> Date: Sun Jun 30 22:32:16 2013 -0400 bump up to 0.19.2 Also added the /plugins subdir, moved to under the /mic subdir (to match the default plugin_dir location in mic.conf.in, which was renamed to yocto-image.conf (moved and renamed by later patches) and put into /scripts. (From OE-Core rev: 31f0360f1fd4ebc9dfcaed42d1c50d2448b4632e) Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py')
-rw-r--r--scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py134
1 files changed, 134 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py b/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py
new file mode 100644
index 0000000000..1ed2694c89
--- /dev/null
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/zfcp.py
@@ -0,0 +1,134 @@
1#
2# Chris Lumens <clumens@redhat.com>
3#
4# Copyright 2005, 2006, 2007 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#
20from pykickstart.base import *
21from pykickstart.options import *
22
23import gettext
24import warnings
25_ = lambda x: gettext.ldgettext("pykickstart", x)
26
27class FC3_ZFCPData(BaseData):
28 removedKeywords = BaseData.removedKeywords
29 removedAttrs = BaseData.removedAttrs
30
31 def __init__(self, *args, **kwargs):
32 BaseData.__init__(self, *args, **kwargs)
33 self.devnum = kwargs.get("devnum", "")
34 self.wwpn = kwargs.get("wwpn", "")
35 self.fcplun = kwargs.get("fcplun", "")
36 self.scsiid = kwargs.get("scsiid", "")
37 self.scsilun = kwargs.get("scsilun", "")
38
39 def __eq__(self, y):
40 return self.devnum == y.devnum and self.wwpn == y.wwpn and \
41 self.fcplun == y.fcplun and self.scsiid == y.scsiid and \
42 self.scsilun == y.scsilun
43
44 def __str__(self):
45 retval = BaseData.__str__(self)
46 retval += "zfcp"
47
48 if self.devnum != "":
49 retval += " --devnum=%s" % self.devnum
50 if self.wwpn != "":
51 retval += " --wwpn=%s" % self.wwpn
52 if self.fcplun != "":
53 retval += " --fcplun=%s" % self.fcplun
54 if hasattr(self, "scsiid") and self.scsiid != "":
55 retval += " --scsiid=%s" % self.scsiid
56 if hasattr(self, "scsilun") and self.scsilun != "":
57 retval += " --scsilun=%s" % self.scsilun
58
59 return retval + "\n"
60
61class F12_ZFCPData(FC3_ZFCPData):
62 removedKeywords = FC3_ZFCPData.removedKeywords + ["scsiid", "scsilun"]
63 removedAttrs = FC3_ZFCPData.removedAttrs + ["scsiid", "scsilun"]
64
65 def __init__(self, *args, **kwargs):
66 FC3_ZFCPData.__init__(self, *args, **kwargs)
67 self.deleteRemovedAttrs()
68
69F14_ZFCPData = F12_ZFCPData
70
71class FC3_ZFCP(KickstartCommand):
72 removedKeywords = KickstartCommand.removedKeywords
73 removedAttrs = KickstartCommand.removedAttrs
74
75 def __init__(self, writePriority=71, *args, **kwargs):
76 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
77 self.op = self._getParser()
78
79 self.zfcp = kwargs.get("zfcp", [])
80
81 def __str__(self):
82 retval = ""
83 for zfcp in self.zfcp:
84 retval += zfcp.__str__()
85
86 return retval
87
88 def _getParser(self):
89 op = KSOptionParser()
90 op.add_option("--devnum", dest="devnum", required=1)
91 op.add_option("--fcplun", dest="fcplun", required=1)
92 op.add_option("--scsiid", dest="scsiid", required=1)
93 op.add_option("--scsilun", dest="scsilun", required=1)
94 op.add_option("--wwpn", dest="wwpn", required=1)
95 return op
96
97 def parse(self, args):
98 zd = self.handler.ZFCPData()
99 (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
100 self._setToObj(self.op, opts, zd)
101 zd.lineno = self.lineno
102
103 # Check for duplicates in the data list.
104 if zd in self.dataList():
105 warnings.warn(_("A zfcp with this information has already been defined."))
106
107 return zd
108
109 def dataList(self):
110 return self.zfcp
111
112class F12_ZFCP(FC3_ZFCP):
113 removedKeywords = FC3_ZFCP.removedKeywords
114 removedAttrs = FC3_ZFCP.removedAttrs + ["scsiid", "scsilun"]
115
116 def __init__(self, *args, **kwargs):
117 FC3_ZFCP.__init__(self, *args, **kwargs)
118 self.deleteRemovedAttrs()
119
120 def _getParser(self):
121 op = FC3_ZFCP._getParser(self)
122 op.add_option("--scsiid", deprecated=1)
123 op.add_option("--scsilun", deprecated=1)
124 return op
125
126class F14_ZFCP(F12_ZFCP):
127 removedKeywords = F12_ZFCP.removedKeywords
128 removedAttrs = F12_ZFCP.removedAttrs
129
130 def _getParser(self):
131 op = F12_ZFCP._getParser(self)
132 op.remove_option("--scsiid")
133 op.remove_option("--scsilun")
134 return op