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

Allow extending volume size with inUse status #1174

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

Conversation

wisererik
Copy link
Collaborator

@wisererik wisererik commented Jan 16, 2020

What this PR does / why we need it:

This PR will enable the feature of extending volume size with in use status. There is an impact on volume status. Before this PR, the volume status includes:

const (
	VolumeCreating       = "creating"		
	VolumeAvailable      = "available"		
	VolumeInUse          = "inUse"	
	VolumeDeleting       = "deleting"		
	VolumeError          = "error"		
	VolumeErrorDeleting  = "errorDeleting"		
	VolumeErrorExtending = "errorExtending"		
	VolumeExtending      = "extending"		
)

// volume attach status	
const (	
	VolumeAttaching      = "attaching"	
	VolumeAttached       = "attached"	
	VolumeDetached       = "detached"	
	VolumeReserved       = "reserved"	
	VolumeErrorAttaching = "errorAttaching"	
	VolumeErrorDetaching = "errorDetaching"	
)	

Since opensds already has attachment api, the attach status is redundant in volume. Therefore, I plan to remove them. After this PR, the status of volume will only include the following status. It will become more clear for volume.

const (
	VolumeCreating       = "creating"		
	VolumeAvailable      = "available"			
	VolumeDeleting       = "deleting"		
	VolumeError          = "error"		
	VolumeErrorDeleting  = "errorDeleting"		
	VolumeErrorExtending = "errorExtending"		
	VolumeExtending      = "extending"		
)	

Which issue this PR fixes: fixes #1126

Special notes for your reviewer:

Release note:

root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl host list
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
| Id                                   | HostName                  | OsType | AccessMode | IP            | AvailabilityZones |
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
| 5c120d07-a6b3-44fb-99bd-c707c3325fba | root1-HP-EliteBook-840-G2 | linux  | agentless  | 100.70.90.178 | [default]         |
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume create 1 --name test
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| Id               | a8306cf0-52f8-47e0-8068-714f3890c788 |
| CreatedAt        | 2020-01-16T11:48:08                  |
| Name             | test                                 |
| Description      |                                      |
| GroupId          |                                      |
| Size             | 1                                    |
| AvailabilityZone | default                              |
| Status           | creating                             |
| PoolId           |                                      |
| ProfileId        | 904c8080-e0b1-4401-94fd-81c1e174493f |
| Metadata         | null                                 |
|                  |                                      |
| MultiAttach      | false                                |
+------------------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume list
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| Id                                   | Name | Description | Size | AvailabilityZone | Status    | ProfileId                            |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| a8306cf0-52f8-47e0-8068-714f3890c788 | test |             | 1    | default          | available | 904c8080-e0b1-4401-94fd-81c1e174493f |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume attachment create a8306cf0-52f8-47e0-8068-714f3890c788 5c120d07-a6b3-44fb-99bd-c707c3325fba
+----------------+--------------------------------------+
| Property       | Value                                |
+----------------+--------------------------------------+
| Id             | 10e448d4-11bb-442c-ad91-8081901aaa8e |
| CreatedAt      | 2020-01-16T11:48:36                  |
| HostId         | 5c120d07-a6b3-44fb-99bd-c707c3325fba |
| VolumeId       | a8306cf0-52f8-47e0-8068-714f3890c788 |
| Status         | creating                             |
| Mountpoint     |                                      |
| AttachMode     | rw                                   |
| ConnectionInfo | {}                                   |
|                |                                      |
+----------------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume attachment list
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
| Id                                   | HostId                               | VolumeId                             | Status    | AccessProtocol |
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
| 10e448d4-11bb-442c-ad91-8081901aaa8e | 5c120d07-a6b3-44fb-99bd-c707c3325fba | a8306cf0-52f8-47e0-8068-714f3890c788 | available | iscsi  |
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume
attachment   create       delete       extend       group        list         replication  show         snapshot     update
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume extend a8306cf0-52f8-47e0-8068-714f3890c788 3
+------------------+----------------------------------------------------------------------------------------+
| Property         | Value                                                                                  |
+------------------+----------------------------------------------------------------------------------------+
| Id               | a8306cf0-52f8-47e0-8068-714f3890c788                                                   |
| CreatedAt        | 2020-01-16T11:48:08                                                                    |
| UpdatedAt        | 2020-01-16T11:49:16                                                                    |
| Name             | test                                                                                   |
| Description      |                                                                                        |
| GroupId          |                                                                                        |
| Size             | 1                                                                                      |
| AvailabilityZone | default                                                                                |
| Status           | extending                                                                              |
| PoolId           | 34c4869a-5138-5858-aa24-959af003aaa7                                                   |
| ProfileId        | 904c8080-e0b1-4401-94fd-81c1e174493f                                                   |
| Metadata         | {                                                                                      |
|                  |   "lvPath": "/dev/opensds-volumes-default/volume-a8306cf0-52f8-47e0-8068-714f3890c788" |
|                  | }                                                                                      |
|                  |                                                                                        |
| MultiAttach      | false                                                                                  |
+------------------+----------------------------------------------------------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume list
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| Id                                   | Name | Description | Size | AvailabilityZone | Status    | ProfileId                            |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| a8306cf0-52f8-47e0-8068-714f3890c788 | test |             | 3    | default          | available | 904c8080-e0b1-4401-94fd-81c1e174493f |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$

