Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File share name fixes #1084

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

Shruthi-1MN
Copy link
Contributor

@Shruthi-1MN Shruthi-1MN commented Nov 22, 2019

What this PR does / why we need it:
This PR has following fixes #1002, #1003 , #1010, #1057, #1061, #1062, #1063, #1064

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

Special notes for your reviewer:
Test Report for issues is as follows:
#1002 Non utf-8 characters file name is creating db entry

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare create -n "İnanç Esasları" 1
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: Request body has an error: doesn't match the schema: Error at "/name":JSON string doesn't match the regular expression '^[\w\- ]+$'

#1003 Special characters in file share name is not supported by backend

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare create -n "testfile&share*" 1
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: Request body has an error: doesn't match the schema: Error at "/name":JSON string doesn't match the regular expression '^[\w\- ]+$'

#1010 Updating the fileshare description and name when file share status is error

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare list
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+--------------------------------------+------+-----------+-------------+------+--------+--------------------------------------+-----------------+
| Id                                   | Name | Protocols | Description | Size | Status | ProfileId                            | ExportLocations |
+--------------------------------------+------+-----------+-------------+------+--------+--------------------------------------+-----------------+
| 3a8073b3-95f5-4f29-adaa-acb5b4712d67 | lp4  | []        |             | 21   | error  | 71eae845-bd3b-4636-aaa1-72be67c99f52 | []              |
+--------------------------------------+------+-----------+-------------+------+--------+--------------------------------------+-----------------+
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare update 3a8073b3-95f5-4f29-adaa-acb5b4712d67 -n "testshare" 
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: can't update file share 3a8073b3-95f5-4f29-adaa-acb5b4712d67 because it's status is error

#1057 Duplicate file share name causing the existing share status as error

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare list 
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| Id                                   | Name        | Protocols | Description | Size | Status    | ProfileId                            | ExportLocations              |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| 9ffdd018-9a91-45c5-b42b-285dc7848689 | ko          | [nfs]     |             | 1    | available | 71eae845-bd3b-4636-aaa1-72be67c99f52 | [10.0.2.15:/mnt/op2]         |
| 9a7b4884-d80f-4698-a3d9-f8943be89bb7 | sampleshare | [nfs]     |             | 1    | available | 71eae845-bd3b-4636-aaa1-72be67c99f52 | [10.0.2.15:/mnt/sampleshare] |
| 3a8073b3-95f5-4f29-adaa-acb5b4712d67 | lp4         | []        |             | 21   | error     | 71eae845-bd3b-4636-aaa1-72be67c99f52 | []                           |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare create -n "sampleshare" 1
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: create fileshare failed: file share name already exists

#1061 Updating file share name with empty string should not be allowed
It takes the request but doesn't update, swagger validation is not throwing for minimum name length of fileshare but actual validation is blocking to create empty name string file share

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare update 9a7b4884-d80f-4698-a3d9-f8943be89bb7 -n ""
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+------------------+-------------------------------------------------------------+
| Property         | Value                                                       |
+------------------+-------------------------------------------------------------+
| Id               | 9a7b4884-d80f-4698-a3d9-f8943be89bb7                        |
| UpdatedAt        | 2020-01-03T12:37:05                                         |
| TenantId         | e93b4c0934da416eb9c8d120c5d04d96                            |
| UserId           |                                                             |
| Name             | sampleshare                                                 |
| Protocols        | [nfs]                                                       |
| Description      |                                                             |
| Size             | 1                                                           |
| AvailabilityZone | default                                                     |
| Status           | available                                                   |
| PoolId           | 2b097560-b050-5017-88df-4d74a7c27e37                        |
| ProfileId        | 71eae845-bd3b-4636-aaa1-72be67c99f52                        |
| SnapshotId       |                                                             |
| ExportLocations  | [10.0.2.15:/mnt/sampleshare]                                |
| Metadata         | {                                                           |
|                  |   "lvPath": "/dev/opensds-files-default/sampleshare",       |
|                  |   "nfsFileshareID": "9a7b4884-d80f-4698-a3d9-f8943be89bb7", |
|                  |   "nfsFileshareName": "sampleshare",                        |
|                  |   "snapshotName": ""                                        |
|                  | }                                                           |
|                  |                                                             |
+------------------+-------------------------------------------------------------+
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare list 
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| Id                                   | Name        | Protocols | Description | Size | Status    | ProfileId                            | ExportLocations              |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| 9a7b4884-d80f-4698-a3d9-f8943be89bb7 | sampleshare | [nfs]     |             | 1    | available | 71eae845-bd3b-4636-aaa1-72be67c99f52 | [10.0.2.15:/mnt/sampleshare] |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+

