kickstart: Move onlining of fcoe/iscsi/zfcp devices to parse phase
Bring fcoe/iscsi/zfcp devices online when parsing the kickstart file
(instead of delaying this to the execute phase) so that the disks
can be identified by /dev/disk/by-path/foo, etc. in clearpart, ignoredisks,
etc. commands.
For the iscsi command this also improves error handling by passing
username and password to addTarget as is instead of only passing them if
both are present, using addTarget's error handling for a username without
a password (instead of simply ignoring the username or the password), and
also by catching IOErrors which will be thrown when logging in to the target
fails.
---
kickstart.py | 72 ++++++++++++++++++++++++++++++---------------------------
1 files changed, 38 insertions(+), 34 deletions(-)
diff --git a/kickstart.py b/kickstart.py
index 9965378..534bf15 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -24,6 +24,9 @@ from storage.devicelibs.lvm import getPossiblePhysicalExtents
from storage.formats import getFormat
from storage.partitioning import clearPartitions
from storage.partitioning import shouldClear
+import storage.iscsi
+import storage.fcoe
+import storage.zfcp
from errors import *
import iutil
@@ -297,11 +300,16 @@ class ClearPart(commands.clearpart.FC3_ClearPart):
clearPartitions(anaconda.id.storage)
-class FcoeData(commands.fcoe.F13_FcoeData):
- def execute(self, anaconda):
- if self.nic not in self.anaconda.id.network.available():
- raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent nic %s in fcoe command" % self.nic)
- anaconda.id.fcoe.addSan(nic=self.nic, dcb=self.dcb)
+class Fcoe(commands.fcoe.F13_Fcoe):
+ def parse(self, args):
+ fc = commands.fcoe.F13_Fcoe.parse(self, args)
+
+ if fc.nic not in isys.getDeviceProperties():
+ raise KickstartValueError, formatErrorMsg(self.lineno, msg="Specified nonexistent nic %s in fcoe command" % fc.nic)
+
+ storage.fcoe.fcoe().addSan(nic=fc.nic, dcb=fc.dcb)
+
+ return fc
class Firewall(commands.firewall.F10_Firewall):
def execute(self, anaconda):
@@ -349,31 +357,25 @@ class IgnoreDisk(commands.ignoredisk.F8_IgnoreDisk):
anaconda.id.storage.ignoredDisks = self.ignoredisk
anaconda.id.storage.exclusiveDisks = self.onlyuse