Search in sources :

Example 1 with MemoryBean

use of com.huawei.esight.service.bean.MemoryBean in project Server_Management_Plugin_vRealize by Huawei.

the class ESightAdapter method setMemory.

private List<ResourceKey> setMemory(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
    List<ResourceKey> deviceChildKeys = new ArrayList<>();
    List<MemoryBean> memoryBeans = device.getMemory();
    if (!memoryBeans.isEmpty()) {
        List<ResourceKey> memoryResourceKey = new ArrayList<>();
        List<String> childHealthList = new ArrayList<>();
        for (MemoryBean memory : memoryBeans) {
            ResourceKey key = memory.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
            memoryResourceKey.add(key);
            allResourceList.add(key);
            childHealthList.add(ConvertUtils.convertHealthState(memory.getHealthState()));
        }
        // memory Group
        ResourceKey memoryGroup = device.createGroupKey(Constant.TREE_MEMORY_GROUP, Constant.KIND_MEMORY_GROUP, memoryResourceKey, relationshipsByResource, getAdapterKind());
        deviceChildKeys.add(memoryGroup);
        // add health state here
        setHealStatus4GroupObject(memoryGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
    }
    return deviceChildKeys;
}
Also used : ArrayList(java.util.ArrayList) MemoryBean(com.huawei.esight.service.bean.MemoryBean) ResourceKey(com.integrien.alive.common.adapter3.ResourceKey)

Aggregations

MemoryBean (com.huawei.esight.service.bean.MemoryBean)1 ResourceKey (com.integrien.alive.common.adapter3.ResourceKey)1 ArrayList (java.util.ArrayList)1