Example #1
0
def get_probe_possibility(path,lunid):
    scsiid=scsiutil.getSCSIid(path)
    size=scsiutil.getsize(path)
    serial=scsiutil.getserial(path)
    vendor=scsiutil.getmanufacturer(path)
    return { 'info' : {'vendor' : vendor,
                       'serial' : serial,
                       'LUNid' : lunid,
                       'size' : "%d" % size,
                       'SCSIid' : scsiid},
             'new_device_config' : {'SCSIid' : scsiid} }
 def _query(self, path, id):
     self.uuid = scsiutil.gen_uuid_from_string(scsiutil.getuniqueserial(path))
     self.location = self.uuid
     self.vendor = scsiutil.getmanufacturer(path)
     self.serial = scsiutil.getserial(path)
     self.LUNid = id
     self.size = scsiutil.getsize(path)
     self.SCSIid = scsiutil.getSCSIid(path)
     self.path = path
     sm_config = util.default(self, "sm_config", lambda: {})
     sm_config['LUNid'] = str(self.LUNid)
     sm_config['SCSIid'] = self.SCSIid
     self.sm_config = sm_config
Example #3
0
 def _query(self, path, id):
     self.uuid = scsiutil.gen_uuid_from_string(
         scsiutil.getuniqueserial(path))
     self.location = self.uuid
     self.vendor = scsiutil.getmanufacturer(path)
     self.serial = scsiutil.getserial(path)
     self.LUNid = id
     self.size = scsiutil.getsize(path)
     self.SCSIid = scsiutil.getSCSIid(path)
     self.path = path
     sm_config = util.default(self, "sm_config", lambda: {})
     sm_config['LUNid'] = str(self.LUNid)
     sm_config['SCSIid'] = self.SCSIid
     self.sm_config = sm_config
Example #4
0
    def _query(self, path, id, uuid=None, scsi_id=None):
        """Overloaded function with mostly duplicated code"""
        if uuid:
            self.uuid = uuid
        else:
            util.SMlog("RawHBA: uuid should not be generated..")
            self.uuid = scsiutil.gen_uuid_from_string(
                scsiutil.getuniqueserial(path)
                )
        if scsi_id:
            self.SCSIid = scsi_id
        else:
            # It is usually unnecessary to calculate it again but scsi_id
            # is used as a flag in this function and we cannot guarantee
            # this info is already available at call time
            self.SCSIid = scsiutil.getSCSIid(path)
        self.location = self.uuid
        self.vendor = scsiutil.getmanufacturer(path)
        self.serial = scsiutil.getserial(path)
        self.LUNid = id

        # Handle resize done at the array size. The resize gets reflected
        # only when the vdi is not in detached state. Do this if we the vdi
        # is known to xapi
        try:
            vdi_ref = self.sr.session.xenapi.VDI.get_by_uuid(self.uuid)
            # Check if the vbd is not in attached state, do a LUN rescan
            # to reflect the array LUN
            dev = [path]
            if scsi_id:
                # We want all the devices with this scsi_id
                dev = scsiutil._genReverseSCSIidmap(scsi_id)
            if self.sr.srcmd.cmd == "vdi_attach":
                scsiutil.refreshdev(dev)
            elif not B_util.is_vdi_attached(self.sr.session, vdi_ref):
                scsiutil.refreshdev(dev)
        except:
            pass

        self.size = scsiutil.getsize(path)
        self.path = path
        sm_config = util.default(self, "sm_config", lambda: {})
        sm_config['LUNid'] = str(self.LUNid)
        sm_config['SCSIid'] = self.SCSIid
        # Make sure to use kernel blkback (not blktap3) for raw LUNs
        sm_config['backend-kind'] = 'vbd'
        self.sm_config = sm_config
Example #5
0
    def _query(self, path, id, uuid=None, scsi_id=None):
        """Overloaded function with mostly duplicated code"""
        if uuid:
            self.uuid = uuid
        else:
            util.SMlog("RawHBA: uuid should not be generated..")
            self.uuid = scsiutil.gen_uuid_from_string(
                scsiutil.getuniqueserial(path)
                )
        if scsi_id:
            self.SCSIid = scsi_id
        else:
            # It is usually unnecessary to calculate it again but scsi_id
            # is used as a flag in this function and we cannot guarantee
            # this info is already available at call time
            self.SCSIid = scsiutil.getSCSIid(path)
        self.location = self.uuid
        self.vendor = scsiutil.getmanufacturer(path)
        self.serial = scsiutil.getserial(path)
        self.LUNid = id

        # Handle resize done at the array size. The resize gets reflected
        # only when the vdi is not in detached state. Do this if we the vdi
        # is known to xapi
        try:
            vdi_ref = self.sr.session.xenapi.VDI.get_by_uuid(self.uuid)
            # Check if the vbd is not in attached state, do a LUN rescan
            # to reflect the array LUN
            dev = [path]
            if scsi_id:
                # We want all the devices with this scsi_id
                dev = scsiutil._genReverseSCSIidmap(scsi_id)
            if self.sr.srcmd.cmd == "vdi_attach":
                scsiutil.refreshdev(dev)
            elif not B_util.is_vdi_attached(self.sr.session, vdi_ref):
                scsiutil.refreshdev(dev)
        except:
            pass

        self.size = scsiutil.getsize(path)
        self.path = path
        sm_config = util.default(self, "sm_config", lambda: {})
        sm_config['LUNid'] = str(self.LUNid)
        sm_config['SCSIid'] = self.SCSIid
        # Make sure to use kernel blkback (not blktap3) for raw LUNs
        sm_config['backend-kind'] = 'vbd'
        self.sm_config = sm_config
Example #6
0
def get_probe_possibility(path, lunid):
    scsiid = scsiutil.getSCSIid(path)
    size = scsiutil.getsize(path)
    serial = scsiutil.getserial(path)
    vendor = scsiutil.getmanufacturer(path)
    return {
        'info': {
            'vendor': vendor,
            'serial': serial,
            'LUNid': lunid,
            'size': "%d" % size,
            'SCSIid': scsiid
        },
        'new_device_config': {
            'SCSIid': scsiid
        }
    }
def queryLUN(dbg, path, id):
    vendor = scsiutil.getmanufacturer(dbg, path)
    serial = scsiutil.getserial(dbg, path)
    size = scsiutil.getsize(dbg, path)
    SCSIid = scsiutil.getSCSIid(dbg, path)
    return (id, vendor, serial, size, SCSIid)
Example #8
0
def queryLUN(dbg, path, id):
    vendor = scsiutil.getmanufacturer(dbg, path)
    serial = scsiutil.getserial(dbg, path)
    size = scsiutil.getsize(dbg, path)
    SCSIid = scsiutil.getSCSIid(dbg, path)
    return (id, vendor, serial, size, SCSIid)