[node-patches] Change in ovirt-node[master]: installer: Add FCoE support

fabiand at redhat.com fabiand at redhat.com
Mon May 2 12:30:34 UTC 2016


Fabian Deutsch has uploaded a new change for review.

Change subject: installer: Add FCoE support
......................................................................

installer: Add FCoE support

FCoE requires some basic configuration.
This patch is adding this basic support by mimicing what anaconda does.
TO prevent code duplication, blivet is getting included.

Change-Id: I6badb1fe5e32b3ab6d3831e08d132bf5b70820f0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1320526
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M recipe/common-pkgs.ks
M src/ovirt/node/config/network.py
M src/ovirt/node/installer/core/progress_page.py
3 files changed, 60 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/11/56911/1

diff --git a/recipe/common-pkgs.ks b/recipe/common-pkgs.ks
index 9949ae4..bbd8e86 100644
--- a/recipe/common-pkgs.ks
+++ b/recipe/common-pkgs.ks
@@ -121,3 +121,6 @@
 libicu
 
 xfsprogs
+
+# FCoE related stuff
+python-blivet
diff --git a/src/ovirt/node/config/network.py b/src/ovirt/node/config/network.py
index a2e35a5..3378b9c 100644
--- a/src/ovirt/node/config/network.py
+++ b/src/ovirt/node/config/network.py
@@ -19,8 +19,10 @@
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
 from ovirt.node import utils, base
-from ovirt.node.utils import AugeasWrapper as Augeas, fs, is_fileobj
+from ovirt.node.utils import AugeasWrapper as Augeas, fs, is_fileobj, \
+    parse_bool
 from ovirt.node.utils.fs import ShellVarFile
+from ovirt.node.utils.system import kernel_cmdline_arguments
 import glob
 import os
 import logging
@@ -250,3 +252,34 @@
         iface = fn[len(filepath):]
         ifaces.append(iface)
     return ifaces
+
+
+def auto_configure_fcoe():
+    """Use blivet for fcoe configuration, similar to what fedora does
+
+   Enable fcoe by using: node.fcoe.enable=y
+
+    nd.fcoe.enable=[yn]
+    nd.fcoe.dcb=[yn]
+    nd.fcoe.nics=nic[,nic,...]
+    """
+    import blivet
+    fcoe = blivet.fcoe.fcoe()
+
+    # Initialize fcoe
+    fcoe.startup()
+
+    # Now read the kernel args
+    kargs = kernel_cmdline_arguments()
+    is_dcb = parse_bool(kargs.get("nd.fcoe.dcb", False))
+    val = kargs.get("nd.fcoe.nics", "")
+    for nic in val.split(","):
+        if nic not in fcoe.nics:
+            fcoe.add_nic(nic, is_dcb, True)
+
+    # Save fcoe configs
+    fcoe.write()
+
+    pcfg = fs.Config()
+    for fn in ["/etc/fcoe"]:
+        pcfg.persist(fn)
diff --git a/src/ovirt/node/installer/core/progress_page.py b/src/ovirt/node/installer/core/progress_page.py
index 1501683..4df7e45 100644
--- a/src/ovirt/node/installer/core/progress_page.py
+++ b/src/ovirt/node/installer/core/progress_page.py
@@ -19,8 +19,8 @@
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
 from ovirt.node import plugins, ui, utils
-from ovirt.node.config import defaults
-from ovirt.node.utils import console, system
+from ovirt.node.config import defaults, network
+from ovirt.node.utils import console, system, parse_bool
 import threading
 
 
@@ -167,7 +167,13 @@
                    self.SetPassword(cfg["admin.password"]),
                    self.InstallImageAndBootloader(cfg["boot.device.current"]),
                    self.SetKeyboardLayout(cfg["keyboard.layout"])]
-            if "disable_kdump" not in system.kernel_cmdline_arguments():
+
+            kargs = system.kernel_cmdline_arguments()
+
+            if parse_bool(kargs.get("nd.fcoe.enable", "n")):
+                tx += [self.ConfigureFcoe()]
+
+            if "disable_kdump" not in kargs:
                 tx += [self.ConfigureKdump()]
 
             if system.is_pxe():
@@ -315,6 +321,20 @@
             except:
                 self.logger.info("Could not configure local kdump!")
 
+    class ConfigureFcoe(utils.Transaction.Element):
+        title = "Configuring FCoE"
+
+        def __init__(self):
+            super(InstallerThread.ConfigureFcoe, self).__init__()
+
+        def commit(self):
+            try:
+                config.network.auto_configure_fcoe()
+
+            except:
+                self.logger.info("Failed to configure FCoE",
+                                 exc_info=True)
+
     class MigrateConfigs(utils.Transaction.Element):
         title = "Migrating configuration data"
 


-- 
To view, visit https://gerrit.ovirt.org/56911
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6badb1fe5e32b3ab6d3831e08d132bf5b70820f0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list