|
504 | 504 | import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator; |
505 | 505 | import org.apache.cloudstack.framework.config.ConfigDepot; |
506 | 506 | import org.apache.cloudstack.framework.config.ConfigKey; |
| 507 | +import org.apache.cloudstack.framework.config.Configurable; |
507 | 508 | import org.apache.cloudstack.framework.config.dao.ConfigurationDao; |
508 | 509 | import org.apache.cloudstack.framework.config.impl.ConfigurationVO; |
509 | 510 | import org.apache.cloudstack.framework.security.keystore.KeystoreManager; |
|
671 | 672 | import com.cloud.vm.dao.UserVmDao; |
672 | 673 | import com.cloud.vm.dao.VMInstanceDao; |
673 | 674 |
|
674 | | -public class ManagementServerImpl extends ManagerBase implements ManagementServer { |
| 675 | +public class ManagementServerImpl extends ManagerBase implements ManagementServer, Configurable { |
675 | 676 | public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName()); |
676 | 677 |
|
| 678 | + static final ConfigKey<Integer> vmPasswordLength = new ConfigKey<Integer>("Advanced", Integer.class, "vm.password.length", "10", |
| 679 | + "Specifies the length of a randomly generated password", false); |
677 | 680 | @Inject |
678 | 681 | public AccountManager _accountMgr; |
679 | 682 | @Inject |
@@ -905,7 +908,7 @@ protected Map<String, String> getConfigs() { |
905 | 908 |
|
906 | 909 | @Override |
907 | 910 | public String generateRandomPassword() { |
908 | | - final Integer passwordLength = Integer.parseInt(_configDao.getValue("vm.password.length")); |
| 911 | + final Integer passwordLength = vmPasswordLength.value(); |
909 | 912 | return PasswordGenerator.generateRandomPassword(passwordLength); |
910 | 913 | } |
911 | 914 |
|
@@ -3021,6 +3024,16 @@ public List<Class<?>> getCommands() { |
3021 | 3024 | return cmdList; |
3022 | 3025 | } |
3023 | 3026 |
|
| 3027 | + @Override |
| 3028 | + public String getConfigComponentName() { |
| 3029 | + return ManagementServer.class.getSimpleName(); |
| 3030 | + } |
| 3031 | + |
| 3032 | + @Override |
| 3033 | + public ConfigKey<?>[] getConfigKeys() { |
| 3034 | + return new ConfigKey<?>[] {vmPasswordLength}; |
| 3035 | + } |
| 3036 | + |
3024 | 3037 | protected class EventPurgeTask extends ManagedContextRunnable { |
3025 | 3038 | @Override |
3026 | 3039 | protected void runInContext() { |
|
0 commit comments