Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hadoop-ozone/dist/src/main/smoketest/createmrenv.robot
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Create volume
${result} = Execute ozone sh volume create /${volume} --user hadoop --space-quota 100TB --namespace-quota 100
Should not contain ${result} Failed
Create bucket
Execute ozone sh bucket create /${volume}/${bucket} --space-quota 1TB --layout FILE_SYSTEM_OPTIMIZED
Execute ozone sh bucket create /${volume}/${bucket} --space-quota 1TB --layout fso

*** Test Cases ***
Create test volume, bucket and key
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ${TESTFILE} testfile
Write keys
Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab
Execute ozone sh volume create ${VOLUME}
Execute ozone sh bucket create ${VOLUME}/${BUCKET} -l OBJECT_STORE
Execute ozone sh bucket create ${VOLUME}/${BUCKET} -l obs
Execute dd if=/dev/urandom of=${TEMP_DIR}/${TESTFILE}1 bs=100 count=10
Execute ozone sh key put ${VOLUME}/${BUCKET}/${TESTFILE}1 ${TEMP_DIR}/${TESTFILE}1
Execute dd if=/dev/urandom of=${TEMP_DIR}/${TESTFILE}2 bs=100 count=15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,32 @@ public class CreateBucketHandler extends BucketHandler {
" user if not specified")
private String ownerName;

enum AllowedBucketLayouts { FILE_SYSTEM_OPTIMIZED, OBJECT_STORE, LEGACY }
private static class LayoutConverter implements CommandLine.ITypeConverter<BucketLayout> {
@Override
public BucketLayout convert(String value) {
if (value == null) {
return null;
}
switch (value) {
case "fso":
return BucketLayout.FILE_SYSTEM_OPTIMIZED;
case "obs":
return BucketLayout.OBJECT_STORE;
default:
for (BucketLayout candidate : BucketLayout.values()) {
if (candidate.name().equalsIgnoreCase(value)) {
return candidate;
}
}
throw new IllegalArgumentException("Unknown bucket layout: " + value);
}
}
}

@Option(names = { "--layout", "-l" },
description = "Allowed Bucket Layouts: ${COMPLETION-CANDIDATES}")
private AllowedBucketLayouts allowedBucketLayout;
@Option(names = { "--layout", "-l" }, converter = LayoutConverter.class,
description = "Allowed Bucket Layouts: fso (for file system optimized buckets FILE_SYSTEM_OPTIMIZED), " +
"obs (for object store optimized OBJECT_STORE) and legacy (LEGACY is Deprecated)")
private BucketLayout allowedBucketLayout;

@CommandLine.Mixin
private ShellReplicationOptions replication;
Expand All @@ -86,9 +107,7 @@ public void execute(OzoneClient client, OzoneAddress address)
new BucketArgs.Builder().setStorageType(StorageType.DEFAULT)
.setVersioning(false).setOwner(ownerName);
if (allowedBucketLayout != null) {
BucketLayout bucketLayout =
BucketLayout.fromString(allowedBucketLayout.toString());
bb.setBucketLayout(bucketLayout);
bb.setBucketLayout(allowedBucketLayout);
}
// TODO: New Client talking to old server, will it create a LEGACY bucket?

Expand Down