Ejemplo n.º 1
0
 /**
  * <重置虚拟机操作系统> <功能详细描述>
  *
  * @return
  * @see [类、类#方法、类#成员]
  */
 public String resetVmOS() {
   long beginRunTime = 0;
   if (logger.isDebugEnabled()) {
     beginRunTime = System.currentTimeMillis();
     logger.debug("enter resetVmOS method.");
   }
   ControlPanelUser controlPanelUser =
       (ControlPanelUser) super.getSession().getAttribute(Constants.LOGIN_CURRENTUSER);
   if (controlPanelUser == null) {
     super.fillActionResult(Constants.OPTIONS_TIMEOUT);
     return null;
   }
   String vmId = controlPanelUser.getVmId();
   String operateObject = "VM[vmId:" + vmId + "]";
   try {
     facade.resetVMOS(vmId, osId, name, password, controlPanelUser, LogOperatorType.CP.getName());
     facade.insertOperationLog(
         controlPanelUser, "发送重置操作系统命令成功", "发送重置操作系统命令", Constants.RESULT_SUCESS, operateObject);
   } catch (Exception e) {
     facade.insertOperationLog(
         controlPanelUser,
         "发送重置操作系统命令出现错误:" + e.getMessage(),
         "发送重置操作系统命令",
         Constants.RESULT_FAILURE,
         operateObject);
     dealThrow(new HsCloudException(Constants.VM_RESETOS_ERROR, "resetVmOS异常", logger, e), "000");
     return null;
   }
   super.fillActionResult(Constants.OPTIONS_SUCCESS);
   if (logger.isDebugEnabled()) {
     long takeTime = System.currentTimeMillis() - beginRunTime;
     logger.debug("exit resetVmOS method.takeTime:" + takeTime + "ms");
   }
   return null;
 }