...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package client
18
19 import "context"
20
21
22
23
24 type PhysicalStorageStoragePoolCreate struct {
25
26 Name string `json:"name,omitempty"`
27
28 Props map[string]string `json:"props,omitempty"`
29
30 SharedSpace string `json:"shared_space,omitempty"`
31
32 ExternalLocking bool `json:"external_locking,omitempty"`
33 }
34
35
36
37 type PhysicalStorageCreate struct {
38 ProviderKind ProviderKind `json:"provider_kind"`
39 DevicePaths []string `json:"device_paths"`
40
41 RaidLevel string `json:"raid_level,omitempty"`
42 PoolName string `json:"pool_name,omitempty"`
43 VdoEnable bool `json:"vdo_enable,omitempty"`
44 VdoSlabSizeKib int64 `json:"vdo_slab_size_kib,omitempty"`
45 VdoLogicalSizeKib int64 `json:"vdo_logical_size_kib,omitempty"`
46 WithStoragePool PhysicalStorageStoragePoolCreate `json:"with_storage_pool,omitempty"`
47 }
48
49 type PhysicalStorageNode struct {
50 PhysicalStorageDevice
51 Size int64 `json:"size,omitempty"`
52 Rotational bool `json:"rotational,omitempty"`
53 }
54
55
56 type PhysicalStorageDevice struct {
57 Device string `json:"device,omitempty"`
58 Model string `json:"model,omitempty"`
59 Serial string `json:"serial,omitempty"`
60 Wwn string `json:"wwn,omitempty"`
61 }
62
63
64 type PhysicalStorageViewItem struct {
65 Size int64 `json:"size,omitempty"`
66 Rotational bool `json:"rotational,omitempty"`
67 Nodes map[string][]PhysicalStorageDevice `json:"nodes,omitempty"`
68 }
69
70
71 func (n *NodeService) GetPhysicalStorageView(ctx context.Context, opts ...*ListOpts) ([]PhysicalStorageViewItem, error) {
72 var ps []PhysicalStorageViewItem
73 _, err := n.client.doGET(ctx, "/v1/physical-storage/", &ps, opts...)
74 return ps, err
75 }
76
77 func (n *NodeService) GetPhysicalStorage(ctx context.Context, nodeName string) ([]PhysicalStorageNode, error) {
78 var ps []PhysicalStorageNode
79 _, err := n.client.doGET(ctx, "/v1/physical-storage/"+nodeName, &ps)
80 return ps, err
81 }
82
83
84 func (n *NodeService) CreateDevicePool(ctx context.Context, nodeName string, psc PhysicalStorageCreate) error {
85 _, err := n.client.doPOST(ctx, "/v1/physical-storage/"+nodeName, psc)
86 return err
87 }
88
View as plain text