public String getPassword() { if (Strings.isNullOrEmpty(password)) { password = _mgr.generateRandomPassword(); } return password; }
@DB protected void updateSystemvmPassword() { String userid = System.getProperty("user.name"); if (!userid.startsWith("cloud")) { return; } if (!Boolean.valueOf(_configDao.getValue("system.vm.random.password"))) { return; } String already = _configDao.getValue("system.vm.password"); if (already == null) { TransactionLegacy txn = TransactionLegacy.currentTxn(); try { String rpassword = _mgrService.generateRandomPassword(); String wSql = "INSERT INTO `cloud`.`configuration` (category, instance, component, name, value, description) " + "VALUES ('Secure','DEFAULT', 'management-server','system.vm.password', ?,'randmon password generated each management server starts for system vm')"; PreparedStatement stmt = txn.prepareAutoCloseStatement(wSql); stmt.setString(1, DBEncryptionUtil.encrypt(rpassword)); stmt.executeUpdate(); s_logger.info("Updated systemvm password in database"); } catch (SQLException e) { s_logger.error("Cannot retrieve systemvm password", e); } } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException{ password = _mgr.generateRandomPassword(); CallContext.current().setEventDetails("Vm Id: "+getId()); UserVm result = _userVmService.resetVMPassword(this, password); if (result != null){ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); } } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { password = _mgr.generateRandomPassword(); CallContext.current().setEventDetails("Vm Id: " + getId()); UserVm result = _userVmService.resetVMPassword(this, password); if (result != null){ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); } } }
password = DBEncryptionUtil.decrypt(vm.getDetail("password")); } else { password = _mgr.generateRandomPassword(); vm.setPassword(password);
String sshPublicKey = s.getPublicKey(); if (template != null && template.isEnablePassword()) { password = _mgr.generateRandomPassword();
password = _mgr.generateRandomPassword(); boolean result = resetVMPasswordInternal(vmId, password); if (!result) {
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { password = _mgr.generateRandomPassword(); CallContext.current().setEventDetails("Vm Id: " + getId()); final UserVm result = _userVmService.resetVMPassword(this, password); if (result != null) { final UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); } }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException { password = _mgr.generateRandomPassword(); CallContext.current().setEventDetails("Vm Id: " + getId()); final UserVm result = _userVmService.resetVMPassword(this, password); if (result != null) { final UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Full, "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); } } }