Example #1
0
func (d *driver) Init(ctx types.Context, config gofig.Config) error {
	d.ctx = ctx
	d.config = config

	d.volPath = vfs.VolumesDirPath(config)
	d.snapPath = vfs.SnapshotsDirPath(config)

	ctx.WithField("vfs.root.path", vfs.RootDir(config)).Info("vfs.root")

	os.MkdirAll(d.volPath, 0755)
	os.MkdirAll(d.snapPath, 0755)

	d.volJSONGlobPatt = fmt.Sprintf("%s/*.json", d.volPath)
	d.snapJSONGlobPatt = fmt.Sprintf("%s/*.json", d.snapPath)

	volJSONPaths, err := d.getVolJSONs()
	if err != nil {
		return nil
	}
	d.volCount = int64(len(volJSONPaths)) - 1

	snapJSONPaths, err := d.getSnapJSONs()
	if err != nil {
		return nil
	}
	d.snapCount = int64(len(snapJSONPaths)) - 1

	return nil
}
Example #2
0
func (d *driver) VolumeCreateFromSnapshotAfter(
	ctx types.Context, result *types.Volume) {
	volDir := path.Join(vfs.VolumesDirPath(d.config), result.ID)
	os.MkdirAll(volDir, 0755)
}
Example #3
0
func (d *driver) Init(ctx types.Context, config gofig.Config) error {
	d.config = config
	os.MkdirAll(vfs.VolumesDirPath(config), 0755)
	return nil
}
Example #4
0
func (d *driver) VolumeRemoveAfter(
	ctx types.Context, service, volumeID string) {
	volDir := path.Join(vfs.VolumesDirPath(d.config), volumeID)
	os.RemoveAll(volDir)
}
Example #5
0
func assertVolDir(
	t *testing.T, config gofig.Config, volumeID string, exists bool) {
	volDir := path.Join(vfs.VolumesDirPath(config), volumeID)
	assert.Equal(t, exists, gotil.FileExists(volDir))
}