volume upload: persisting the PSK only when its not present

This commit is contained in:
Rajani Karuturi 2015-01-13 11:37:22 +05:30
parent 631e6e0088
commit c2cf2503c1
1 changed files with 6 additions and 1 deletions

View File

@ -976,7 +976,12 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
*/
private void updateSecondaryStorageVMSharedKey() {
try {
_configDao.update(Config.SSVMPSK.key(), Config.SSVMPSK.getCategory(), getPrivateKey());
String key = _configDao.getValue(Config.SSVMPSK.key());
if(key == null) {
ConfigurationVO configVO = new ConfigurationVO(Config.SSVMPSK.getCategory(), "DEFAULT", Config.SSVMPSK.getComponent(), Config.SSVMPSK.key(), getPrivateKey(),
Config.SSVMPSK.getDescription());
_configDao.persist(configVO);
}
} catch (NoSuchAlgorithmException ex) {
s_logger.error("error generating ssvm psk", ex);
}