Exemplo n.º 1
0
 private static Map<String, String> nodeToMap(VmmNode node) {
   final HashMap<String, String> map = new HashMap<String, String>(7);
   map.put(FIELD_HOSTNAME, node.getHostname());
   map.put(FIELD_POOL, node.getPoolName());
   map.put(FIELD_MEMORY, String.valueOf(node.getMemory()));
   map.put(FIELD_MEM_REMAIN, String.valueOf(node.getMemRemain()));
   map.put(FIELD_NETWORKS, node.getNetworkAssociations());
   map.put(FIELD_IN_USE, String.valueOf(!node.isVacant()));
   map.put(FIELD_ACTIVE, String.valueOf(node.isActive()));
   return map;
 }
Exemplo n.º 2
0
 private static Map<String, String> nodeReportToMap(NodeReport nodeReport) {
   final HashMap<String, String> map = new HashMap<String, String>(2);
   map.put(FIELD_HOSTNAME, nodeReport.getHostname());
   map.put(FIELD_RESULT, nodeReport.getState());
   final VmmNode node = nodeReport.getNode();
   if (node == null) {
     map.put(FIELD_POOL, null);
     map.put(FIELD_MEMORY, null);
     map.put(FIELD_NETWORKS, null);
     map.put(FIELD_IN_USE, null);
     map.put(FIELD_ACTIVE, null);
   } else {
     map.put(FIELD_POOL, node.getPoolName());
     map.put(FIELD_MEMORY, String.valueOf(node.getMemory()));
     map.put(FIELD_NETWORKS, node.getNetworkAssociations());
     map.put(FIELD_IN_USE, String.valueOf(!node.isVacant()));
     map.put(FIELD_ACTIVE, String.valueOf(node.isActive()));
   }
   return map;
 }