2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007 Red Hat, Inc.
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.
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.
20 from pykickstart
.base
import *
21 from pykickstart
.options
import *
24 _
= lambda x
: gettext
.ldgettext("pykickstart", x
)
26 class FC3_ZFCPData(BaseData
):
27 removedKeywords
= BaseData
.removedKeywords
28 removedAttrs
= BaseData
.removedAttrs
30 def __init__(self
, *args
, **kwargs
):
31 BaseData
.__init
__(self
, *args
, **kwargs
)
32 self
.devnum
= kwargs
.get("devnum", "")
33 self
.wwpn
= kwargs
.get("wwpn", "")
34 self
.fcplun
= kwargs
.get("fcplun", "")
35 self
.scsiid
= kwargs
.get("scsiid", "")
36 self
.scsilun
= kwargs
.get("scsilun", "")
39 return self
.devnum
== y
.devnum
and self
.wwpn
== y
.wwpn
and \
40 self
.fcplun
== y
.fcplun
and self
.scsiid
== y
.scsiid
and \
41 self
.scsilun
== y
.scsilun
44 retval
= BaseData
.__str
__(self
)
48 retval
+= " --devnum=%s" % self
.devnum
50 retval
+= " --wwpn=%s" % self
.wwpn
52 retval
+= " --fcplun=%s" % self
.fcplun
54 retval
+= " --scsiid=%s" % self
.scsiid
55 if self
.scsilun
!= "":
56 retval
+= " --scsilun=%s" % self
.scsilun
60 class FC3_ZFCP(KickstartCommand
):
61 removedKeywords
= KickstartCommand
.removedKeywords
62 removedAttrs
= KickstartCommand
.removedAttrs
64 def __init__(self
, writePriority
=71, *args
, **kwargs
):
65 KickstartCommand
.__init
__(self
, writePriority
, *args
, **kwargs
)
66 self
.op
= self
._getParser
()
68 self
.zfcp
= kwargs
.get("zfcp", [])
72 for zfcp
in self
.zfcp
:
73 retval
+= zfcp
.__str
__()
79 op
.add_option("--devnum", dest
="devnum", required
=1)
80 op
.add_option("--fcplun", dest
="fcplun", required
=1)
81 op
.add_option("--scsiid", dest
="scsiid", required
=1)
82 op
.add_option("--scsilun", dest
="scsilun", required
=1)
83 op
.add_option("--wwpn", dest
="wwpn", required
=1)
86 def parse(self
, args
):
87 zd
= self
.handler
.ZFCPData()
88 (opts
, extra
) = self
.op
.parse_args(args
=args
, lineno
=self
.lineno
)
89 self
._setToObj
(self
.op
, opts
, zd
)
91 # Check for duplicates in the data list.
92 if zd
in self
.dataList():
93 raise KickstartValueError(_("A zfcp with this information has already been defined."))