• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.wait_for_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.wait_for_path函数的典型用法代码示例。如果您正苦于以下问题:Python wait_for_path函数的具体用法?Python wait_for_path怎么用?Python wait_for_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wait_for_path函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: create

 def create(self, sr_uuid, size):
     # Check whether an SR already exists
     SRs = self.session.xenapi.SR.get_all_records()
     for sr in SRs:
         record = SRs[sr]
         sm_config = record["sm_config"]
         if sm_config.has_key('targetIQN') and \
            sm_config['targetIQN'] == self.targetIQN:
             raise xs_errors.XenError('SRInUse')
     self.attach(sr_uuid)
     # Wait up to MAX_TIMEOUT for devices to appear
     util.wait_for_path(self.path, MAX_TIMEOUT)
     
     if self._loadvdis() > 0:
         scanrecord = SR.ScanRecord(self)
         scanrecord.synchronise()
     try:
         self.detach(sr_uuid)
     except:
         pass
     self.sm_config = self.session.xenapi.SR.get_sm_config(self.sr_ref)
     self.sm_config['disktype'] = 'Raw'
     self.sm_config['datatype'] = 'ISCSI'
     self.sm_config['target'] = self.target
     self.sm_config['targetIQN'] = self.targetIQN
     self.sm_config['multipathable'] = 'true'
     self.session.xenapi.SR.set_sm_config(self.sr_ref, self.sm_config)
     return
开发者ID:JohnGarbutt,项目名称:xcp-storage-managers,代码行数:28,代码来源:ISCSISR.py


示例2: _refresh_DMP

def _refresh_DMP(sid, npaths):
    map_by_scsibus(sid,npaths)
    path = os.path.join(DEVMAPPERPATH, sid)
    if not os.path.exists(path):
        raise xs_errors.XenError('DMP failed to activate mapper path')
    lvm_path = "/dev/disk/by-scsid/"+sid+"/mapper"
    util.wait_for_path(lvm_path, 10)
    activate_MPdev(sid, path)
开发者ID:fudong1127,项目名称:sm,代码行数:8,代码来源:mpath_dmp.py


示例3: _refresh_DMP

def _refresh_DMP(sid, npaths):
    util.retry(lambda: util.pread2(['/usr/sbin/multipath', '-r', sid]), maxretry = 3,
                           period = 4)
    path = os.path.join(DEVMAPPERPATH, sid)
    util.wait_for_path(path, 10)
    if not os.path.exists(path):
        raise xs_errors.XenError('DMP failed to activate mapper path')
    lvm_path = "/dev/disk/by-scsid/"+sid+"/mapper"
    util.wait_for_path(lvm_path, 10)
    activate_MPdev(sid, path)
开发者ID:MarkSymsCtx,项目名称:sm,代码行数:10,代码来源:mpath_dmp.py


示例4: _LUNprint

 def _LUNprint(self, sr_uuid):
     if self.iscsi.attached:
         # Force a rescan on the bus, pause for 5 seconds
         # N.B. Probing for LUNs can always be repeated, so don't wait a long time
         self.iscsi.refresh()
         time.sleep(5)
     # Now call attach (handles the refcounting + session activa)
     self.iscsi.attach(sr_uuid)
     # Wait up to 15 seconds for the base iscsi udev path
     # to show up. This may fail under extreme load or if
     # LUNs are not mapped to the host
     util.wait_for_path(self.iscsi.path, ISCSISR.MAX_TIMEOUT)
     self.iscsi.print_LUNs()
     self.iscsi.detach(sr_uuid)        
开发者ID:JohnGarbutt,项目名称:xcp-storage-managers,代码行数:14,代码来源:LVMoISCSISR.py


