[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [rhel6-branch 1/2] iscsi: partial offload drivers.



Looks good...

Just a small note, you don't need to return None at the end of a
function.

On Mon, 2010-11-29 at 15:37 +0100, Ales Kozumplik wrote:
> Includes brcm_iscsiuio daemon for bnx2i cards as well as loading the
> drivers and spawning the daemons in stage2 storage code.
> 
> Related: rhbz#442980
> ---
>  iutil.py             |   10 ++++++++++
>  scripts/mk-images    |    2 +-
>  scripts/upd-instroot |    1 +
>  storage/iscsi.py     |   11 +++++++++++
>  4 files changed, 23 insertions(+), 1 deletions(-)
> 
> diff --git a/iutil.py b/iutil.py
> index 67d4bfa..3c2a0d5 100644
> --- a/iutil.py
> +++ b/iutil.py
> @@ -1050,3 +1050,13 @@ def get_sysfs_attr(path, attr):
>          return None
>  
>      return open(attribute, "r").read().strip()
> +
> +def find_program_in_path(prog, raise_on_error=False):
> +    for d in os.environ["PATH"].split(":"):
> +        full = "%s/%s" % (d, prog)
> +        if os.access(full, os.X_OK):
> +            return full
> +        
> +    if raise_on_error:
> +        raise RuntimeError("Unable to locate a needed executable: '%s'" % prog)
> +    return None
> diff --git a/scripts/mk-images b/scripts/mk-images
> index d5bacc9..9e0e025 100755
> --- a/scripts/mk-images
> +++ b/scripts/mk-images
> @@ -101,7 +101,7 @@ USBMODS="$UMSMODS ohci-hcd uhci-hcd ehci-hcd usbhid mousedev usb-storage sd_mod
>  FIREWIREMODS="ohci1394 sbp2 fw-ohci fw-sbp2 firewire-sbp2 firewire-ohci"
>  SDMODS="mmc-block sdhci sdhci-pci"
>  IDEMODS="ide-cd ide-cd_mod"
> -SCSIMODS="sr_mod sg st sd_mod scsi_mod iscsi_tcp iscsi_ibft scsi_wait_scan"
> +SCSIMODS="sr_mod sg st sd_mod scsi_mod iscsi_tcp iscsi_ibft scsi_wait_scan cxgb3i bnx2i be2iscsi"
>  FSMODS="fat msdos vfat ext2 ext3 ext4 reiserfs jfs xfs gfs2 cifs fuse btrfs hfsplus"
>  LVMMODS="dm-mod dm-zero dm-snapshot dm-mirror dm-multipath dm-round-robin dm-crypt"
>  RAIDMODS="raid0 raid1 raid5 raid6 raid456 raid10 linear"
> diff --git a/scripts/upd-instroot b/scripts/upd-instroot
> index a4ec858..43fde85 100755
> --- a/scripts/upd-instroot
> +++ b/scripts/upd-instroot
> @@ -415,6 +415,7 @@ lib/udev
>  sbin/*gfs*
>  sbin/arping
>  sbin/badblocks
> +sbin/brcm_iscsiuio
>  sbin/blockdev
>  sbin/btrfsctl
>  sbin/btrfsck
> diff --git a/storage/iscsi.py b/storage/iscsi.py
> index ff57cc5..8611d51 100644
> --- a/storage/iscsi.py
> +++ b/storage/iscsi.py
> @@ -43,6 +43,8 @@ except ImportError:
>  ISCSID=""
>  INITIATOR_FILE="/etc/iscsi/initiatorname.iscsi"
>  
> +ISCSI_MODULES=['cxgb3i', 'bnx2i', 'be2iscsi']
> +
>  def find_iscsi_files():
>      global ISCSID
>      if ISCSID == "":
> @@ -193,6 +195,15 @@ class iscsi(object):
>                  os.makedirs(fulldir, 0755)
>  
>          log.info("iSCSI startup")
> +        iutil.execWithRedirect('modprobe', ['-a'] + ISCSI_MODULES,
> +                               stdout="/dev/tty5", stderr="/dev/tty5")
> +        # this is needed by Broadcom offload cards (bnx2i)
> +        brcm_iscsiuio = iutil.find_program_in_path('brcm_iscsiuio',
> +                                                   raise_on_error=True)
> +        log.debug("iscsi: brcm_iscsiuio is at %s" % brcm_iscsiuio)
> +        iutil.execWithRedirect(brcm_iscsiuio, [],
> +                               stdout="/dev/tty5", stderr="/dev/tty5")
> +        # run the daemon
>          iutil.execWithRedirect(ISCSID, [],
>                                 stdout="/dev/tty5", stderr="/dev/tty5")
>          time.sleep(1)

-- 
Martin Gracik <mgracik redhat com>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]