Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo User (http://www.linux-archive.org/gentoo-user/)
-   -   Add auto_vlan option for fcoe devices in UI (#735857) (http://www.linux-archive.org/gentoo-user/635274-add-auto_vlan-option-fcoe-devices-ui-735857-a.html)

Radek Vykydal 02-20-2012 11:18 AM

Add auto_vlan option for fcoe devices in UI (#735857)
 
Resolves: rhbz#735857

This is a follow-up of patches from Broadcom. It was tested on
their side. The difference in handling of auto_vlan option
in installer environment (used only in dcb=False case) and
installed system (DCB_REQUIRED=yes and AUTO_VLAN=yes case
is possible) is intentional (consulted with reporters).

---
iw/advanced_storage.py | 2 ++
kickstart.py | 2 +-
storage/devices.py | 2 +-
storage/fcoe.py | 21 +++++++++++----------
textw/add_drive_text.py | 7 +++++--
ui/fcoe-config.glade | 14 ++++++++++++++
6 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/iw/advanced_storage.py b/iw/advanced_storage.py
index 6384d5f..8d6b0cc 100644
--- a/iw/advanced_storage.py
+++ b/iw/advanced_storage.py
@@ -323,6 +323,7 @@ def addFcoeDrive(anaconda):
(dxml, dialog) = gui.getGladeWidget("fcoe-config.glade", "fcoeDialog")
combo = dxml.get_widget("fcoeNicCombo")
dcb_cb = dxml.get_widget("dcbCheckbutton")
+ auto_vlan_cb = dxml.get_widget("autovlanCheckbutton")

# Populate the combo
cell = gtk.CellRendererText()
@@ -384,6 +385,7 @@ def addFcoeDrive(anaconda):
try:
anaconda.id.storage.fcoe.addSan(store.get_value(it er, 1),
dcb=dcb_cb.get_active(),
+ auto_vlan=auto_vlan_cb.get_active(),
intf=anaconda.intf)
except IOError as e:
anaconda.intf.messageWindow(_("Error"), str(e))
diff --git a/kickstart.py b/kickstart.py
index de2dbe9..ff879cf 100644
--- a/kickstart.py
+++ b/kickstart.py
@@ -359,7 +359,7 @@ class Fcoe(commands.fcoe.F13_Fcoe):
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)
+ storage.fcoe.fcoe().addSan(nic=fc.nic, dcb=fc.dcb, auto_vlan=True)

return fc

diff --git a/storage/devices.py b/storage/devices.py
index 3810b24..7a1ec16 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3654,7 +3654,7 @@ class FcoeDiskDevice(DiskDevice, NetworkStorageDevice):
dcb = True

from .fcoe import fcoe
- for nic, dcb in fcoe().nics:
+ for nic, dcb, auto_vlan in fcoe().nics:
if nic == self.nic:
break

diff --git a/storage/fcoe.py b/storage/fcoe.py
index 568f55d..90492b0 100644
--- a/storage/fcoe.py
+++ b/storage/fcoe.py
@@ -90,7 +90,7 @@ class fcoe(object):
return

log.info("FCoE NIC found in EDD: %s" % val)
- self.addSan(val, dcb=True, intf=intf)
+ self.addSan(val, dcb=True, auto_vlan=True, intf=intf)

def startup(self, intf = None):
if self.started:
@@ -110,11 +110,12 @@ class fcoe(object):
stdout = "/dev/tty5", stderr="/dev/tty5")
self.lldpadStarted = True

- def addSan(self, nic, dcb=False, intf=None):
+ def addSan(self, nic, dcb=False, auto_vlan=True, intf=None):
if not has_fcoe():
raise IOError, _("FCoE not available")

- log.info("Activating FCoE SAN attached to %s, dcb: %s" % (nic, dcb))
+ log.info("Activating FCoE SAN attached to %s, dcb: %s autovlan: %s" %
+ (nic, dcb, auto_vlan))

iutil.execWithRedirect("ip", [ "link", "set", nic, "up" ],
stdout = "/dev/tty5", stderr="/dev/tty5")
@@ -129,10 +130,7 @@ class fcoe(object):
iutil.execWithRedirect("fipvlan", [ nic, "-c", "-s" ],
stdout = "/dev/tty5", stderr="/dev/tty5")
else:
- # Use fipvlan instead of fcoe's create if nic uses bnx2x driver.
- # Ideally, this should be done by checking a "AUTO_VLAN" parameter,
- # not bnx2x driver usage
- if 'bnx2x' in os.path.realpath('/sys/class/net/%s/device/driver' %(nic)):
+ if auto_vlan:
# certain network configrations require the VLAN layer module:
iutil.execWithRedirect("modprobe", ["8021q"],
stdout = "/dev/tty5", stderr="/dev/tty5")
@@ -144,7 +142,7 @@ class fcoe(object):
f.close()

self._stabilize(intf)
- self.nics.append((nic, dcb))
+ self.nics.append((nic, dcb, auto_vlan))

def writeKS(self, f):
# fixme plenty (including add ks support for fcoe in general)
@@ -157,7 +155,7 @@ class fcoe(object):
if not os.path.isdir(instPath + "/etc/fcoe"):
os.makedirs(instPath + "/etc/fcoe", 0755)

- for nic, dcb in self.nics:
+ for nic, dcb, auto_vlan in self.nics:
fd = os.open(instPath + "/etc/fcoe/cfg-" + nic,
os.O_RDWR | os.O_CREAT)
os.write(fd, '# Created by anaconda
')
@@ -169,7 +167,10 @@ class fcoe(object):
else:
os.write(fd, 'DCB_REQUIRED="no"
')
os.write(fd, '# Indicate if VLAN discovery should be handled by fcoemon
')
- os.write(fd, 'AUTO_VLAN="yes"
')
+ if auto_vlan:
+ os.write(fd, 'AUTO_VLAN="yes"
')
+ else:
+ os.write(fd, 'AUTO_VLAN="no"
')
os.close(fd)

return
diff --git a/textw/add_drive_text.py b/textw/add_drive_text.py
index 546e68d..4a603c0 100644
--- a/textw/add_drive_text.py
+++ b/textw/add_drive_text.py
@@ -383,9 +383,11 @@ class addDriveDialog(object):

dcbCheckbox = Checkbox(_("Use DCB"), 1)
grid.add(dcbCheckbox, 0, 2, anchorLeft = 1)
+ autovlanCheckbox = Checkbox(_("Use auto vlan"), 1)
+ grid.add(autovlanCheckbox, 0, 3, anchorLeft = 1)

buttons = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON] )
- grid.add(buttons, 0, 3, anchorLeft = 1, growx = 1)
+ grid.add(buttons, 0, 4, anchorLeft = 1, growx = 1)

result = grid.run()
if buttons.buttonPressed(result) == TEXT_BACK_CHECK:
@@ -394,8 +396,9 @@ class addDriveDialog(object):

nic = interfaceList.current()
dcb = dcbCheckbox.selected()
+ auto_vlan = autovlanCheckbox.selected()

- storage.fcoe.fcoe().addSan(nic=nic, dcb=dcb,
+ storage.fcoe.fcoe().addSan(nic=nic, dcb=dcb, auto_vlan=auto_vlan,
intf=self.anaconda.intf)

screen.popWindow()
diff --git a/ui/fcoe-config.glade b/ui/fcoe-config.glade
index 6d7f017..503d2df 100644
--- a/ui/fcoe-config.glade
+++ b/ui/fcoe-config.glade
@@ -71,6 +71,20 @@ your FCoE switch.</property>
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <widget class="GtkCheckButton" id="autovlanCheckbutton">
+ <property name="label" translatable="yes">Automatic VLAN discovery</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="position">2</property>
--
1.7.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 11:59 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.