示例5: _attach_LUN_bylunid

 def _attach_LUN_bylunid(self, lunid):
     if not self.attached:
         raise xs_errors.XenError('SRUnavailable')
     connected = []
     for val in self.adapter:
         if not self.pathdict.has_key(val):
             continue
         rec = self.pathdict[val]
         path = os.path.join(rec['path'],"LUN%s" % lunid)
         util.SMlog("path: %s" % path)
         realpath = os.path.realpath(path)
         util.SMlog("realpath: %s" % realpath)
         host = self.adapter[val]
         if not self.devs.has_key(realpath):
             l = [realpath, host, 0, 0, lunid]
             scsiutil.scsi_dev_ctrl(l,"add")
             if not util.wait_for_path(path, MAX_LUNID_TIMEOUT):
                 util.SMlog("Unable to detect LUN attached to host on path [%s]" % path)
                 continue
         else:
             # Verify that we are not seeing a stale LUN map
             try:
                 real_SCSIid = scsiutil.getSCSIid(realpath)
                 cur_scsibuspath = glob.glob('/dev/disk/by-scsibus/*-%s:0:0:%s' % (host,lunid))
                 cur_SCSIid = os.path.basename(cur_scsibuspath[0]).split("-")[0]
                 assert(cur_SCSIid == real_SCSIid)
             except:
                 scsiutil.rescan([host])
                 if not os.path.exists('/dev/disk/by-scsibus/%s-%s:0:0:%s' % \
                                       (real_SCSIid,host,lunid)):
                     util.SMlog("Unable to detect LUN attached to host after bus re-probe")
                     continue
         connected.append(path)
     return connected
开发者ID:tryggvil,项目名称:CloudStack,代码行数:34,代码来源:ISCSISR.py


示例6: _LUNprint

    def _LUNprint(self, sr_uuid):
        if self.iscsi.attached:
            # Force a rescan on the bus.
            self.iscsi.refresh()
#            time.sleep(5)
        # Now call attach (handles the refcounting + session activa)
        self.iscsi.attach(sr_uuid)

        util.SMlog("LUNprint: waiting for path: %s" % self.iscsi.path)
        if util.wait_for_path("%s/LUN*" % self.iscsi.path, ISCSISR.MAX_TIMEOUT):
            try:
                adapter=self.iscsi.adapter[self.iscsi.address]
                util.SMlog("adapter=%s" % adapter)

                # find a scsi device on which to issue a report luns command:
                devs=glob.glob("%s/LUN*" % self.iscsi.path)
                sgdevs = []
                for i in devs:
                    sgdevs.append(int(i.split("LUN")[1]))
                sgdevs.sort()
                sgdev = "%s/LUN%d" % (self.iscsi.path,sgdevs[0])                

                # issue a report luns:
                luns=util.pread2(["/usr/bin/sg_luns","-q",sgdev]).split('\n')
                nluns=len(luns)-1 # remove the line relating to the final \n
                # check if the LUNs are MPP-RDAC Luns
                scsi_id = scsiutil.getSCSIid(sgdev)
                mpp_lun = False
                if (mpp_luncheck.is_RdacLun(scsi_id)):
                    mpp_lun = True
                    link=glob.glob('/dev/disk/by-scsibus/%s-*' % scsi_id)
                    mpp_adapter = link[0].split('/')[-1].split('-')[-1].split(':')[0]

                # make sure we've got that many sg devices present
                for i in range(0,30): 
                    luns=scsiutil._dosgscan()
                    sgdevs=filter(lambda r: r[1]==adapter, luns)
                    if mpp_lun:
                        sgdevs.extend(filter(lambda r: r[1]==mpp_adapter, luns))
                    if len(sgdevs)>=nluns:
                        util.SMlog("Got all %d sg devices" % nluns)
                        break
                    else:
                        util.SMlog("Got %d sg devices - expecting %d" % (len(sgdevs),nluns))
                        time.sleep(1)

                if os.path.exists("/sbin/udevsettle"):
                    util.pread2(["/sbin/udevsettle"])
                else:
                    util.pread2(["/sbin/udevadm","settle"])
            except:
                util.SMlog("Generic exception caught. Pass")
                pass # Make sure we don't break the probe...

        self.iscsi.print_LUNs()
        self.iscsi.detach(sr_uuid)        
开发者ID:pritha-srivastava,项目名称:sm,代码行数:56,代码来源:LVHDoISCSISR.py


