lib/utils/job-utils/catalog-searcher.js
function _getVdExtDriveIdCatalog(nodeId, driveId, virtualDiskData, vendors){
        var match = driveId.virtualDisk.match(/^\/c(\d+)\/v(\d+)/);
        if (!match) {
            return driveId;
        }
        var vid = match[2];
        var cid = match[1];
        var vdInfo;
        _.forEach(virtualDiskData.Controllers, function(controller) {
            var vd = _.get(controller,
                'Response Data[%s]'.format(driveId.virtualDisk));

            if (vd) {
                vdInfo = vd[0];
                vdInfo.oemId = controller.oemId;
                vdInfo.pdList = _.get(controller,
                    'Response Data[PDs for VD %d]'.format(vid)
                );
                return false; // break forEach
            }
        });

        if(!vdInfo) {
            // clear virtualDisk if no matched info found in catalog
            driveId.virtualDisk = '';
            return driveId;
        }
        // set extended info to driveId catalog
        driveId.size = vdInfo.Size;
        driveId.type = vdInfo.TYPE;
        driveId.controllerId = cid;
        driveId.physicalDisks = _.map(vdInfo.pdList, function (pd) {
            // for more physical disk info, search megaraid-physical-drives
            var eidslt = pd['EID:Slt'].split(':');
            return {
                deviceId : pd.DID,
                enclosureId : eidslt[0],
                slotId : eidslt[1],
                size: pd.Size,
                protocol: pd.Intf,
                type: pd.Med,
                model: pd.Model
            };
        });
        driveId.deviceIds = _.map(driveId.physicalDisks, function (disk) {
            return disk.deviceId;
        });
        driveId.slotIds = _.map(driveId.physicalDisks, function (disk) {
            // slotId : /c0/e252/s10
            return '/c%d/e%d/s%d'.format(cid, disk.enclosureId, disk.slotId);
        });
        // OEM id is Dell or LSI
        driveId.controllerVendor = vendors[_.parseInt(cid)];

        return driveId;
    }
function _getVdExtDriveIdCatalog(nodeId, driveId, virtualDiskData, vendors){
        var match = driveId.virtualDisk.match(/^\/c(\d+)\/v(\d+)/);
        if (!match) {
            return driveId;
        }
        var vid = match[2];
        var cid = match[1];
        var vdInfo;
        _.forEach(virtualDiskData.Controllers, function(controller) {
            var vd = _.get(controller,
                'Response Data[%s]'.format(driveId.virtualDisk));

            if (vd) {
                vdInfo = vd[0];
                vdInfo.oemId = controller.oemId;
                vdInfo.pdList = _.get(controller,
                    'Response Data[PDs for VD %d]'.format(vid)
                );
                return false; // break forEach
            }
        });

        if(!vdInfo) {
            // clear virtualDisk if no matched info found in catalog
            driveId.virtualDisk = '';
            return driveId;
        }
        // set extended info to driveId catalog
        driveId.size = vdInfo.Size;
        driveId.type = vdInfo.TYPE;
        driveId.controllerId = cid;
        driveId.physicalDisks = _.map(vdInfo.pdList, function (pd) {
            // for more physical disk info, search megaraid-physical-drives
            var eidslt = pd['EID:Slt'].split(':');
            return {
                deviceId : pd.DID,
                enclosureId : eidslt[0],
                slotId : eidslt[1],
                size: pd.Size,
                protocol: pd.Intf,
                type: pd.Med,
                model: pd.Model
            };
        });
        driveId.deviceIds = _.map(driveId.physicalDisks, function (disk) {
            return disk.deviceId;
        });
        driveId.slotIds = _.map(driveId.physicalDisks, function (disk) {
            // slotId : /c0/e252/s10
            return '/c%d/e%d/s%d'.format(cid, disk.enclosureId, disk.slotId);
        });
        // OEM id is Dell or LSI
        driveId.controllerVendor = vendors[_.parseInt(cid)];

        return driveId;
    }
function _getVdExtDriveIdCatalog ( nodeId , driveId , virtualDiskData , vendors ) { var match = driveId . virtualDisk . match ( / ^\/c(\d+)\/v(\d+) / ) ; if ( ! match ) { return driveId ; } var vid = match [ 2 ] ; var cid = match [ 1 ] ; var vdInfo ; _ . forEach ( virtualDiskData . Controllers , function ( controller ) { var vd = _ . get ( controller , 'Response Data[%s]' . format ( driveId . virtualDisk ) ) ; if ( vd ) { vdInfo = vd [ 0 ] ; vdInfo . oemId = controller . oemId ; vdInfo . pdList = _ . get ( controller , 'Response Data[PDs for VD %d]' . format ( vid ) ) ; return false ; // break forEach } } ) ; if ( ! vdInfo ) { // clear virtualDisk if no matched info found in catalog driveId . virtualDisk = '' ; return driveId ; } // set extended info to driveId catalog driveId . size = vdInfo . Size ; driveId . type = vdInfo . TYPE ; driveId . controllerId = cid ; driveId . physicalDisks = _ . map ( vdInfo . pdList , function ( pd ) { // for more physical disk info, search megaraid-physical-drives var eidslt = pd [ 'EID:Slt' ] . split ( ':' ) ; return { deviceId : pd . DID , enclosureId : eidslt [ 0 ] , slotId : eidslt [ 1 ] , size : pd . Size , protocol : pd . Intf , type : pd . Med , model : pd . Model } ; } ) ; driveId . deviceIds = _ . map ( driveId . physicalDisks , function ( disk ) { return disk . deviceId ; } ) ; driveId . slotIds = _ . map ( driveId . physicalDisks , function ( disk ) { // slotId : /c0/e252/s10 return '/c%d/e%d/s%d' . format ( cid , disk . enclosureId , disk . slotId ) ; } ) ; // OEM id is Dell or LSI driveId . controllerVendor = vendors [ _ . parseInt ( cid ) ] ; return driveId ; }
Get extended driveId catalog data for disk from virtualDiskData
@param {String} nodeId - node identifier
@param {Object} driveId - driveId catalog
@param {Object} virtualDiskData - Megaraid virtual disk catalogs
@param {Array} vendors - Drive vendor controller list
@return {Promise} driveId catalogs extended
Get extended driveId catalog data for disk from virtualDiskData