/** * <关闭虚拟机> * * @return * @see [类、类#方法、类#成员] */ public String closeVM() { long beginRunTime = 0; if (logger.isDebugEnabled()) { beginRunTime = System.currentTimeMillis(); logger.debug("enter closeVM method."); } boolean bl; 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 { bl = facade.closeVmByVmId(vmId, controlPanelUser, LogOperatorType.CP.getName()); facade.insertOperationLog( controlPanelUser, "发送关闭虚拟机命令成功", "发送关闭虚拟机命令", Constants.RESULT_SUCESS, operateObject); } catch (HsCloudException e) { facade.insertOperationLog( controlPanelUser, "发送关闭虚拟机命令出现错误:" + e.getMessage(), "发送关闭虚拟机命令", Constants.RESULT_FAILURE, operateObject); dealThrow(new HsCloudException(Constants.VM_CLOSE_ERROR, "suspendVM异常", logger, e), "000"); return null; } if (bl) { super.fillActionResult(Constants.OPTIONS_SUCCESS); } else { super.fillActionResult(Constants.VM_CLOSE_ERROR); } if (logger.isDebugEnabled()) { long takeTime = System.currentTimeMillis() - beginRunTime; logger.debug("exit closeVM method.takeTime:" + takeTime + "ms"); } return null; }