示例7: attach

 def attach(self, sr_uuid, vdi_uuid):
     self.sr._loadvdis()
     if not self.sr.vdis.has_key(vdi_uuid):
         raise xs_errors.XenError('VDIUnavailable')
     if not util.pathexists(self.path):
         self.sr.refresh()
         if not util.wait_for_path(self.path, MAX_TIMEOUT):
             util.SMlog("Unable to detect LUN attached to host [%s]" % self.sr.path)
             raise xs_errors.XenError('VDIUnavailable')
     return super(RAWVDI, self).attach(sr_uuid, vdi_uuid)
开发者ID:JohnGarbutt,项目名称:xcp-storage-managers,代码行数:10,代码来源:LUNperVDI.py


示例8: _attach_LUN_bySCSIid

    def _attach_LUN_bySCSIid(self, SCSIid):
        if not self.attached:
            raise xs_errors.XenError("SRUnavailable")

        path = self.mpathmodule.path(SCSIid)
        if not util.pathexists(path):
            self.refresh()
            if not util.wait_for_path(path, MAX_TIMEOUT):
                util.SMlog("Unable to detect LUN attached to host [%s]" % path)
                return False
        return True
开发者ID:heiden-deng,项目名称:sm,代码行数:11,代码来源:ISCSISR.py


示例9: create

    def create(self, sr_uuid, size):
        # Check SCSIid not already in use by other PBDs
        if util.test_SCSIid(self.session, sr_uuid, self.SCSIid):
            raise xs_errors.XenError('SRInUse')

        self.iscsi.attach(sr_uuid)
        try:
            if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid):
                # UPGRADE FROM GEORGE: take care of ill-formed SCSIid
                upgraded = False
                matchSCSIid = False
                for file in filter(self.iscsi.match_lun, util.listdir(self.iscsi.path)):
                    path = os.path.join(self.iscsi.path,file)
                    if not util.wait_for_path(path, ISCSISR.MAX_TIMEOUT):
                        util.SMlog("Unable to detect LUN attached to host [%s]" % path)
                        continue
                    try:
                        SCSIid = scsiutil.getSCSIid(path)
                    except:
                        continue
                    try:
                        matchSCSIid = scsiutil.compareSCSIid_2_6_18(self.SCSIid, path)
                    except:
                        continue
                    if (matchSCSIid):
                        util.SMlog("Performing upgrade from George")
                        try:
                            pbd = util.find_my_pbd(self.session, self.host_ref, self.sr_ref)
                            device_config = self.session.xenapi.PBD.get_device_config(pbd)
                            device_config['SCSIid'] = SCSIid
                            self.session.xenapi.PBD.set_device_config(pbd, device_config)

                            self.dconf['SCSIid'] = SCSIid            
                            self.SCSIid = self.dconf['SCSIid']
                        except:
                            continue
                        if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid):
                            raise xs_errors.XenError('InvalidDev')
                        else:
                            upgraded = True
                            break
                    else:
                        util.SMlog("Not a matching LUN, skip ... scsi_id is: %s" % SCSIid)
                        continue
                if not upgraded:
                    raise xs_errors.XenError('InvalidDev')
            self._pathrefresh(LVHDoISCSISR)
            LVHDSR.LVHDSR.create(self, sr_uuid, size)
        except Exception, inst:
            self.iscsi.detach(sr_uuid)
            raise xs_errors.XenError("SRUnavailable", opterr=inst)
开发者ID:pritha-srivastava,项目名称:sm,代码行数:51,代码来源:LVHDoISCSISR.py


示例10: _getSCSIid_from_LUN

 def _getSCSIid_from_LUN(self, sr_uuid):
     was_attached = True
     self.iscsi.attach(sr_uuid)
     dev = self.dconf['LUNid'].split(',')
     if len(dev) > 1:
         raise xs_errors.XenError('LVMOneLUN')
     path = os.path.join(self.iscsi.path,"LUN%s" % dev[0])
     if not util.wait_for_path(path, ISCSISR.MAX_TIMEOUT):
         util.SMlog("Unable to detect LUN attached to host [%s]" % path)
     try:
         SCSIid = scsiutil.getSCSIid(path)
     except:
         raise xs_errors.XenError('InvalidDev')
     self.iscsi.detach(sr_uuid)
     return SCSIid
