Ejemplo n.º 1
0
 /**
  * <还原虚拟机>
  *
  * @return
  * @see [类、类#方法、类#成员]
  */
 public String renewVm() {
   long beginRunTime = 0;
   if (logger.isDebugEnabled()) {
     beginRunTime = System.currentTimeMillis();
     logger.debug("enter renewVm method.");
   }
   String result = null;
   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 {
     result = facade.renewVM(vmId, ssid, controlPanelUser, LogOperatorType.CP.getName());
     fillActionResult(true);
     facade.insertOperationLog(
         controlPanelUser, "发送还原虚拟机命令成功", "发送还原虚拟机命令", Constants.RESULT_SUCESS, operateObject);
   } catch (HsCloudException e) {
     facade.insertOperationLog(
         controlPanelUser,
         "发送还原虚拟机命令出现错误:" + e.getMessage(),
         "发送还原虚拟机命令",
         Constants.RESULT_FAILURE,
         operateObject);
     dealThrow(new HsCloudException(Constants.VM_RENEW_ERROR, "renewVm异常", logger, e), "000");
     return null;
   }
   if (logger.isDebugEnabled()) {
     long takeTime = System.currentTimeMillis() - beginRunTime;
     logger.debug("exit renewVm method.takeTime:" + takeTime + "ms");
   }
   return result;
 }