-
Notifications
You must be signed in to change notification settings - Fork 82
gd2 plugin: added a plugin for block volume management #1357
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
} | ||
|
||
// StartBlockHostingVolume starts a gluster volume | ||
func StartBlockHostingVolume(name string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this different from regular Volume start. If not can we reuse the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
return nil, err | ||
} | ||
|
||
vInfo.Metadata["_block-hosting-volume-auto-created"] = "yes" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
||
// Include default Volume Options profile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this new change is lost in Rebase?
return | ||
} | ||
|
||
if containsReservedGroupProfile(req.Options) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this check also lost
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use underscore in json name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be omitempty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you are using BlockVolumeInfo
size
cannot be omitempty for this volume response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont we need username here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain whats the advantage of taking lock here and in below functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to 3
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this to Replicate
@oshankkumar please resolve merge conflicts |
glusterd2.toml.example
Outdated
@@ -3,3 +3,15 @@ peeraddress = ":24008" | |||
clientaddress = ":24007" | |||
#restauth enables/disables REST authentication in glusterd2 | |||
#restauth = true | |||
|
|||
#[gluster-block-hosting-vol-options] | |||
block-hosting-volume-size = 20971520 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a new line
@@ -0,0 +1,187 @@ | |||
package size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be commented?
@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 <[email protected]>
Signed-off-by: Oshank Kumar <[email protected]>
- 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 <[email protected]>
Signed-off-by: Oshank Kumar <[email protected]>
Signed-off-by: Oshank Kumar <[email protected]>
Signed-off-by: Oshank Kumar <[email protected]>
…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 <[email protected]>
56f9240
to
0561c0e
Compare
Refer Design Doc: #1319
Signed-off-by: Oshank Kumar [email protected]