开发者ID:pritha-srivastava,项目名称:sm,代码行数:15,代码来源:LVHDoISCSISR.py


示例11: refresh

def refresh(sid,npaths):
    # Refresh the multipath status
    util.SMlog("Refreshing LUN %s" % sid)
    if len(sid):
        path = DEVBYIDPATH + "/scsi-" + sid
        if not os.path.exists(path):
            scsiutil.rescan(scsiutil._genHostList(""))
            if not util.wait_for_path(path,60):
                raise xs_errors.XenError('Device not appeared yet')
        if not (mpp_luncheck.is_RdacLun(sid)):
            _refresh_DMP(sid,npaths)
        else:
            _refresh_MPP(sid,npaths)
    else:
        raise xs_errors.XenError('MPath not written yet')
开发者ID:letsboogey,项目名称:sm,代码行数:15,代码来源:mpath_dmp.py


示例12: _attach_LUN_bylunid

    def _attach_LUN_bylunid(self, lunid):
        if not self.attached:
            raise xs_errors.XenError("SRUnavailable")
        connected = []
        for val in self.adapter:
            if not self.pathdict.has_key(val):
                continue
            rec = self.pathdict[val]
            path = os.path.join(rec["path"], "LUN%s" % lunid)
            realpath = os.path.realpath(path)
            host = self.adapter[val]
            l = [realpath, host, 0, 0, lunid]

            addDevice = True
            if self.devs.has_key(realpath):
                # if the device is stale remove it before adding again
                real_SCSIid = None
                try:
                    real_SCSIid = scsiutil.getSCSIid(realpath)
                except:
                    pass

                if real_SCSIid != None:
                    # make sure this is the same scsiid, if not remove the device
                    cur_scsibuspath = glob.glob("/dev/disk/by-scsibus/*-%s:0:0:%s" % (host, lunid))
                    cur_SCSIid = os.path.basename(cur_scsibuspath[0]).split("-")[0]
                    if cur_SCSIid != real_SCSIid:
                        # looks stale, remove it
                        scsiutil.scsi_dev_ctrl(l, "remove")
                    else:
                        util.SMlog(
                            "Not attaching LUNID %s for adapter %s"
                            " since the device exists and the scsi id %s seems"
                            " to be valid. " % (lunid, val, real_SCSIid)
                        )
                        addDevice = False
                else:
                    # looks stale, remove it
                    scsiutil.scsi_dev_ctrl(l, "remove")

            if addDevice:
                # add the device
                scsiutil.scsi_dev_ctrl(l, "add")
                if not util.wait_for_path(path, MAX_LUNID_TIMEOUT):
                    util.SMlog("Unable to detect LUN attached to host on path [%s]" % path)
                    continue
            connected.append(path)
        return connected
开发者ID:heiden-deng,项目名称:sm,代码行数:48,代码来源:ISCSISR.py


示例13: _attach_LUN_byserialid

 def _attach_LUN_byserialid(self, serialid):
     if not self.attached:
         raise xs_errors.XenError('SRUnavailable')
     connected = []
     for val in self.adapter:
         if not self.pathdict.has_key(val):
             continue
         rec = self.pathdict[val]
         path = os.path.join(rec['path'],"SERIAL-%s" % serialid)
         realpath = os.path.realpath(path)
         if not self.devs.has_key(realpath):
             if not util.wait_for_path(path, 5):
                 util.SMlog("Unable to detect LUN attached to host on serial path [%s]" % path)
                 continue
         connected.append(path)
     return connected
开发者ID:JohnGarbutt,项目名称:xcp-storage-managers,代码行数:16,代码来源:ISCSISR.py


示例14: _LUNprint

    def _LUNprint(self, sr_uuid):
        if self.iscsi.attached:
            # Force a rescan on the bus.
            self.iscsi.refresh()
