Add loopback block provider#1439
Conversation
|
Can one of the admins verify this patch? |
|
This patch is dependent on pr: #1357 This pr can be merged only after merging the original PR |
| } | ||
|
|
||
| // GlusterBlock implements block Provider interface. It represents a gluster-block | ||
| type GlusterBlock struct { |
There was a problem hiding this comment.
can we have a different name for loop back provider
| mounts map[string]string | ||
| } | ||
|
|
||
| func newGlusterBlock() (blockprovider.Provider, error) { |
| } | ||
|
|
||
| blockFileName := hostDir + "/" + name | ||
| cmd := exec.Command("truncate", fmt.Sprintf("-s %d", size), blockFileName) //nolint: gosec |
There was a problem hiding this comment.
check if we need to add some % (or a fixed value) to this size, so we give space for mkfs.xfs ?
There was a problem hiding this comment.
Use utils.ExecuteCommandRun for including stderr info in error (pkg/utils)
|
|
||
| // BlockVolume implements blockprovider.BlockVolume interface. | ||
| // It holds information about a gluster-block volume | ||
| type BlockVolume struct { |
There was a problem hiding this comment.
i think we don't need all fields in this struct
| } | ||
|
|
||
| // HostAddresses returns host addresses of a gluster block vol | ||
| func (gv *BlockVolume) HostAddresses() []string { return gv.hosts } |
There was a problem hiding this comment.
this functions are also not needed
There was a problem hiding this comment.
Then it would complain that the interface methods are not implemented? How else to do this?
There was a problem hiding this comment.
then IMO this will create an issue if we add different input structures for different provisioners, isn't it?
There was a problem hiding this comment.
Yes, So we should have kept the structures different for each provider? The structure is union of all the fields of each provider. And the caller ends up calling these functions anyways as the req structure of block vol has these fields. How to go about this?
There was a problem hiding this comment.
I think we need to refactor the code to achieve this.
There was a problem hiding this comment.
we can skip this cleanup, please create an issue to do the cleanup. so that we won't miss it
There was a problem hiding this comment.
@Madhu-1 we can take this task to define a better interface for BlockVolume to support all block providers in some other patch, for now this should be good to go.
| } | ||
| defer clusterLocks.UnLock(context.Background()) | ||
|
|
||
| volInfo, err := volume.GetVolume(hostVolume) |
There was a problem hiding this comment.
#1357 (comment) fixing this helps to reduce duplicate code here.
53dcdcd to
bd94f7a
Compare
|
Fixes #1476 |
aravindavk
left a comment
There was a problem hiding this comment.
Looks good. one minor comment.
| return nil, fmt.Errorf("failed to truncate block file %s: %+v", blockFileName, err) | ||
| } | ||
|
|
||
| cmd = exec.Command("mkfs.xfs", "-f", blockFileName) //nolint: gosec |
There was a problem hiding this comment.
Use utils.ExecuteCommandRun for including stderr info in error
| } | ||
|
|
||
| blockFileName := hostDir + "/" + name | ||
| cmd := exec.Command("truncate", fmt.Sprintf("-s %d", size), blockFileName) //nolint: gosec |
There was a problem hiding this comment.
Use utils.ExecuteCommandRun for including stderr info in error (pkg/utils)
bd94f7a to
41e2011
Compare
|
|
||
| log "github.com/sirupsen/logrus" | ||
| config "github.com/spf13/viper" | ||
| "k8s.io/kubernetes/pkg/util/mount" |
There was a problem hiding this comment.
@poornimag do we have Gopkg.toml changes for this one?
There was a problem hiding this comment.
if you are updating the dependencies using dep ensure, Please make sure version of dep to be v0.5.0
|
add to whitelist |
|
@poornimag CI failure |
plugins/blockvolume/blockprovider/gluster-loopback/glusterloopback.go
Outdated
Show resolved
Hide resolved
314d966 to
bed1c19
Compare
Signed-off-by: Poornima G <pgurusid@redhat.com>
Signed-off-by: Poornima G <pgurusid@redhat.com>
bed1c19 to
d3131b0
Compare
|
retest this please |
Signed-off-by: Poornima G pgurusid@redhat.com