You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Sammi Chen (Jira)" <ji...@apache.org> on 2020/03/24 08:21:00 UTC

[jira] [Comment Edited] (HDDS-3224) Enforce volume and bucket name rule at create time

    [ https://issues.apache.org/jira/browse/HDDS-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17065418#comment-17065418 ] 

Sammi Chen edited comment on HDDS-3224 at 3/24/20, 8:20 AM:
------------------------------------------------------------

Volume and bucket are created during the OM performance test using Nanda's tool. 

This is piece of code, 

{code:java}
client = new OzoneManagerProtocolClientSideTranslatorPB(
          RPC.getProxy(OzoneManagerProtocolPB.class,
              RPC.getProtocolVersion(OzoneManagerProtocolPB.class),
              OmUtils.getOmAddressForClients(config),
              UserGroupInformation.getCurrentUser(), config,
              NetUtils.getDefaultSocketFactory(config),
              Client.getRpcTimeout(config)),
          "Ozone Manager Perf Test");

void createVolume(String user, String volume) throws IOException {
    try {
      client.createVolume(OmVolumeArgs.newBuilder()
          .setVolume(volume)
          .setAdminName(user)
          .setOwnerName(user)
          .setQuotaInBytes(OzoneConsts.MAX_QUOTA_IN_BYTES)
          .build());
    } catch (OMException ex) {
      if (ex.getResult() != OMException.ResultCodes.VOLUME_ALREADY_EXISTS) {
        throw ex;
      }
    }
  }

  void createBucket(String volume, String bucket) throws IOException {
    try {
      client.createBucket(OmBucketInfo.newBuilder()
          .setVolumeName(volume)
          .setBucketName(bucket)
          .setIsVersionEnabled(false)
          .setStorageType(StorageType.DEFAULT)
          .setAcls(Collections.emptyList())
          .build());
    } catch (OMException ex) {
      if (ex.getResult() != OMException.ResultCodes.BUCKET_ALREADY_EXISTS) {
        throw ex;
      }
    }
  }
{code}



was (Author: sammi):
Volume and bucket are created during the OM performance test using Nanda's tool. 

This is piece of code, 
client = new OzoneManagerProtocolClientSideTranslatorPB(
          RPC.getProxy(OzoneManagerProtocolPB.class,
              RPC.getProtocolVersion(OzoneManagerProtocolPB.class),
              OmUtils.getOmAddressForClients(config),
              UserGroupInformation.getCurrentUser(), config,
              NetUtils.getDefaultSocketFactory(config),
              Client.getRpcTimeout(config)),
          "Ozone Manager Perf Test");

void createVolume(String user, String volume) throws IOException {
    try {
      client.createVolume(OmVolumeArgs.newBuilder()
          .setVolume(volume)
          .setAdminName(user)
          .setOwnerName(user)
          .setQuotaInBytes(OzoneConsts.MAX_QUOTA_IN_BYTES)
          .build());
    } catch (OMException ex) {
      if (ex.getResult() != OMException.ResultCodes.VOLUME_ALREADY_EXISTS) {
        throw ex;
      }
    }
  }

  void createBucket(String volume, String bucket) throws IOException {
    try {
      client.createBucket(OmBucketInfo.newBuilder()
          .setVolumeName(volume)
          .setBucketName(bucket)
          .setIsVersionEnabled(false)
          .setStorageType(StorageType.DEFAULT)
          .setAcls(Collections.emptyList())
          .build());
    } catch (OMException ex) {
      if (ex.getResult() != OMException.ResultCodes.BUCKET_ALREADY_EXISTS) {
        throw ex;
      }
    }
  }

> Enforce volume and bucket name rule at create time
> --------------------------------------------------
>
>                 Key: HDDS-3224
>                 URL: https://issues.apache.org/jira/browse/HDDS-3224
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>            Reporter: Sammi Chen
>            Assignee: Siddharth Wagle
>            Priority: Major
>
> After volume is created through API application, it cannot be listed through CLI. 
> ozone sh volume list -u=admin
> {
>   "metadata" : { },
>   "name" : "instagram",
>   "admin" : "admin",
>   "owner" : "admin",
>   "creationTime" : "2020-03-04T07:18:38.183Z",
>   "acls" : [ ],
>   "quota" : 1152921504606846976
> }
> {
>   "metadata" : { },
>   "name" : "3",
>   "admin" : "admin",
>   "owner" : "admin",
>   "creationTime" : "2020-03-17T07:31:56.987Z",
>   "acls" : [ ],
>   "quota" : 1152921504606846976
> }
> {
>   "metadata" : { },
>   "name" : "333",
>   "admin" : "admin",
>   "owner" : "admin",
>   "creationTime" : "2020-03-17T07:34:18.361Z",
>   "acls" : [ ],
>   "quota" : 1152921504606846976
> }
> ozone sh bucket list 3       
> Bucket or Volume length is illegal, valid length is 3-63 characters
> ozone sh bucket list 333     
> Bucket or Volume name cannot be an IPv4 address or all numeric
> We should enforece this rules at the create time. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org