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

Hanisha Koneru edited comment on HDDS-766 at 11/2/18 6:40 PM:
--------------------------------------------------------------

Thanks for working on this [~candychencan].

The code below would add a leading slash to the path variable only if the path 
does not have any "/" in it. This solves the {{volume create}} issue. But we 
might get the same issue with bucket and key creations also. 
{code:java}
// add leading slash to the path, if it does not exist
int firstSlash = path.indexOf('/');
if(firstSlash == -1) {
  path = "/" + path;
}{code}
The first slash in the path should be at index 0 and if not, we should add it. 
That would fix this issue for all - volume, bucket and key creations.

Can you also add a parameterized test to {{TestOzoneAddress}}. In the static 
#data() fucntion, we can add \{""} to the list of parameters to load into 
"prefix". This would test the case we are dealing with here. 
We would probably not require the test in TestOzoneShell after this.


was (Author: hanishakoneru):
Thanks for working on this [~candychencan].

The code below would add a leading slash to the path variable only if the path 
does not have any "/" in it. This solves the {{volume create}} issue. But we 
might get the same issue with bucket and key creations also. 
{code:java}
// add leading slash to the path, if it does not exist
int firstSlash = path.indexOf('/');
if(firstSlash == -1) {
  path = "/" + path;
}{code}

> Ozone shell create volume fails if volume name does not have a leading slash
> ----------------------------------------------------------------------------
>
>                 Key: HDDS-766
>                 URL: https://issues.apache.org/jira/browse/HDDS-766
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>            Reporter: Hanisha Koneru
>            Assignee: chencan
>            Priority: Major
>              Labels: newbie
>         Attachments: HDDS-766.001.patch, HDDS-766.003.patch
>
>
> After HDDS-682, volume creation through shell fails if the volume name does 
> not have leading slash.
> {code:java}
> $ ./ozone sh volume create volume1
> Volume name is required
> $ ./ozone sh volume create /volume1
> 2018-10-30 14:07:58,078 INFO rpc.RpcClient: Creating Volume: volume1, with 
> hdds as owner and quota set to 1152921504606846976 bytes.{code}
> In {{OzoneAddress#stringToUri}}, when creating a new URI, the path parameter 
> is expected to have a leading slash. Otherwise, the path gets mixed with the 
> authority.
> To fix this, we should add a leading slash to the path variable, if it does 
> not exist, before constructing the URI object.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to