#            time.sleep(5)
        # Now call attach (handles the refcounting + session activa)
        self.iscsi.attach(sr_uuid)

        util.SMlog("LUNprint: waiting for path: %s" % self.iscsi.path)
        if util.wait_for_path("%s/LUN*" % self.iscsi.path, BaseISCSI.MAX_TIMEOUT):
            try:
                adapter=self.iscsi.adapter[self.iscsi.address]
                util.SMlog("adapter=%s" % adapter)

                # find a scsi device on which to issue a report luns command:
                devs=glob.glob("%s/LUN*" % self.iscsi.path)
                sgdevs = []
                for i in devs:
                    sgdevs.append(int(i.split("LUN")[1]))
                sgdevs.sort()
                sgdev = "%s/LUN%d" % (self.iscsi.path,sgdevs[0])                

                # issue a report luns:
                luns=util.pread2(["/usr/bin/sg_luns","-q",sgdev]).split('\n')
                nluns=len(luns)-1 # remove the line relating to the final \n
                # check if the LUNs are MPP-RDAC Luns
                scsi_id = scsiutil.getSCSIid(sgdev)

                # make sure we've got that many sg devices present
                for i in range(0,30): 
                    luns=scsiutil._dosgscan()
                    sgdevs=filter(lambda r: r[1]==adapter, luns)
                    if len(sgdevs)>=nluns:
                        util.SMlog("Got all %d sg devices" % nluns)
                        break
                    else:
                        util.SMlog("Got %d sg devices - expecting %d" % (len(sgdevs),nluns))
                        time.sleep(1)

                util.pread2(["/sbin/udevsettle"])
            except:
                pass # Make sure we don't break the probe...

        self.iscsi.print_LUNs()
        self.iscsi.detach(sr_uuid)        
开发者ID:chandrikas,项目名称:sm,代码行数:45,代码来源:OCFSoISCSISR.py


示例15: attach

    def attach(self, sr_uuid, vdi_uuid):
        # Does the iscsi login

        self.iqn = self.validate_iqn()
        self.path = self.login_target()

        log("IQN")
        log(self.iqn)

        if not util.wait_for_path(self.path, MAX_TIMEOUT):
            util.SMlog("Unable to detect LUN attached to host [%s]" % self.sr.path)
            raise xs_errors.XenError('VDIUnavailable')



        ret = super(VDILUN, self).attach(sr_uuid, vdi_uuid)
        self.attached = True
        return ret
开发者ID:cloudops,项目名称:ReLVHDoISCSISR,代码行数:18,代码来源:VDILUNSR.py


示例16: refresh_HostID

def refresh_HostID(HostID, fullrescan):
    LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
    li = []
    for l in LUNs:
        chan = re.sub(":[0-9]*$",'',os.path.basename(l))
        if chan not in li:
            li.append(chan)

    if len(li) and not fullrescan:
        for c in li:
            if not refresh_scsi_channel(c):
                fullrescan = True

    if fullrescan:
        util.SMlog("Full rescan of HostID %s" % HostID)
        path = '/sys/class/scsi_host/host%s/scan' % HostID
        if os.path.exists(path):
            try:
                scanstring = "- - -"
                f=open(path, 'w')
                f.write('%s\n' % scanstring)
                f.close()
                if len(li):
                    # Channels already exist, allow some time for
                    # undiscovered LUNs/channels to appear
                    time.sleep(2)
            except:
                pass
        # Host Bus scan issued, now try to detect channels
        if util.wait_for_path("/sys/class/scsi_disk/%s*" % HostID, 5):
            # At least one LUN is mapped
            LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
            li = []
            for l in LUNs:
                chan = re.sub(":[0-9]*$",'',os.path.basename(l))
                if chan not in li:
                    li.append(chan)
            for c in li:
                refresh_scsi_channel(c)
开发者ID:GaryKirkpatrick,项目名称:sm,代码行数:39,代码来源:scsiutil.py


示例17: refresh

