Exemplo n.º 1
0
 public static boolean isSystemVM(VirtualMachine.Type vmtype) {
   if (DomainRouter.equals(vmtype)
       || ConsoleProxy.equals(vmtype)
       || SecondaryStorageVm.equals(vmtype)) {
     return true;
   }
   return false;
 }
  public void doHandle(HttpExchange t) throws Exception {
    String path = t.getRequestURI().getPath();
    int i = path.indexOf("/", 1);
    String cmd = path.substring(i + 1);
    s_logger.info("Get CMD request for " + cmd);
    if (cmd.equals("getstatus")) {
      ConsoleProxyClientStatsCollector statsCollector = ConsoleProxy.getStatsCollector();

      Headers hds = t.getResponseHeaders();
      hds.set("Content-Type", "text/plain");
      t.sendResponseHeaders(200, 0);
      OutputStreamWriter os = new OutputStreamWriter(t.getResponseBody(), "UTF-8");
      statsCollector.getStatsReport(os);
      os.close();
    }
  }