This repository has been archived by the owner on Mar 6, 2023. It is now read-only.
forked from NetApp/trident
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.go
87 lines (79 loc) · 2.34 KB
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// Copyright 2018 NetApp, Inc. All Rights Reserved.
package testutils
import (
"fmt"
"github.com/netapp/trident/storage"
"github.com/netapp/trident/storage/fake"
sa "github.com/netapp/trident/storage_attribute"
)
const (
SlowNoSnapshots = "slow-no-snapshots"
SlowSnapshots = "slow-snapshots"
FastSmall = "fast-small"
FastThinOnly = "fast-thin-only"
FastUniqueAttr = "fast-unique-attr"
MediumOverlap = "medium-overlap"
)
type PoolMatch struct {
Backend string
Pool string
}
func (p *PoolMatch) Matches(pool *storage.Pool) bool {
return pool.Name == p.Pool && pool.Backend.Name == p.Backend
}
func (p *PoolMatch) String() string {
return fmt.Sprintf("%s:%s", p.Backend, p.Pool)
}
func GetFakePools() map[string]*fake.StoragePool {
return map[string]*fake.StoragePool{
SlowNoSnapshots: {
Bytes: 50 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(0, 100),
sa.Snapshots: sa.NewBoolOffer(false),
sa.ProvisioningType: sa.NewStringOffer("thick", "thin"),
},
},
SlowSnapshots: {
Bytes: 50 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(0, 100),
sa.Snapshots: sa.NewBoolOffer(true),
sa.ProvisioningType: sa.NewStringOffer("thick", "thin"),
},
},
FastSmall: {
Bytes: 25 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(1000, 10000),
sa.Snapshots: sa.NewBoolOffer(true),
sa.ProvisioningType: sa.NewStringOffer("thick", "thin"),
},
},
FastThinOnly: {
Bytes: 50 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(1000, 10000),
sa.Snapshots: sa.NewBoolOffer(true),
sa.ProvisioningType: sa.NewStringOffer("thin"),
},
},
FastUniqueAttr: {
Bytes: 50 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(1000, 10000),
sa.Snapshots: sa.NewBoolOffer(true),
sa.ProvisioningType: sa.NewStringOffer("thin", "thick"),
"uniqueOptions": sa.NewStringOffer("foo", "bar", "baz"),
},
},
MediumOverlap: {
Bytes: 100 * 1024 * 1024 * 1024,
Attrs: map[string]sa.Offer{
sa.IOPS: sa.NewIntOffer(500, 1000),
sa.Snapshots: sa.NewBoolOffer(true),
sa.ProvisioningType: sa.NewStringOffer("thin"),
},
},
}
}