def refresh(sid,npaths):
    # Fix udev bug (?): make sure it updates /dev/disk/by-id
    # Trigger the old way, if possible
    if os.path.exists("/sbin/udevtrigger"):
        util.pread2(["/sbin/udevtrigger"]) 
    else:
        util.pread2(["/sbin/udevadm","trigger"])

    # Refresh the multipath status
    util.SMlog("Refreshing LUN %s" % sid)
    if len(sid):
        path = DEVBYIDPATH + "/scsi-" + sid
        if not os.path.exists(path):
            scsiutil.rescan(scsiutil._genHostList(""))
            if not util.wait_for_path(path,60):
                raise xs_errors.XenError('Device not appeared yet')
        if not (mpp_luncheck.is_RdacLun(sid)):
            _refresh_DMP(sid,npaths)
        else:
            _refresh_MPP(sid,npaths)
    else:
        raise xs_errors.XenError('MPath not written yet')
开发者ID:johnelse,项目名称:sm,代码行数:22,代码来源:mpath_dmp.py


示例18: refresh_HostID

def refresh_HostID(HostID, scanstring):
    LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
    li = []
    for l in LUNs:
        chan = re.sub(":[0-9]*$",'',os.path.basename(l))
        if chan not in li:
            li.append(chan)

    fullrescan = True
    if len(li) and scanstring == "- - -":
        fullrescan = False
        for c in li:
            if not refresh_scsi_channel(c):
                fullrescan = True

    if fullrescan:
        util.SMlog("Rescanning HostID %s with %s" % (HostID, scanstring))
        path = '/sys/class/scsi_host/host%s/scan' % HostID
        if os.path.exists(path):
            try:
                f=open(path, 'w')
                f.write('%s\n' % scanstring)
                f.close()
            except:
                pass
        # Host Bus scan issued, now try to detect channels
        if util.wait_for_path("/sys/class/scsi_disk/%s*" % HostID, 5):
            # At least one LUN is mapped
            LUNs = glob.glob('/sys/class/scsi_disk/%s*' % HostID)
            li = []
            for l in LUNs:
                chan = re.sub(":[0-9]*$",'',os.path.basename(l))
                if chan not in li:
                    li.append(chan)
            for c in li:
                refresh_scsi_channel(c)
开发者ID:billysuh,项目名称:CloudStack,代码行数:36,代码来源:scsiutil.py


示例19: refresh_scsi_channel

def refresh_scsi_channel(channel):
    DEV_WAIT = 5
    util.SMlog("Refreshing channel %s" % channel)
    util.wait_for_path('/dev/disk/by-scsibus/*-%s*' % channel, DEV_WAIT)
    LUNs = glob.glob('/dev/disk/by-scsibus/*-%s*' % channel)
    try:
        rootdevs = util.dom0_disks()
    except:
        util.SMlog("Failed to query root disk, failing operation")
        return False
    
    # a) Find a LUN to issue a Query LUNs command
    li = []
    Query = False
    for lun in LUNs:
        try:
            hbtl = lun.split('-')[-1]
            h = hbtl.split(':')
            l=util.pread2(["/usr/bin/sg_luns","-q",lun]).split('\n')
            li = []
            for i in l:
                if len(i):
                    li.append(int(i[0:4], 16))
            util.SMlog("sg_luns query returned %s" % li)
            Query = True
            break
        except:
            pass
    if not Query:
        util.SMlog("Failed to detect or query LUN on Channel %s" % channel)
        return False

    # b) Remove stale LUNs
    current = glob.glob('/dev/disk/by-scsibus/*-%s:%s:%s*' % (h[0],h[1],h[2]))
    for cur in current:
        lunID = int(cur.split(':')[-1])
        newhbtl = ['',h[0],h[1],h[2],str(lunID)]
        if os.path.realpath(cur) in rootdevs:
            # Don't touch the rootdev
            if lunID in li: li.remove(lunID)
            continue
        
        # Check if LUN is stale, and remove it
        if not lunID in li:
            util.SMlog("Stale LUN detected. Removing HBTL: %s" % newhbtl)
            scsi_dev_ctrl(newhbtl,"remove")
            util.wait_for_nopath(cur, DEV_WAIT)
            continue
        else:
            li.remove(lunID)

        # Query SCSIid, check it matches, if not, re-probe
        cur_SCSIid = os.path.basename(cur).split("-%s:%s:%s" % (h[0],h[1],h[2]))[0]
        real_SCSIid = getSCSIid(cur)
        if cur_SCSIid != real_SCSIid:
            util.SMlog("HBTL %s does not match, re-probing" % newhbtl)
            scsi_dev_ctrl(newhbtl,"remove")
            util.wait_for_nopath(cur, DEV_WAIT)
            scsi_dev_ctrl(newhbtl,"add")
            util.wait_for_path('/dev/disk/by-scsibus/%s-%s' % (real_SCSIid,hbtl), DEV_WAIT)
            pass

    # c) Probe for any LUNs that are not present in the system
    for l in li:
        newhbtl = ['',h[0],h[1],h[2],str(l)]
        util.SMlog("Probing new HBTL: %s" % newhbtl)
        scsi_dev_ctrl(newhbtl,"add")
        util.wait_for_path('/dev/disk/by-scsibus/*-%s' % hbtl, DEV_WAIT)

    return True