@codecov
Copy link

codecov bot commented Jan 16, 2020

Codecov Report

Merging #1174 into development will decrease coverage by 0.2%.
The diff coverage is 14.28%.

@@               Coverage Diff               @@
##           development    #1174      +/-   ##
===============================================
- Coverage        34.82%   34.61%   -0.21%     
===============================================
  Files               97       97              
  Lines            17622    17656      +34     
===============================================
- Hits              6137     6112      -25     
- Misses           10614    10672      +58     
- Partials           871      872       +1
Impacted Files Coverage Δ
pkg/api/util/db.go 36.99% <0%> (ø) ⬆️
pkg/api/controllers/attachment.go 15.63% <0%> (-0.23%) ⬇️
pkg/db/drivers/etcd/etcd.go 26.85% <33.33%> (+0.01%) ⬆️
pkg/api/controllers/volume.go 24.59% <34.61%> (-0.92%) ⬇️
pkg/controller/controller.go 43.63% <8.82%> (-4.46%) ⬇️

@wisererik wisererik changed the title [WIP]Allow extending volume size with inUse status Allow extending volume size with inUse status Jan 16, 2020
@sushanthakumar
Copy link
Contributor

What this PR does / why we need it:

This PR will enable the feature of extending volume size with in use status. There is an impact on volume status. Before this PR, the volume status includes:

const (
	VolumeCreating       = "creating"		
	VolumeAvailable      = "available"		
	VolumeInUse          = "inUse"	
	VolumeDeleting       = "deleting"		
	VolumeError          = "error"		
	VolumeErrorDeleting  = "errorDeleting"		
	VolumeErrorExtending = "errorExtending"		
	VolumeExtending      = "extending"		
)

// volume attach status	
const (	
	VolumeAttaching      = "attaching"	
	VolumeAttached       = "attached"	
	VolumeDetached       = "detached"	
	VolumeReserved       = "reserved"	
	VolumeErrorAttaching = "errorAttaching"	
	VolumeErrorDetaching = "errorDetaching"	
)	

Since opensds already has attachment api, the attach status is redundant in volume. Therefore, I plan to remove them. After this PR, the status of volume will only include the following status. It will become more clear for volume.

const (
	VolumeCreating       = "creating"		
	VolumeAvailable      = "available"			
	VolumeDeleting       = "deleting"		
	VolumeError          = "error"		
	VolumeErrorDeleting  = "errorDeleting"		
	VolumeErrorExtending = "errorExtending"		
	VolumeExtending      = "extending"		
)	

Which issue this PR fixes: fixes #1126

Special notes for your reviewer:
Any other PR(s) this PR is dependant on: None

Release note:

