gd2 plugin: added a plugin for block volume management#1357
gd2 plugin: added a plugin for block volume management#1357aravindavk merged 7 commits intogluster:masterfrom
Conversation
|
Can one of the admins verify this patch? |
|
add to whitelist |
161550f to
23f11fe
Compare
|
retest this please |
|
CI failure |
|
retest this please |
| @@ -0,0 +1,166 @@ | |||
| package size | |||
There was a problem hiding this comment.
looks like 'package size' can get into code just like that. It can be used by other services too.
| Hosts: hosts, | ||
| } | ||
|
|
||
| resp, err := g.client.CreateBlockVolume(volInfo.Name, name, req) |
There was a problem hiding this comment.
We need to make sure we have the BlockHostingVolume is up and running. Because, if it is not present, then this will fail for sure. If it is already taken care by the events above, then all good.
There was a problem hiding this comment.
Line 149 is checking that Hosting Volume is in Started State
cc48db2 to
199161b
Compare
|
I don't see |
199161b to
6fb1dac
Compare
I am getting error like this while updating the dependencies using @aravindavk @Madhu-1 can you please suggest how to resolve this |
|
@oshankkumar update |
aravindavk
left a comment
There was a problem hiding this comment.
Did a initial review. Mostly looks good, a few comments. I will test the PR once.
|
|
||
| for _, blockVol := range availableBlockVolumes { | ||
| if blockVol.Name() == name { | ||
| blockVolume = blockVol |
| } | ||
|
|
||
| // StartBlockHostingVolume starts a gluster volume | ||
| func StartBlockHostingVolume(name string) error { |
There was a problem hiding this comment.
Is this different from regular Volume start. If not can we reuse the code
| return nil, err | ||
| } | ||
|
|
||
| vInfo.Metadata["_block-hosting-volume-auto-created"] = "yes" |
There was a problem hiding this comment.
Using _ prefix will make it impossible to manually create block hosting volume and use that for block file creation.(Since Metadata keys starts with _ are restricted for API users). We can skip using prefix or we can expose BlockHosting=Yes/No flag in Volume Edit API
| } | ||
| return http.StatusBadRequest, err | ||
|
|
||
| // Include default Volume Options profile |
There was a problem hiding this comment.
this new change is lost in Rebase?
| return | ||
| } | ||
|
|
||
| if containsReservedGroupProfile(req.Options) { |
Madhu-1
left a comment
There was a problem hiding this comment.
i would like to do one more round of review
plugins/blockvolume/api/types.go
Outdated
| // BlockVolumeInfo represents block volume info | ||
| type BlockVolumeInfo struct { | ||
| // HostingVolume name is optional | ||
| HostingVolume string `json:"hosting_volume"` |
There was a problem hiding this comment.
don't use underscore in json name
There was a problem hiding this comment.
am i missing anything, dont we need to consider size for blockhosting volume.
|
|
||
| // BlockVolumeCreateResp represents resp body for a Block Vol Create req | ||
| type BlockVolumeCreateResp struct { | ||
| *BlockVolumeInfo |
There was a problem hiding this comment.
as you are using BlockVolumeInfo size cannot be omitempty for this volume response
There was a problem hiding this comment.
Since we are getting only list of blockvolume name from gluster-block list command.
So for a blockvolume list response, we are only showing blockvolume name and hosting volume name, so if I remove omitempty then size will be displayed as 0 in response.
There was a problem hiding this comment.
for a BlockVolumeList response size is not a mandatory field
| type BlockVolumeGetResp struct { | ||
| *BlockVolumeInfo | ||
| Hosts []string `json:"hosts"` | ||
| Password string `json:"password,omitempty"` |
There was a problem hiding this comment.
we don't get username details from gluster-block info command
|
|
||
| // RegisterBlockProvider will register a block provider | ||
| func RegisterBlockProvider(name string, f ProviderFunc) { | ||
| providersMutex.Lock() |
There was a problem hiding this comment.
can you explain whats the advantage of taking lock here and in below functions.
There was a problem hiding this comment.
just to make sure providerFactory map is not accessed parallelly by some other goroutine
9b02076 to
cc4c519
Compare
|
As discussed, could you please move the block host volume management to block provider instead of gluster-block, so that the block host volume management code can be reused by all providers? |
cc4c519 to
79e14b6
Compare
moved the common code to a utils package |
|
Block provider details can be handled in URL to support different providers. Create Similarly for other URLS Same ReST handler receives all the requests and host volume management part will remain same. Instead of calling In handler, @oshankkumar @poornimag @Madhu-1 @amarts thoughts? |
|
@aravindavk @Madhu-1 can you folks take a look at the latest version? I believe all comments are being incorporated now? |
yes, all review comments has been addressed. |
|
what more is pending on this ? |
c08a0ee to
bd64a95
Compare
glusterd2.toml.example
Outdated
| #[gluster-block-hosting-vol-options] | ||
| block-hosting-volume-size = 20971520 | ||
| auto-create-block-hosting-volumes = true | ||
| block-hosting-volume-replica-count = 1 |
glusterd2.toml.example
Outdated
| block-hosting-volume-size = 20971520 | ||
| auto-create-block-hosting-volumes = true | ||
| block-hosting-volume-replica-count = 1 | ||
| #block-hosting-volume-type = "Distribute" |
|
@oshankkumar please resolve merge conflicts |
glusterd2.toml.example
Outdated
| #restauth = true | ||
|
|
||
| #[gluster-block-hosting-vol-options] | ||
| block-hosting-volume-size = 20971520 |
There was a problem hiding this comment.
add a comment what is this size in Gib for more readability
glusterd2.toml.example
Outdated
| gluster-block-hostaddr = "192.168.122.16:8081" | ||
| #gluster-block-cacert = "/path/to/ca.crt" | ||
| #gluster-block-user = "username_for_rest_authentication" | ||
| #gluster-block-secret = "secret_for_rest_authentication" No newline at end of file |
| @@ -0,0 +1,187 @@ | |||
| package size | |||
There was a problem hiding this comment.
but glusterd2 doeent make a call to the gluster block cli, even the input request and the response recevied from the block rest server is interger, but am not sure how useful it is? it will be only useful if we use gluster block cli with gd2 directly
|
@oshankkumar regenerate |
| } | ||
| defer clusterLocks.UnLock(context.Background()) | ||
|
|
||
| volInfo, err := volume.GetVolume(hostVolume) |
There was a problem hiding this comment.
can we move this logic to some other function, so this can be reused for checking block hosting volume by other providers?
There was a problem hiding this comment.
moved updating available hosting volume size to a common function,
7b02a7e to
56f9240
Compare
| block-hosting-volume-size = 5368709120 #5GiB | ||
| auto-create-block-hosting-volumes = true | ||
| block-hosting-volume-replica-count = 3 | ||
| #block-hosting-volume-type = "Replicate" |
|
@aravindavk PTAL. |
- added APIs for creation,deleting and listing block volumes. - added pluggable interface for block volume providers. Refer Design Doc: gluster#1319 Signed-off-by: Oshank Kumar <okumar@redhat.com>
Signed-off-by: Oshank Kumar <okumar@redhat.com>
- added block volume provider name in path parameter of url - block provider will not be responsible for managing host volumes. Signed-off-by: Oshank Kumar <okumar@redhat.com>
Signed-off-by: Oshank Kumar <okumar@redhat.com>
Signed-off-by: Oshank Kumar <okumar@redhat.com>
Signed-off-by: Oshank Kumar <okumar@redhat.com>
…volume size - moved hosts parameter from mandatory to optional field in CreateBlockVolume method of BlockProvider interface,since hosts field may not required for other block providers like loopback. - a common function for updating available hosting volume size will prevent from duplicate code Signed-off-by: Oshank Kumar <okumar@redhat.com>
56f9240 to
0561c0e
Compare
Refer Design Doc: #1319
Signed-off-by: Oshank Kumar okumar@redhat.com