Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.

Conversation

@poornimag
Copy link

Signed-off-by: Poornima G pgurusid@redhat.com

@centos-ci
Copy link
Collaborator

Can one of the admins verify this patch?

@ghost ghost assigned poornimag Dec 27, 2018
@ghost ghost added the in progress label Dec 27, 2018
@poornimag
Copy link
Author

This patch is dependent on pr: #1357 This pr can be merged only after merging the original PR

@poornimag poornimag changed the title Add loopback block provider <WIP Add loopback block provider <WIP> Dec 27, 2018
}

// GlusterBlock implements block Provider interface. It represents a gluster-block
type GlusterBlock struct {

Choose a reason for hiding this comment

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

can we have a different name for loop back provider

Copy link
Author

Choose a reason for hiding this comment

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

Done

mounts map[string]string
}

func newGlusterBlock() (blockprovider.Provider, error) {

Choose a reason for hiding this comment

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

same here

}

blockFileName := hostDir + "/" + name
cmd := exec.Command("truncate", fmt.Sprintf("-s %d", size), blockFileName) //nolint: gosec
Copy link
Member

Choose a reason for hiding this comment

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

check if we need to add some % (or a fixed value) to this size, so we give space for mkfs.xfs ?

Copy link
Author

Choose a reason for hiding this comment

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

Ahh right ok

Copy link
Member

Choose a reason for hiding this comment

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

Use utils.ExecuteCommandRun for including stderr info in error (pkg/utils)

Copy link
Member

Choose a reason for hiding this comment

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

this is pending


// BlockVolume implements blockprovider.BlockVolume interface.
// It holds information about a gluster-block volume
type BlockVolume struct {
Copy link
Member

Choose a reason for hiding this comment

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

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 }
Copy link
Member

Choose a reason for hiding this comment

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

this functions are also not needed

Copy link
Author

Choose a reason for hiding this comment

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

Then it would complain that the interface methods are not implemented? How else to do this?

Copy link
Member

Choose a reason for hiding this comment

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

then IMO this will create an issue if we add different input structures for different provisioners, isn't it?

Copy link
Author

Choose a reason for hiding this comment

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

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?

Copy link
Member

Choose a reason for hiding this comment

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

I think we need to refactor the code to achieve this.

Copy link
Author

Choose a reason for hiding this comment

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

Required for this patch?

Copy link
Member

Choose a reason for hiding this comment

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

we can skip this cleanup, please create an issue to do the cleanup. so that we won't miss it

Copy link

@oshankkumar oshankkumar Jan 14, 2019

Choose a reason for hiding this comment

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

@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.

Choose a reason for hiding this comment

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

@Madhu-1 sure I'll do that

}
defer clusterLocks.UnLock(context.Background())

volInfo, err := volume.GetVolume(hostVolume)
Copy link
Member

Choose a reason for hiding this comment

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

#1357 (comment) fixing this helps to reduce duplicate code here.

@poornimag poornimag force-pushed the gluster-block branch 2 times, most recently from 53dcdcd to bd94f7a Compare January 10, 2019 10:56
@poornimag poornimag changed the title Add loopback block provider <WIP> Add loopback block provider Jan 10, 2019
@atinmu
Copy link
Contributor

atinmu commented Jan 10, 2019

Fixes #1476

Copy link
Member

@aravindavk aravindavk left a comment

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

Use utils.ExecuteCommandRun for including stderr info in error

Copy link
Member

Choose a reason for hiding this comment

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

same here

Copy link
Author

Choose a reason for hiding this comment

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

Done

}

blockFileName := hostDir + "/" + name
cmd := exec.Command("truncate", fmt.Sprintf("-s %d", size), blockFileName) //nolint: gosec
Copy link
Member

Choose a reason for hiding this comment

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

Use utils.ExecuteCommandRun for including stderr info in error (pkg/utils)


log "github.com/sirupsen/logrus"
config "github.com/spf13/viper"
"k8s.io/kubernetes/pkg/util/mount"
Copy link
Member

Choose a reason for hiding this comment

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

@poornimag do we have Gopkg.toml changes for this one?

Choose a reason for hiding this comment

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

if you are updating the dependencies using dep ensure, Please make sure version of dep to be v0.5.0

@Madhu-1
Copy link
Member

Madhu-1 commented Jan 14, 2019

add to whitelist

@Madhu-1
Copy link
Member

Madhu-1 commented Jan 14, 2019

@poornimag CI failure

plugins/blockvolume/blockprovider/gluster-loopback/glusterloopback.go:17:2: cannot find package "k8s.io/kubernetes/pkg/util/mount" in any of:
19:24:38 	/root/go/src/github.com/gluster/glusterd2/vendor/k8s.io/kubernetes/pkg/util/mount (vendor tree)
19:24:38 	/usr/local/go/src/k8s.io/kubernetes/pkg/util/mount (from $GOROOT)
19:24:38 	/root/go/src/k8s.io/kubernetes/pkg/util/mount (from $GOPATH)
19:24:38 make: *** [build/glusterd2] Error 1
19:24:38 Build step 'Execute shell' marked build as failure

@poornimag poornimag force-pushed the gluster-block branch 2 times, most recently from 314d966 to bed1c19 Compare January 16, 2019 05:22
Poornima G added 2 commits January 16, 2019 12:49
Signed-off-by: Poornima G <pgurusid@redhat.com>
Signed-off-by: Poornima G <pgurusid@redhat.com>
@ghost ghost assigned aravindavk Jan 16, 2019
@Madhu-1
Copy link
Member

Madhu-1 commented Jan 16, 2019

retest this please

Copy link
Member

@Madhu-1 Madhu-1 left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants