public Map<String, Object> update() { Map<String, Object> result = new HashMap<String, Object>(); this.initArgs(this.getMessage().getParams()); cimClient(ipAddress, username, password, namespace, port, protocol, "v7000"); HashMap<String, String> cmap = new HashMap<String, String>(); cmap.put("status", status); if (errorq.equals("")) { try { double TotalManagedSpace = 0; double RemainingManagedSpace = 0; double assignedrate = 0.00; if ((mapV != null) && mapV.v7000StoragePools != null) { for (CIM_StoragePool pool : mapV.v7000StoragePools) { TotalManagedSpace = TotalManagedSpace + pool.getTotalManagedSpace(); RemainingManagedSpace = RemainingManagedSpace + pool.getRemainingManagedSpace(); } TotalManagedSpace = TotalManagedSpace / 1024 / 1024 / 1024; BigDecimal bd = new BigDecimal(TotalManagedSpace); bd = bd.setScale(1, BigDecimal.ROUND_HALF_UP); TotalManagedSpace = bd.doubleValue(); RemainingManagedSpace = RemainingManagedSpace / 1024 / 1024 / 1024; bd = new BigDecimal(RemainingManagedSpace); bd = bd.setScale(1, BigDecimal.ROUND_HALF_UP); RemainingManagedSpace = bd.doubleValue(); if (TotalManagedSpace > 0) assignedrate = (TotalManagedSpace - RemainingManagedSpace) / TotalManagedSpace; bd = new BigDecimal(assignedrate); bd = bd.setScale(2, BigDecimal.ROUND_HALF_UP); assignedrate = bd.doubleValue(); // inf.getUpdate(); cmap.put("totalManagedSpace", TotalManagedSpace + ""); cmap.put("remainingManagedSpace", RemainingManagedSpace + ""); cmap.put("AllocatedCapacityRate", assignedrate + ""); } if ((mapFCP != null) && (mapFCP.FCPortlist != null)) for (CIM_FCPort fcport : mapFCP.FCPortlist) { cmap.put(fcport.getDeviceId() + "OperationalStatus", fcport.getOperationalStatus()); } if ((mapV != null) && (mapV.v7000StorageVolumes != null)) { for (CIM_StorageVolume StorageVolume : mapV.v7000StorageVolumes) { cmap.put( StorageVolume.getDeviceId() + "OperationalStatus", StorageVolume.getOperationalStatus()); double lunsize = StorageVolume.getBlockSize() * StorageVolume.getNumberOfBlocks() / 1024 / 1024 / 1024; BigDecimal bd = new BigDecimal(lunsize); bd = bd.setScale(1, BigDecimal.ROUND_HALF_UP); lunsize = bd.doubleValue(); cmap.put(StorageVolume.getDeviceId() + "LunSize", lunsize + ""); } } } catch (Exception e) { } } else { cmap.put("error", errorq); } int len = this.Counters.size(); if (cmap.containsKey("error")) { this.lastError = cmap.get("error"); result.put("stateString", "update fail"); result.put("countersInError", len); } else { int errorCount = 0; StringBuffer statestring = new StringBuffer(); int j = 0; for (String s : this.Counters.keySet()) { String s1 = this.Counters.get(s).toString(); // .replace("-", // "/"); String value = ""; if (cmap.containsKey(s)) { String v = cmap.get(s); value = v; try { int V1 = Integer.parseInt(v); result.put(s1, V1); result.put(s, V1); } catch (Exception ex) { try { Float Vf = Float.parseFloat(v); result.put(s1, Vf); result.put(s, Vf); } catch (Exception ex1) { if (v instanceof String) { if (v.equals("false")) { result.put(s1, false); result.put(s, false); } else if (v.equals("true")) { result.put(s1, true); result.put(s, true); } else { result.put(s1, v); result.put(s, v); } } else { result.put(s1, v); result.put(s, v); } } } } else { ++errorCount; value = "n/a"; result.put(s1, "n/a"); } if (value.equals("")) statestring.append(s1).append(" = \"\""); else { statestring.append(s1).append(" = ").append(value); } if (j != len - 1) statestring.append(", "); ++j; } result.put("stateString", statestring.toString()); result.put("countersInError", errorCount); } return result; }
public Map<String, Object> getBrowseData() { Map<String, Object> res_map = new HashMap<String, Object>(); this.initArgs(this.getMessage().getParams()); String status = getserverstatus( this.ipAddress, this.username, this.password, this.namespace, this.port, this.protocol, "v7000"); if (status.equals("ONLINE")) { cimClient(ipAddress, username, password, namespace, port, protocol, "v7000"); res_map.put("SAN", "SAN"); res_map.put("status", "SAN/status"); res_map.put("totalManagedSpace", "SAN/totalManagedSpace"); res_map.put("remainingManagedSpace", "SAN/remainingManagedSpace"); res_map.put("AllocatedCapacityRate", "SAN/AllocatedCapacityRate"); res_map.put("FibreChannel", "SAN/FibreChannel"); if (mapFCP != null) for (CIM_FCPort fcport : mapFCP.FCPortlist) { if (!res_map.containsKey(fcport.getSystemName())) { res_map.put(fcport.getSystemName(), "SAN/FibreChannel/" + fcport.getSystemName()); res_map.put( fcport.getDeviceId(), "SAN/FibreChannel/" + fcport.getSystemName() + "/" + fcport.getElementName()); res_map.put( fcport.getDeviceId() + "OperationalStatus", "SAN/FibreChannel/" + fcport.getSystemName() + "/" + fcport.getElementName() + "/" + "OperationalStatus"); } else { res_map.put( fcport.getDeviceId(), "SAN/FibreChannel/" + fcport.getSystemName() + "/" + fcport.getElementName()); res_map.put( fcport.getDeviceId() + "OperationalStatus", "SAN/FibreChannel/" + fcport.getSystemName() + "/" + fcport.getElementName() + "/" + "OperationalStatus"); } } res_map.put("Pools", "SAN/Pools"); if (mapV != null) for (CIM_StorageVolume StorageVolume : mapV.v7000StorageVolumes) { if (!res_map.containsKey(StorageVolume.getPoolName())) { res_map.put(StorageVolume.getPoolName(), "SAN/Pools/" + StorageVolume.getPoolName()); res_map.put( StorageVolume.getDeviceId(), "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId()); res_map.put( StorageVolume.getDeviceId() + "OperationalStatus", "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId() + "/OperationalStatus"); res_map.put( StorageVolume.getDeviceId() + "LunSize", "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId() + "/LUN Size"); } else { res_map.put( StorageVolume.getDeviceId(), "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId()); res_map.put( StorageVolume.getDeviceId() + "OperationalStatus", "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId() + "/OperationalStatus"); res_map.put( StorageVolume.getDeviceId() + "LunSize", "SAN/Pools/" + StorageVolume.getPoolName() + "/" + StorageVolume.getDeviceId() + "/LUN Size"); } } } return res_map; }