root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl host list
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
| Id                                   | HostName                  | OsType | AccessMode | IP            | AvailabilityZones |
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
| 5c120d07-a6b3-44fb-99bd-c707c3325fba | root1-HP-EliteBook-840-G2 | linux  | agentless  | 100.70.90.178 | [default]         |
+--------------------------------------+---------------------------+--------+------------+---------------+-------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume create 1 --name test
+------------------+--------------------------------------+
| Property         | Value                                |
+------------------+--------------------------------------+
| Id               | a8306cf0-52f8-47e0-8068-714f3890c788 |
| CreatedAt        | 2020-01-16T11:48:08                  |
| Name             | test                                 |
| Description      |                                      |
| GroupId          |                                      |
| Size             | 1                                    |
| AvailabilityZone | default                              |
| Status           | creating                             |
| PoolId           |                                      |
| ProfileId        | 904c8080-e0b1-4401-94fd-81c1e174493f |
| Metadata         | null                                 |
|                  |                                      |
| MultiAttach      | false                                |
+------------------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume list
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| Id                                   | Name | Description | Size | AvailabilityZone | Status    | ProfileId                            |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| a8306cf0-52f8-47e0-8068-714f3890c788 | test |             | 1    | default          | available | 904c8080-e0b1-4401-94fd-81c1e174493f |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume attachment create a8306cf0-52f8-47e0-8068-714f3890c788 5c120d07-a6b3-44fb-99bd-c707c3325fba
+----------------+--------------------------------------+
| Property       | Value                                |
+----------------+--------------------------------------+
| Id             | 10e448d4-11bb-442c-ad91-8081901aaa8e |
| CreatedAt      | 2020-01-16T11:48:36                  |
| HostId         | 5c120d07-a6b3-44fb-99bd-c707c3325fba |
| VolumeId       | a8306cf0-52f8-47e0-8068-714f3890c788 |
| Status         | creating                             |
| Mountpoint     |                                      |
| AttachMode     | rw                                   |
| ConnectionInfo | {}                                   |
|                |                                      |
+----------------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume attachment list
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
| Id                                   | HostId                               | VolumeId                             | Status    | AccessProtocol |
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
| 10e448d4-11bb-442c-ad91-8081901aaa8e | 5c120d07-a6b3-44fb-99bd-c707c3325fba | a8306cf0-52f8-47e0-8068-714f3890c788 | available | iscsi  |
+--------------------------------------+--------------------------------------+--------------------------------------+-----------+----------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume
attachment   create       delete       extend       group        list         replication  show         snapshot     update
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume extend a8306cf0-52f8-47e0-8068-714f3890c788 3
+------------------+----------------------------------------------------------------------------------------+
| Property         | Value                                                                                  |
+------------------+----------------------------------------------------------------------------------------+
| Id               | a8306cf0-52f8-47e0-8068-714f3890c788                                                   |
| CreatedAt        | 2020-01-16T11:48:08                                                                    |
| UpdatedAt        | 2020-01-16T11:49:16                                                                    |
| Name             | test                                                                                   |
| Description      |                                                                                        |
| GroupId          |                                                                                        |
| Size             | 1                                                                                      |
| AvailabilityZone | default                                                                                |
| Status           | extending                                                                              |
| PoolId           | 34c4869a-5138-5858-aa24-959af003aaa7                                                   |
| ProfileId        | 904c8080-e0b1-4401-94fd-81c1e174493f                                                   |
| Metadata         | {                                                                                      |
|                  |   "lvPath": "/dev/opensds-volumes-default/volume-a8306cf0-52f8-47e0-8068-714f3890c788" |
|                  | }                                                                                      |
|                  |                                                                                        |
| MultiAttach      | false                                                                                  |
+------------------+----------------------------------------------------------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$ osdsctl volume list
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| Id                                   | Name | Description | Size | AvailabilityZone | Status    | ProfileId                            |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
| a8306cf0-52f8-47e0-8068-714f3890c788 | test |             | 3    | default          | available | 904c8080-e0b1-4401-94fd-81c1e174493f |
+--------------------------------------+------+-------------+------+------------------+-----------+--------------------------------------+
root1@root1-HP-EliteBook-840-G2:~/gopath/src/github.com/opensds/opensds$

return
}
if pool.Status != model.PoolAvailable {
errMsg := fmt.Sprintf("pool:%s with status:%s can not support extending volume", pool.Name, pool.Status)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should the message be

Suggested change
errMsg := fmt.Sprintf("pool:%s with status:%s can not support extending volume", pool.Name, pool.Status)
errMsg := fmt.Sprintf("pool:%s has status:%s. Can not extend volume", pool.Name, pool.Status)

if vol.Status != model.VolumeAvailable && vol.Status != model.VolumeInUse {
errMsg := "only the status of volume is available or in-use, the snapshot can be created"
if vol.Status != model.VolumeAvailable {
errMsg := "only the status of volume is available, the snapshot can be created"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is these messages correct?

@kumarashit
Copy link
Collaborator

Fix has two parts, one for extending the size of volume and other to remove the attached/detached state from volume list. For the second part, don't we need the attached/detached state on volume also. Someone can go and check the volume list to see if that volume is attached or detached. Not from host list ofcourse

@wisererik
Copy link
Collaborator Author

Fix has two parts, one for extending the size of volume and other to remove the attached/detached state from volume list. For the second part, don't we need the attached/detached state on volume also. Someone can go and check the volume list to see if that volume is attached or detached. Not from host list ofcourse

volume still has the property named `attached' to display whether the volume is attached or not

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.

3 participants