Skip to content

Commit ef6fe4d

Browse files
committed
Fix lint issue in README.md and add more unit tests.
1 parent 6cf6971 commit ef6fe4d

File tree

3 files changed

+291
-6
lines changed

3 files changed

+291
-6
lines changed

plugins/storage/object/cloudian/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Details MAP
7070
```
7171

7272
The following "details" map entries are all required.
73+
7374
- validateSSL : The ADMIN API is internal and may not have a proper SSL Certificate.
7475
- accesskey : Reuse of a shared configuration parameter to pass the Admin Username.
7576
- secretkey : Reuse of a shared configuration parameter to pass the Admin password.
@@ -97,7 +98,7 @@ The following additional resources are also created for each HyperStore User.
9798
| Root Credential Pair | These credentials have full access to the HyperStore User account. They are used to manage the IAM user resources listed below as well as to perform any top level bucket actions such as creating buckets, updating policies, enabling versioning etc. |
9899
| IAM User "CloudStack" | The "CloudStack" IAM user is created with an inline policy as-per below. The IAM user is used by the CloudStack Bucket Browser UI to manage bucket contents.|
99100
| IAM User Policy | This inline IAM user policy grants the "CloudStack" IAM user permission to any S3 action except `s3:createBucket` and `s3:deleteBucket`. This is mostly to ensure that all Buckets remain under CloudStack control as well as to restrict control over IAM actions.|
100-
| IAM User Credential Pair | The "CloudStack" IAM user credentials are also managed by the plugin and are made available to the user under the "Bucket Details" page. They are additionally used by the CloudStack Bucket Browser UI. They are restricted by the aforementioned user policy.
101+
| IAM User Credential Pair | The "CloudStack" IAM user credentials are also managed by the plugin and are made available to the user under the "Bucket Details" page. They are additionally used by the CloudStack Bucket Browser UI. They are restricted by the aforementioned user policy.|
101102

102103
## Bucket Management
103104

@@ -119,6 +120,7 @@ Two "policies" are configurable using the CloudStack interface.
119120

120121
- Private : Objects are only accessible to the bucket owner. This is the equivalent of no bucket policy (and is implemented that way).
121122
- Public : Objects are readable to everyone. Listing of all bucket objects is not granted so the object name must be known in order to access it.
123+
122124
```json
123125
{
124126
"Version": "2012-10-17",

plugins/storage/object/cloudian/src/main/java/org/apache/cloudstack/storage/datastore/driver/CloudianHyperStoreObjectStoreDriverImpl.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ public boolean createUser(long accountId, long storeId) {
164164
String msg = String.format("The User id=%s group id=%s is Disabled. Consult your HyperStore Administrator.", hsUserId, hsGroupId);
165165
logger.error(msg);
166166
throw new CloudRuntimeException(msg);
167+
} else {
168+
// User exists and is active. We know that the group therefore exists but
169+
// we should ensure that it is active or it will lead to unknown access key errors
170+
// which might confuse the administrator. Checking is clearer.
171+
CloudianGroup group = client.listGroup(hsGroupId);
172+
if (group != null && ! group.getActive()) {
173+
String msg = String.format("The group id=%s is Disabled. Consult your HyperStore Administrator.", hsGroupId);
174+
logger.error(msg);
175+
throw new CloudRuntimeException(msg);
176+
}
167177
}
168178

169179
// We either created a new account or found an existing one.
@@ -193,7 +203,7 @@ public boolean createUser(long accountId, long storeId) {
193203
* @return an AccessKey object for newly created IAM credentials or null if existing credentials were ok
194204
* and nothing was created.
195205
*/
196-
private AccessKey createIAMCredentials(long storeId, Map<String, String> details, CloudianCredential credential) {
206+
protected AccessKey createIAMCredentials(long storeId, Map<String, String> details, CloudianCredential credential) {
197207
AmazonIdentityManagement iamClient = getIAMClientByStoreId(storeId, credential);
198208
final String iamUser = CloudianHyperStoreUtil.IAM_USER_USERNAME;
199209

@@ -360,7 +370,7 @@ private void createHSGroup(CloudianClient client, String hsGroupId, Domain domai
360370

361371
// Group exists. Confirm that it is usable.
362372
if (! group.getActive()) {
363-
String msg = String.format("The Group %s is Disabled. Consult your HyperStore Administrator.", hsGroupId);
373+
String msg = String.format("The group %s is Disabled. Consult your HyperStore Administrator.", hsGroupId);
364374
logger.error(msg);
365375
throw new CloudRuntimeException(msg);
366376
}

0 commit comments

Comments
 (0)