Exemple #1
0
// ActivateLibStorage activates libStorage and returns a possibly mutated
// context.
func ActivateLibStorage(
	ctx apitypes.Context,
	config gofig.Config) (apitypes.Context, gofig.Config, <-chan error, error) {

	config = config.Scope("rexray")

	// set the `libstorage.service` property to the value of
	// `rexray.storageDrivers` if the former is not defined and the
	// latter is
	if !config.IsSet(apitypes.ConfigService) &&
		config.IsSet("rexray.storageDrivers") {
		if sd := config.GetStringSlice("rexray.storageDrivers"); len(sd) > 0 {
			config.Set(apitypes.ConfigService, sd[0])
		} else if sd := config.GetString("rexray.storageDrivers"); sd != "" {
			config.Set(apitypes.ConfigService, sd)
		}
	}

	if !config.IsSet(apitypes.ConfigIgVolOpsMountPath) {
		config.Set(apitypes.ConfigIgVolOpsMountPath, LibFilePath("volumes"))
	}

	var (
		err  error
		errs <-chan error
	)

	ctx, config, errs, err = activateLibStorage(ctx, config)
	if err != nil {
		return ctx, config, errs, err
	}

	return ctx, config, errs, nil
}
Exemple #2
0
func assertOsDrivers1(t *testing.T, c types.Config) {
	od := c.GetStringSlice("rexray.osDrivers")
	if od == nil {
		t.Fatalf("osDrivers == nil")
	}
	if len(od) != 1 {
		t.Fatalf("len(osDrivers) != 1; == %d", len(od))
	}
	if od[0] != "linux" {
		t.Fatalf("od[0] != linux; == %v", od[0])
	}
}
Exemple #3
0
func assertStorageDrivers(t *testing.T, c types.Config) {
	sd := c.GetStringSlice("rexray.storageDrivers")
	if sd == nil {
		t.Fatalf("storageDrivers == nil")
	}

	if len(sd) != 2 {
		t.Fatalf("len(storageDrivers) != 2; == %d", len(sd))
	}

	if sd[0] != "ec2" {
		t.Fatalf("sd[0] != ec2; == %v", sd[0])
	}

	if sd[1] != "xtremio" {
		t.Fatalf("sd[1] != xtremio; == %v", sd[1])
	}
}