Skip to content

Commit 31c02b2

Browse files
authored
Add backend pool reporting to Solidfire driver
This change enables the Solidfire driver to discover and report a set of non-overlapping, discrete storage pools that exist on the Solidfire backend.
1 parent 3a7cae7 commit 31c02b2

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

storage_drivers/solidfire/solidfire_san.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,13 @@ func (d *SANStorageDriver) Initialize(
283283
return errors.New("error encountered validating SolidFire driver on init")
284284
}
285285

286+
// Identify non-overlapping storage backend pools on the driver backend.
287+
pools, err := drivers.EncodeStorageBackendPools(ctx, commonConfig, d.getStorageBackendPools(ctx))
288+
if err != nil {
289+
return fmt.Errorf("failed to encode storage backend pools: %v", err)
290+
}
291+
d.Config.BackendPools = pools
292+
286293
// log cluster node serial numbers asynchronously since the API can take a long time
287294
go d.getNodeSerialNumbers(ctx, config.CommonStorageDriverConfig)
288295

@@ -1583,6 +1590,19 @@ func (d *SANStorageDriver) GetStorageBackendPhysicalPoolNames(context.Context) [
15831590
return []string{}
15841591
}
15851592

1593+
// getStorageBackendPools determines any non-overlapping, discrete storage pools present on a driver's storage backend.
1594+
func (d *SANStorageDriver) getStorageBackendPools(ctx context.Context) []drivers.SolidfireStorageBackendPool {
1595+
fields := LogFields{"Method": "getStorageBackendPools", "Type": "SANStorageDriver"}
1596+
Logc(ctx).WithFields(fields).Debug(">>>> getStorageBackendPools")
1597+
defer Logc(ctx).WithFields(fields).Debug("<<<< getStorageBackendPools")
1598+
1599+
// For this driver, a discrete storage pool is composed of the following:
1600+
// 1. AccountID
1601+
// 2. Tenant name
1602+
// For now, SolidFire will only report 1 storage pool.
1603+
return []drivers.SolidfireStorageBackendPool{{AccountID: d.AccountID, TenantName: d.Config.TenantName}}
1604+
}
1605+
15861606
func (d *SANStorageDriver) GetInternalVolumeName(ctx context.Context, name string) string {
15871607
if tridentconfig.UsingPassthroughStore {
15881608
// With a passthrough store, the name mapping must remain reversible

storage_drivers/solidfire/solidfire_san_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,14 @@ func TestValidateStoragePrefix(t *testing.T) {
188188
})
189189
}
190190
}
191+
192+
func TestGetStorageBackendPools(t *testing.T) {
193+
d := newTestSolidfireSANDriver()
194+
backendPools := d.getStorageBackendPools(context.Background())
195+
196+
// These backend pools are derived from the driver's configuration. If that changes in the helper
197+
// "newTestSolidfireSANDriver", these assertions will need to be adjusted as well.
198+
assert.Equal(t, len(backendPools), 1, "unexpected set of backend pools")
199+
assert.Equal(t, d.Config.TenantName, backendPools[0].TenantName, "tenant name didn't match")
200+
assert.Equal(t, d.AccountID, backendPools[0].AccountID, "account ID didn't match")
201+
}

storage_drivers/types.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ type OntapStorageDriverPool struct {
152152
// StorageBackendPool is a type constraint that enables drivers to generically report non-overlapping storage pools
153153
// within a backend.
154154
type StorageBackendPool interface {
155-
OntapFlexGroupStorageBackendPool | OntapStorageBackendPool | OntapEconomyStorageBackendPool
155+
OntapFlexGroupStorageBackendPool | OntapStorageBackendPool | OntapEconomyStorageBackendPool |
156+
SolidfireStorageBackendPool
156157
}
157158

158159
// OntapFlexGroupStorageBackendPool is a non-overlapping section of an ONTAP flexgroup backend that may be used for
@@ -351,6 +352,13 @@ type SolidfireStorageDriverPool struct {
351352
SolidfireStorageDriverConfigDefaults `json:"defaults"`
352353
}
353354

355+
// SolidfireStorageBackendPool is a non-overlapping section of a SolidFire backend that may be used for
356+
// provisioning storage.
357+
type SolidfireStorageBackendPool struct {
358+
AccountID int64 `json:"accountID,string"`
359+
TenantName string `json:"tenantName"`
360+
}
361+
354362
type SolidfireStorageDriverConfigDefaults struct {
355363
CommonStorageDriverConfigDefaults
356364
}

0 commit comments

Comments
 (0)