use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setCpu.
private List<ResourceKey> setCpu(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<CPUBean> cpuBeans = device.getCPU();
if (!cpuBeans.isEmpty()) {
List<ResourceKey> cpuResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (CPUBean cpu : cpuBeans) {
ResourceKey key = cpu.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
cpuResourceKey.add(key);
allResourceList.add(key);
childHealthList.add(ConvertUtils.convertHealthState(cpu.getHealthState()));
}
// CPU Group
ResourceKey cpuGroup = device.createGroupKey(Constant.TREE_CPU_GROUP, Constant.KIND_CPU_GROUP, cpuResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(cpuGroup);
// add health state here
setHealStatus4GroupObject(cpuGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setConfig.
private void setConfig(String host, List<ResourceKey> allResourceList, List<ResourceKey> serverDeviceKeyList, List<String> serverTypeChildHealthList, ServerDeviceBean deviceBean) {
ServerDeviceDetailBean device = service.getServerDetail(deviceBean.getDn());
if (device == null) {
logger.error("Failed to get detail of device with dn = " + deviceBean.getDn());
return;
}
ResourceKey deviceResourceKey = device.convert2Resource(deviceBean.getDn(), getAdapterKind(), metricsByResource);
// dn --> device key map
deviceResourceKeyMap.put(deviceBean.getDn(), deviceResourceKey);
deviceHealthMap.put(deviceBean.getDn(), ConvertUtils.convertHealthState(device.getStatus()));
serverTypeChildHealthList.add(ConvertUtils.convertHealthState(device.getStatus()));
allResourceList.add(deviceResourceKey);
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<ResourceKey> childBladeDeviceKeyList = new ArrayList<>();
// child Blades
List<ChildBladeBean> childBladeBeans = deviceBean.getChildBlades();
for (ChildBladeBean bean : childBladeBeans) {
childBladeDeviceKeyList.add(deviceResourceKeyMap.get(bean.getDn()));
}
// 处理childBlade显示重复的问题
if (!deviceBean.isChildBlade()) {
serverDeviceKeyList.add(deviceResourceKey);
}
// board
deviceChildKeys.addAll(setBoard(host, allResourceList, deviceBean, device));
// CPU
deviceChildKeys.addAll(setCpu(host, allResourceList, deviceBean, device));
// disk
deviceChildKeys.addAll(setDisk(host, allResourceList, deviceBean, device));
// fan
deviceChildKeys.addAll(setFan(host, allResourceList, deviceBean, device, childBladeBeans));
// memory
deviceChildKeys.addAll(setMemory(host, allResourceList, deviceBean, device));
// PSU
deviceChildKeys.addAll(setPsu(host, allResourceList, deviceBean, device, childBladeBeans));
// device Group
deviceChildKeys.addAll(setDeviceGroup(device, childBladeDeviceKeyList, childBladeBeans));
// PCIE
deviceChildKeys.addAll(setPcie(host, allResourceList, deviceBean, device));
// RAID
deviceChildKeys.addAll(setRaid(host, allResourceList, deviceBean, device));
// network card
deviceChildKeys.addAll(setNetworkCard(host, allResourceList, deviceBean, device));
// Mezz
deviceChildKeys.addAll(setMezz(host, allResourceList, deviceBean, device));
// 设置server device和group object(如cpuGroup, diskGroup, fanGroup等)的关联关系
relationshipsByResource.put(deviceResourceKey, deviceChildKeys);
allResourceList.addAll(deviceChildKeys);
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setDisk.
private List<ResourceKey> setDisk(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<DiskBean> diskBeans = device.getDisk();
if (!diskBeans.isEmpty()) {
List<ResourceKey> diskResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (DiskBean disk : diskBeans) {
ResourceKey key = disk.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
diskResourceKey.add(key);
allResourceList.add(key);
childHealthList.add(ConvertUtils.convertHealthState(disk.getHealthState()));
}
// disk Group
ResourceKey diskGroup = device.createGroupKey(Constant.TREE_DISK_GROUP, Constant.KIND_DISK_GROUP, diskResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(diskGroup);
// add health state here
setHealStatus4GroupObject(diskGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setFan.
private List<ResourceKey> setFan(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device, List<ChildBladeBean> childBladeBeans) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<FanBean> fanBeans = device.getFan();
if (!fanBeans.isEmpty()) {
List<ResourceKey> fanResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (FanBean fan : fanBeans) {
ResourceKey key = fan.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
fanResourceKey.add(key);
allResourceList.add(key);
if (childBladeBeans.isEmpty()) {
childHealthList.add(ConvertUtils.convertHealthState(fan.getHealthState()));
}
}
// fan Group
ResourceKey fanGroup = device.createGroupKey(Constant.TREE_FAN_GROUP, Constant.KIND_FAN_GROUP, fanResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(fanGroup);
// add health state here
if (!childBladeBeans.isEmpty()) {
String groupHealth = ConvertUtils.convertHealthState(device.getFanOverHealth());
childHealthList.add(groupHealth);
}
setHealStatus4GroupObject(fanGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
use of com.integrien.alive.common.adapter3.ResourceKey in project Server_Management_Plugin_vRealize by Huawei.
the class ESightAdapter method setNetworkCard.
private List<ResourceKey> setNetworkCard(String host, List<ResourceKey> allResourceList, ServerDeviceBean deviceBean, ServerDeviceDetailBean device) {
List<ResourceKey> deviceChildKeys = new ArrayList<>();
List<NetworkCardBean> networkcardBeans = device.getNetworkCard();
if (!networkcardBeans.isEmpty()) {
List<ResourceKey> netWorkCardResourceKey = new ArrayList<>();
List<String> childHealthList = new ArrayList<>();
for (NetworkCardBean bean : networkcardBeans) {
ResourceKey key = bean.convert2Resource(host + deviceBean.getDn(), getAdapterKind(), metricsByResource);
netWorkCardResourceKey.add(key);
allResourceList.add(key);
childHealthList.add(ConvertUtils.convertHealthState(bean.getHealthState()));
}
// network card Group
ResourceKey networkCardGroup = device.createGroupKey(Constant.TREE_NETWORK_CARD_GROUP, Constant.KIND_NETWORK_CARD_GROUP, netWorkCardResourceKey, relationshipsByResource, getAdapterKind());
deviceChildKeys.add(networkCardGroup);
setHealStatus4GroupObject(networkCardGroup, Constant.ATTR_HEALTHSTATE, childHealthList);
}
return deviceChildKeys;
}
Aggregations