Skip to content

Commit 2dd31f3

Browse files
author
Kishan Kavala
committed
CLOUDSTACK-1636: Removed the concept of owner region.
Removed region_id from user/account and domain tables. Removed forwarding of api calls to owner region. Removed api_key and secret_key from region table. Included related DB upgrade changes.
1 parent c9082c9 commit 2dd31f3

31 files changed

Lines changed: 104 additions & 557 deletions

api/src/com/cloud/domain/Domain.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,4 @@ enum State {
6262

6363
public String getUuid();
6464

65-
int getRegionId();
6665
}

api/src/com/cloud/user/Account.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,5 @@ public enum State {
6363

6464
public Long getDefaultZoneId();
6565

66-
public int getRegionId();
67-
6866
public String getUuid();
6967
}

api/src/com/cloud/user/AccountService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public interface AccountService {
6262
* @return the user if created successfully, null otherwise
6363
*/
6464
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
65-
Map<String, String> details);
65+
Map<String, String> details, String accountUUID, String userUUID);
6666

6767
/**
6868
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@@ -77,7 +77,7 @@ UserAccount createUserAccount(String userName, String password, String firstName
7777

7878
User getSystemUser();
7979

80-
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
80+
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
8181

8282
boolean isAdmin(short accountType);
8383

api/src/com/cloud/user/DomainService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public interface DomainService {
2929

30-
Domain createDomain(String name, Long parentId, String networkDomain);
30+
Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID);
3131

3232
Domain getDomain(long id);
3333

api/src/com/cloud/user/User.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,4 @@ public interface User extends OwnedBy, InternalIdentity {
7373

7474
boolean isRegistered();
7575

76-
public int getRegionId();
7776
}

api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ public class CreateAccountCmd extends BaseCmd {
7878
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
7979
private Map<String, String> details;
8080

81+
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from external provisioning system")
82+
private String accountUUID;
83+
84+
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
85+
private String userUUID;
8186

8287
/////////////////////////////////////////////////////
8388
/////////////////// Accessors ///////////////////////
@@ -133,6 +138,14 @@ public Map<String, String> getDetails() {
133138
return params;
134139
}
135140

141+
public String getAccountUUID() {
142+
return accountUUID;
143+
}
144+
145+
public String getUserUUID() {
146+
return userUUID;
147+
}
148+
136149
/////////////////////////////////////////////////////
137150
/////////////// API Implementation///////////////////
138151
/////////////////////////////////////////////////////
@@ -151,7 +164,7 @@ public long getEntityOwnerId() {
151164
public void execute(){
152165
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
153166
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
154-
getDomainId(), getNetworkDomain(), getDetails());
167+
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
155168
if (userAccount != null) {
156169
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
157170
response.setResponseName(getCommandName());

api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ public class CreateDomainCmd extends BaseCmd {
4949
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain")
5050
private String networkDomain;
5151

52+
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region")
53+
private String domainUUID;
54+
5255
/////////////////////////////////////////////////////
5356
/////////////////// Accessors ///////////////////////
5457
/////////////////////////////////////////////////////
@@ -65,6 +68,10 @@ public String getNetworkDomain() {
6568
return networkDomain;
6669
}
6770

71+
public String getDomainUUID() {
72+
return domainUUID;
73+
}
74+
6875
/////////////////////////////////////////////////////
6976
/////////////// API Implementation///////////////////
7077
/////////////////////////////////////////////////////
@@ -82,7 +89,7 @@ public long getEntityOwnerId() {
8289
@Override
8390
public void execute(){
8491
UserContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():""));
85-
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain());
92+
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID());
8693
if (domain != null) {
8794
DomainResponse response = _responseGenerator.createDomainResponse(domain);
8895
response.setResponseName(getCommandName());

api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ public class AddRegionCmd extends BaseCmd {
4949
@Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="Region service endpoint")
5050
private String endPoint;
5151

52-
@Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key of Admin user")
53-
private String apiKey;
54-
55-
@Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user")
56-
private String secretKey;
57-
5852
@Inject public RegionService _regionService;
5953

6054
/////////////////////////////////////////////////////
@@ -73,14 +67,6 @@ public String getEndPoint() {
7367
return endPoint;
7468
}
7569

76-
public String getApiKey() {
77-
return apiKey;
78-
}
79-
80-
public String getSecretKey() {
81-
return secretKey;
82-
}
83-
8470
/////////////////////////////////////////////////////
8571
/////////////// API Implementation///////////////////
8672
/////////////////////////////////////////////////////
@@ -97,7 +83,7 @@ public long getEntityOwnerId() {
9783

9884
@Override
9985
public void execute(){
100-
Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
86+
Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint());
10187
if (region != null) {
10288
RegionResponse response = _responseGenerator.createRegionResponse(region);
10389
response.setResponseName(getCommandName());

api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ public class UpdateRegionCmd extends BaseCmd {
4949
@Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
5050
private String endPoint;
5151

52-
@Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="new API key for the Region")
53-
private String apiKey;
54-
55-
@Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region")
56-
private String secretKey;
57-
5852
@Inject RegionService _regionService;
5953

6054
/////////////////////////////////////////////////////
@@ -73,13 +67,6 @@ public String getEndPoint() {
7367
return endPoint;
7468
}
7569

76-
public String getApiKey() {
77-
return apiKey;
78-
}
79-
80-
public String getSecretKey() {
81-
return secretKey;
82-
}
8370
/////////////////////////////////////////////////////
8471
/////////////// API Implementation///////////////////
8572
/////////////////////////////////////////////////////
@@ -96,7 +83,7 @@ public long getEntityOwnerId() {
9683

9784
@Override
9885
public void execute(){
99-
Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
86+
Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint());
10087
if (region != null) {
10188
RegionResponse response = _responseGenerator.createRegionResponse(region);
10289
response.setResponseName(getCommandName());

api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ public class CreateUserCmd extends BaseCmd {
6565
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.")
6666
private String username;
6767

68+
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from external provisioning system")
69+
private String userUUID;
70+
6871
/////////////////////////////////////////////////////
6972
/////////////////// Accessors ///////////////////////
7073
/////////////////////////////////////////////////////
@@ -101,6 +104,10 @@ public String getUserName() {
101104
return username;
102105
}
103106

107+
public String getUserUUID() {
108+
return userUUID;
109+
}
110+
104111
/////////////////////////////////////////////////////
105112
/////////////// API Implementation///////////////////
106113
/////////////////////////////////////////////////////
@@ -132,7 +139,7 @@ public long getEntityOwnerId() {
132139
@Override
133140
public void execute(){
134141
UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName());
135-
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId());
142+
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID());
136143
if (user != null) {
137144
UserResponse response = _responseGenerator.createUserResponse(user);
138145
response.setResponseName(getCommandName());

0 commit comments

Comments
 (0)