开发者ID:billysuh,项目名称:CloudStack,代码行数:70,代码来源:scsiutil.py


示例20: load


#.........这里部分代码省略.........
                                  self.iscsi.chapuser,
                                  self.iscsi.chappassword,
                                  targetIQN=self.iscsi.targetIQN)
                        if len(map) == 0:
                            util.SMlog("Discovery for iscsi data targetIQN %s,"
                                       " portal %s returned empty list"
                                       " Trying another path if available" %
                                       (self.iscsi.targetIQN,
                                        self.iscsi.target))
                            continue
                    except:
                        util.SMlog("Discovery failed for iscsi data targetIQN"
                                   " %s, portal %s. Trying another path if"
                                   " available" %
                                   (self.iscsi.targetIQN, self.iscsi.target))
                        continue
                    try:
                        iscsilib.login(self.iscsi.target,
                                       self.iscsi.targetIQN,
                                       self.iscsi.chapuser,
                                       self.iscsi.chappassword,
                                       self.iscsi.incoming_chapuser,
                                       self.iscsi.incoming_chappassword,
                                       self.mpath == "true")
                    except:
                        util.SMlog("Login failed for iscsi data targetIQN %s,"
                                   " portal %s. Trying another path"
                                   " if available" %
                                   (self.iscsi.targetIQN, self.iscsi.target))
                        continue
                    target_success = True;
                    forced_login = True
                # A session should be active.
                if not util.wait_for_path(self.iscsi.path, ISCSISR.MAX_TIMEOUT):
                    util.SMlog("%s has no associated LUNs" % self.iscsi.targetIQN)
                    continue
                scsiid_path = "/dev/disk/by-id/scsi-" + self.SCSIid
                if not util.wait_for_path(scsiid_path, ISCSISR.MAX_TIMEOUT):
                    util.SMlog("%s not found" %scsiid_path)
                    continue
                for file in filter(self.iscsi.match_lun, util.listdir(self.iscsi.path)):
                    lun_path = os.path.join(self.iscsi.path,file)
                    lun_dev = scsiutil.getdev(lun_path)
                    try:
                        lun_scsiid = scsiutil.getSCSIid(lun_dev)
                    except:
                        util.SMlog("getSCSIid failed on %s in iscsi %s: LUN"
                                   " offline or iscsi path down" %
                                    (lun_dev, self.iscsi.path))
                        continue
                    util.SMlog("dev from lun %s %s" %(lun_dev, lun_scsiid))
                    if lun_scsiid == self.SCSIid:
                        util.SMlog("lun match in %s" %self.iscsi.path)
                        dev_match = True
                        # No more need to raise ISCSITarget exception.
                        # Resetting attempt_discovery
                        attempt_discovery = False
                        break
                if dev_match:
                    if iii == 0:
                        break
                    util.SMlog("IQN reordering needed")
                    new_iscsiSRs = []
                    IQNs = {}
                    IQNstring = ""
                    # iscsiSRs can be seen as a circular buffer: the head now is the matching one
开发者ID:pritha-srivastava,项目名称:sm,代码行数:67,代码来源:LVHDoISCSISR.py



注:本文中的util.wait_for_path函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.warn函数代码示例发布时间:2022-05-26
下一篇:
Python util.verify_started_in_right_directory函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap