Skip to content

Commit f3d87bc

Browse files
committed
add more fields for storage create option
1 parent b43f96e commit f3d87bc

File tree

2 files changed

+85
-15
lines changed

2 files changed

+85
-15
lines changed

api/storage_type.go

Lines changed: 83 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,99 @@ import (
55
)
66

77
type Storage struct {
8-
Active int
9-
Avail int
10-
Content string
11-
Enabled int
12-
Shared int
13-
Storage string
14-
Total int
15-
Type string
16-
Used int
8+
Active int `json:"active"`
9+
Avail int `json:"avail"`
10+
Content string `json:"content"`
11+
Enabled int `json:"enabled"`
12+
Shared int `json:"shared"`
13+
Storage string `json:"storage"`
14+
Total int `json:"total"`
15+
Type string `json:"type"`
16+
Used int `json:"used"`
1717
UsedFraction float64 `json:"used_fraction"`
1818
}
1919

2020
// wip
2121
// https://pve.proxmox.com/pve-docs/api-viewer/#/storage
2222
type StorageCreateOptions struct {
23-
Storage string `json:"storage,omitempty"`
23+
// required. storage identifier
24+
Storage string `json:"storage,omitempty"`
25+
26+
// required. btrfs,cephfs,cifs,dir,glusterfs,iscsi,iscsidirect,lvm,lvmthin,nfs,pbs,rbd,zfs,zfspool
2427
StorageType string `json:"type,omitempty"`
28+
29+
Authsupported string `json:"authsupported,omitempty"`
30+
31+
// base volume. this volume is automatically activated
32+
Base string `json:"base,omitempty"`
33+
34+
BlockSize string `json:"blocksize,omitempty"`
35+
36+
// set I/O bandwidth limit for various operations (in KiB/s)
37+
BWLimit string `json:"bwlimit,omitempty"`
38+
39+
// host group for comstar views
40+
ComstarHG string `json:"comstar_hg,omitempty"`
41+
42+
// target group for comstar views
43+
ComstarTG string `json:"comstar_tg,omitempty"`
44+
2545
// allowed content types
2646
// NOTE: the value 'rootdir' is used for Containers, and value 'images' for VMs
27-
Content string `json:"content,omitempty"`
47+
Content string `json:"content,omitempty"`
48+
49+
// overrides for default content type directories
2850
ContentDirs string `json:"content-dirs,omitempty"`
29-
Format string `json:"format,omitempty"`
30-
Mkdir *bool `json:"mkdir,omitempty"`
31-
Path string `json:"path,omitempty"`
51+
52+
// create base directory if it doesn't exist
53+
CreateBasePath *bool `json:"create-base-path,omitempty"`
54+
55+
// populate directory with the default structure
56+
CreateSubDirs *bool `json:"create-subdirs,omitempty"`
57+
58+
DataPool string `json:"data-pool,omitempty"`
59+
60+
// proxmox backup serverr datastore name
61+
DataStore string `json:"datastore,omitempty"`
62+
63+
// CIFS domain
64+
Domain string `json:"domain,omitempty"`
65+
66+
// NFS export path
67+
Export string `json:"export,omitempty"`
68+
69+
Format string `json:"format,omitempty"`
70+
71+
// iscsi provider
72+
ISCSIProvider string `json:"iscsiprovider,omitempty"`
73+
74+
Mkdir *bool `json:"mkdir,omitempty"`
75+
76+
// filesystem path
77+
Path string `json:"path,omitempty"`
78+
79+
// iSCSI portal (ip or dns name with optional port)
80+
Portal string `json:"portal,omitempty"`
81+
82+
Pool string `json:"pool,omitempty"`
83+
84+
// server ip or domain
85+
Server string `json:"server,omitempty"`
86+
87+
// CIFS share
88+
Share string `json:"share,omitempty"`
89+
90+
// iSCSI target
91+
Target string `json:"target,omitempty"`
92+
93+
// lvm thin pool lv name
94+
ThinPool string `json:"thinpool,omitempty"`
95+
96+
// volume group name
97+
VGName string `json:"vgname,omitempty"`
98+
99+
// Glusterfs volume
100+
Volume string `json:"volume,omitempty"`
32101
}
33102

34103
type StorageContent struct {

rest/storage_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ func (s *TestSuite) TestCreateDeleteStorage() {
5252
s.EnsureNoStorage(testStorageName)
5353

5454
// create
55+
mkdir := true
5556
testOptions := api.StorageCreateOptions{
5657
Content: "images",
57-
Mkdir: true,
58+
Mkdir: &mkdir,
5859
Path: "/var/lib/vz/test",
5960
}
6061
storage, err := s.restclient.CreateStorage(context.TODO(), testStorageName, "dir", testOptions)

0 commit comments

Comments
 (0)