ginger-dev-list
[Top][All Lists]
Advanced

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

Re: [Ginger-dev-list] [ginger-dev-list] Re: [PATCH] [Ginger] Make get_fc


From: Harshal Patil
Subject: Re: [Ginger-dev-list] [ginger-dev-list] Re: [PATCH] [Ginger] Make get_fc_path_elements arch-independent
Date: Tue, 3 May 2016 04:34:15 +0000

   Hi,

   We will test this patch on s390x just to make sure it doesn't break any
   existing feature. I will update with the results soon.
   Harshal Patil
   E-mail: address@hidden


     ----- Original message -----
     From: Daniel Henrique Barboza <address@hidden>
     Sent by: address@hidden
     To: Lucio Correia <address@hidden>, ginger-dev
     <address@hidden>
     Cc:
     Subject: [ginger-dev-list] Re: [PATCH] [Ginger] Make
     get_fc_path_elements arch-independent
     Date: Tue, May 3, 2016 7:08 AM

   Reviewed-by: Daniel Barboza <address@hidden>
   On 05/02/2016 07:41 PM, Lucio Correia wrote:
   > Signed-off-by: Lucio Correia <address@hidden>
   > ---
   >   model/utils.py | 40 ++++++++++++++--------------------------
   >   1 file changed, 14 insertions(+), 26 deletions(-)
   >
   > diff --git a/model/utils.py b/model/utils.py
   > index 7f66a77..5a2f4b0 100644
   > --- a/model/utils.py
   > +++ b/model/utils.py
   > @@ -33,7 +33,8 @@ from wok.plugins.gingerbase.disks import
   _get_dev_major_min
   >   from wok.plugins.gingerbase.disks import _get_dev_node_path
   >
   >
   > -sg_dir = "/sys/class/scsi_generic/"
   > +FC_PATHS = "/dev/disk/by-path/*fc*"
   > +FC_PATTERN =
   "pci-(?P<hba_id>[\S]+)-fc-(?P<wwpn>[\S]+)-lun-(?P<fcp_lun>[\S]+)"
   >   DEV_TYPES = ["dasd-eckd", "zfcp"]
   >   syspath_eckd = "/sys/bus/ccw/drivers/dasd-eckd/0.*/"
   >   syspath_zfcp = "/sys/bus/ccw/drivers/zfcp/0.*/"
   > @@ -851,32 +852,19 @@ def get_fc_path_elements():
   >                     'fcp_lun': '0x41cf000000000000',
   >                     'hba_id': '0.0.7100'},}
   >       """
   > -    wwpn = ''
   > -    fcp_lun = ''
   > -    hba_id = ''
   >       fc_blk_dict = {}
   > -    for sg_dev in os.listdir(sg_dir):
   > -        # skip devices whose transport is not FC
   > -        sg_dev_path = sg_dir + "/" + sg_dev
   > -        if os.path.exists(sg_dev_path + "/device/wwpn")\
   > -           and os.path.exists(sg_dev_path + "/device/block/"):
   > -            blk = os.listdir(sg_dev_path + "/device/block/")[0]
   > -
   > -            if os.path.exists(sg_dev_path + "/device/block/" + blk):
   > -                wwpn = open(
   > -                    sg_dev_path +
   > -                    "/device/wwpn").readline().rstrip()
   > -                fcp_lun = open(
   > -                    sg_dev_path +
   > -                    "/device/fcp_lun").readline().rstrip()
   > -                hba_id = open(
   > -                    sg_dev_path +
   > -                    "/device/hba_id").readline().rstrip()
   > -                blk_info_dict = {}
   > -                blk_info_dict['wwpn'] = wwpn
   > -                blk_info_dict['fcp_lun'] = fcp_lun
   > -                blk_info_dict['hba_id'] = hba_id
   > -                fc_blk_dict[blk] = blk_info_dict
   > +
   > +    pattern = re.compile(FC_PATTERN)
   > +    fc_devs = glob.glob(FC_PATHS)
   > +    for path in fc_devs:
   > +        blkdev = os.path.basename(os.path.realpath(path))
   > +
   > +        try:
   > +            blk_info_dict = pattern.search(path).groupdict()
   > +        except:
   > +            blk_info_dict = {'wwpn': '', 'fcp_lun': '', 'hba_id':
   ''}
   > +
   > +        fc_blk_dict[blkdev] = blk_info_dict
   >
   >       return fc_blk_dict
   >
   --
   You received this message because you are subscribed to the Google
   Groups "Ginger Development Mailing List" group.
   To unsubscribe from this group and stop receiving emails from it, send
   an email to address@hidden
   For more options, visit [2]https://groups.google.com/d/optout.

References

   1. mailto:address@hidden
   2. https://groups.google.com/d/optout


reply via email to

[Prev in Thread] Current Thread [Next in Thread]