CLOUDSTACK-1216: insert UUID when we create "admin" user in DB.

This commit is contained in:
Min Chen 2013-02-08 14:15:15 -08:00
parent a92968cbd3
commit 1cf85aa87a

View File

@ -123,7 +123,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
@Inject private NetworkOfferingDao _networkOfferingDao; @Inject private NetworkOfferingDao _networkOfferingDao;
@Inject private DataCenterDao _dataCenterDao; @Inject private DataCenterDao _dataCenterDao;
@Inject private NetworkDao _networkDao; @Inject private NetworkDao _networkDao;
@Inject private VlanDao _vlanDao; @Inject private VlanDao _vlanDao;
private String _domainSuffix; private String _domainSuffix;
@Inject private DomainDao _domainDao; @Inject private DomainDao _domainDao;
@Inject private AccountDao _accountDao; @Inject private AccountDao _accountDao;
@ -135,11 +135,11 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
public ConfigurationServerImpl() { public ConfigurationServerImpl() {
setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK_BOOTSTRAP); setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK_BOOTSTRAP);
} }
@Override @Override
public boolean configure(String name, Map<String, Object> params) public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException { throws ConfigurationException {
try { try {
persistDefaultValues(); persistDefaultValues();
} catch (InternalErrorException e) { } catch (InternalErrorException e) {
@ -235,7 +235,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
createDefaultNetworks(); createDefaultNetworks();
createDefaultRegion(); createDefaultRegion();
// Create userIpAddress ranges // Create userIpAddress ranges
// Update existing vlans with networkId // Update existing vlans with networkId
@ -374,8 +374,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
} }
// now insert the user // now insert the user
insertSql = "INSERT INTO `cloud`.`user` (id, username, password, account_id, firstname, lastname, created, state, region_id) " + insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state, region_id) " +
"VALUES (" + id + ",'" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', '1')"; "VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', '1')";
txn = Transaction.currentTxn(); txn = Transaction.currentTxn();
try { try {
@ -1271,9 +1271,9 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
return svcProviders; return svcProviders;
} }
private void createDefaultRegion(){ private void createDefaultRegion(){
//Get Region name and URL from db.properties //Get Region name and URL from db.properties
_regionDao.persist(new RegionVO(_regionDao.getRegionId(), "Local", "http://localhost:8080/client/api", "", "")); _regionDao.persist(new RegionVO(_regionDao.getRegionId(), "Local", "http://localhost:8080/client/api", "", ""));
} }