#1062 Updating file share name with special characters

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare list 
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| Id                                   | Name        | Protocols | Description | Size | Status    | ProfileId                            | ExportLocations              |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
| 9ffdd018-9a91-45c5-b42b-285dc7848689 | ko          | [nfs]     |             | 1    | available | 71eae845-bd3b-4636-aaa1-72be67c99f52 | [10.0.2.15:/mnt/op2]         |
| 9a7b4884-d80f-4698-a3d9-f8943be89bb7 | sampleshare | [nfs]     |             | 1    | available | 71eae845-bd3b-4636-aaa1-72be67c99f52 | [10.0.2.15:/mnt/sampleshare] |
| 3a8073b3-95f5-4f29-adaa-acb5b4712d67 | lp4         | []        |             | 21   | error     | 71eae845-bd3b-4636-aaa1-72be67c99f52 | []                           |
+--------------------------------------+-------------+-----------+-------------+------+-----------+--------------------------------------+------------------------------+
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# 
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# 
root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare update 9ffdd018-9a91-45c5-b42b-285dc7848689 -n "test%share"
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: Request body has an error: doesn't match the schema: Error at "/name":JSON string doesn't match the regular expression '^[\w\- ]+$'

#1063 Updating file share name length should be grater than 102 characters

root@shruthi-VirtualBox:~/go/src/github.com/opensds/opensds# osdsctl fileshare list 
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
+--------------------------------------+------+-----------+-------------+------+-----------+--------------------------------------+---------------------+
| Id                                   | Name | Protocols | Description | Size | Status    | ProfileId                            | ExportLocations     |
+--------------------------------------+------+-----------+-------------+------+-----------+--------------------------------------+---------------------+
| ec41ba0f-f6f2-4a82-871f-b4ca09c597b4 | io   | [nfs]     |             | 1    | available | 79d5051c-91a9-4eb1-b41b-84177753dab6 | [10.0.2.15:/mnt/io] |
+--------------------------------------+------+-----------+-------------+------+-----------+--------------------------------------+---------------------+
root@shruthi-VirtualBox:~/go/src/github.com/opensds/opensds# osdsctl fileshare update -n "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkabcdefghijklmnj" ec41ba0f-f6f2-4a82-871f-b4ca09c597b4
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: Request body has an error: doesn't match the schema: Error at "/name":Maximum string length is 102

#1064 Updating file share description with non utf-8 code characters

root@shruthi-VirtualBox:~/go/github.com/opensds/opensds# osdsctl fileshare update 9ffdd018-9a91-45c5-b42b-285dc7848689 -n "İnanç Esasları"
WARNING: OPENSDS_ENDPOINT is not specified, use default(http://localhost:50040)
WARNING: Not found Env OPENSDS_AUTH_STRATEGY, use default(noauth)
ERROR: Request body has an error: doesn't match the schema: Error at "/name":JSON string doesn't match the regular expression '^[\w\- ]+$'

Release note:

@Shruthi-1MN Shruthi-1MN force-pushed the fileshare_name_fixes branch 3 times, most recently from c4e14c9 to 14144ee Compare November 22, 2019 10:55
@codecov
Copy link

codecov bot commented Nov 22, 2019

Codecov Report

Merging #1084 into development will decrease coverage by 0.09%.
The diff coverage is 52.38%.

@@              Coverage Diff               @@
##           development    #1084     +/-   ##
==============================================
- Coverage        34.92%   34.82%   -0.1%     
==============================================
  Files               97       97             
  Lines            17563    17627     +64     
==============================================
+ Hits              6133     6139      +6     
- Misses           10561    10615     +54     
- Partials           869      873      +4
Impacted Files Coverage Δ
pkg/api/controllers/fileshare.go 13.84% <11.11%> (-0.06%) ⬇️
pkg/api/util/db.go 37.43% <83.33%> (+0.55%) ⬆️
contrib/drivers/utils/utils.go 45.45% <0%> (-54.55%) ⬇️
contrib/drivers/drivers.go 25% <0%> (-3.38%) ⬇️
pkg/dock/discovery/discovery.go 33.51% <0%> (-0.57%) ⬇️
pkg/controller/dr/drcontroller.go 64.77% <0%> (-0.49%) ⬇️
pkg/db/drivers/etcd/etcd.go 26.84% <0%> (-0.32%) ⬇️
pkg/api/controllers/volume.go 25.5% <0%> (-0.3%) ⬇️
contrib/drivers/huawei/oceanstor/client.go 0% <0%> (ø) ⬆️
contrib/drivers/huawei/oceanstor/oceanstor.go 0% <0%> (ø) ⬆️
... and 4 more

@Shruthi-1MN Shruthi-1MN force-pushed the fileshare_name_fixes branch 4 times, most recently from 0393f81 to c5a3c2a Compare November 25, 2019 06:27
Copy link
Collaborator

@wisererik wisererik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's better add constraint into swagger api. The api filter will help you do the validation.

@Shruthi-1MN Shruthi-1MN added this to To do in Experience and QA Dec 10, 2019
@Shruthi-1MN Shruthi-1MN moved this from To do to In progress in Experience and QA Dec 10, 2019
@Shruthi-1MN Shruthi-1MN added this to In progress in Hotpot API Dec 10, 2019
@Shruthi-1MN Shruthi-1MN removed this from In progress in Experience and QA Dec 10, 2019
@Shruthi-1MN Shruthi-1MN force-pushed the fileshare_name_fixes branch 4 times, most recently from 1e90bd1 to d24a534 Compare December 11, 2019 09:46
@Shruthi-1MN Shruthi-1MN force-pushed the fileshare_name_fixes branch 7 times, most recently from 9585c88 to d5091b2 Compare January 3, 2020 11:06
@skdwriting skdwriting removed this from In progress in Hotpot API Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants