lib/utils/job-utils/catalog-searcher.js
function getDriveIdCatalogExt(nodeId, filter, extendJbod) {
        return getDriveIdCatalog(nodeId, filter)
        .then(function (driveIds) {
            // get virtualDisk data from megaraid-virtual-disks catalog
            var foundVdHasValue = _.find(driveIds, function (driveId) {
                return !_.isEmpty(driveId.virtualDisk);
            });

            if (!foundVdHasValue && !extendJbod) {
                // If none of drives are VDs, and extend JBOD is not required,
                // it is not necessary to extend Megaraid information.
                return Promise.resolve(driveIds);
            }

            return Promise.all([
                foundVdHasValue ? getVirtualDiskCatalog(nodeId) : Promise.resolve(),
                extendJbod ? getPhysicalDiskCatalog(nodeId) : Promise.resolve(),
                getRaidControllerVendor(nodeId)
            ])
            .spread(function(virtualDiskData, physicalDiskData, controllerVendors){
                return Promise.map(driveIds, function(driveId){
                    if (!_.isEmpty(driveId.virtualDisk)) {
                        return _getVdExtDriveIdCatalog(
                            nodeId,
                            driveId,
                            virtualDiskData,
                            controllerVendors
                        );
                    }
                    if (extendJbod){
                        return _getJbodExtDriveIdCatalog(
                            nodeId,
                            driveId,
                            physicalDiskData,
                            controllerVendors
                        );
                    }
                    return driveId;
                });
            });
        });
    }
function getDriveIdCatalogExt(nodeId, filter, extendJbod) {
        return getDriveIdCatalog(nodeId, filter)
        .then(function (driveIds) {
            // get virtualDisk data from megaraid-virtual-disks catalog
            var foundVdHasValue = _.find(driveIds, function (driveId) {
                return !_.isEmpty(driveId.virtualDisk);
            });

            if (!foundVdHasValue && !extendJbod) {
                // If none of drives are VDs, and extend JBOD is not required,
                // it is not necessary to extend Megaraid information.
                return Promise.resolve(driveIds);
            }

            return Promise.all([
                foundVdHasValue ? getVirtualDiskCatalog(nodeId) : Promise.resolve(),
                extendJbod ? getPhysicalDiskCatalog(nodeId) : Promise.resolve(),
                getRaidControllerVendor(nodeId)
            ])
            .spread(function(virtualDiskData, physicalDiskData, controllerVendors){
                return Promise.map(driveIds, function(driveId){
                    if (!_.isEmpty(driveId.virtualDisk)) {
                        return _getVdExtDriveIdCatalog(
                            nodeId,
                            driveId,
                            virtualDiskData,
                            controllerVendors
                        );
                    }
                    if (extendJbod){
                        return _getJbodExtDriveIdCatalog(
                            nodeId,
                            driveId,
                            physicalDiskData,
                            controllerVendors
                        );
                    }
                    return driveId;
                });
            });
        });
    }
function getDriveIdCatalogExt ( nodeId , filter , extendJbod ) { return getDriveIdCatalog ( nodeId , filter ) . then ( function ( driveIds ) { // get virtualDisk data from megaraid-virtual-disks catalog var foundVdHasValue = _ . find ( driveIds , function ( driveId ) { return ! _ . isEmpty ( driveId . virtualDisk ) ; } ) ; if ( ! foundVdHasValue && ! extendJbod ) { // If none of drives are VDs, and extend JBOD is not required, // it is not necessary to extend Megaraid information. return Promise . resolve ( driveIds ) ; } return Promise . all ( [ foundVdHasValue ? getVirtualDiskCatalog ( nodeId ) : Promise . resolve ( ) , extendJbod ? getPhysicalDiskCatalog ( nodeId ) : Promise . resolve ( ) , getRaidControllerVendor ( nodeId ) ] ) . spread ( function ( virtualDiskData , physicalDiskData , controllerVendors ) { return Promise . map ( driveIds , function ( driveId ) { if ( ! _ . isEmpty ( driveId . virtualDisk ) ) { return _getVdExtDriveIdCatalog ( nodeId , driveId , virtualDiskData , controllerVendors ) ; } if ( extendJbod ) { return _getJbodExtDriveIdCatalog ( nodeId , driveId , physicalDiskData , controllerVendors ) ; } return driveId ; } ) ; } ) ; } ) ; }
Get extended driveId catalog
@param {String} nodeId - node identifier
@param {Object} driveIds - driveId list retrieved from driveId catalogs
@param {Boolean} extendJbod - flag for if we should extend JBOD physical information
@return {Promise} Drive catalogs extended with Megaraid information
Get extended driveId catalog