-
Notifications
You must be signed in to change notification settings - Fork 8
/
types.go
414 lines (400 loc) · 19.2 KB
/
types.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
package main
import (
"github.com/ceph/go-ceph/rados"
"time"
)
type params struct {
duration time.Duration
threadsCount uint64
blockSize, objectSize uint64
parallel, disableCheck bool
bs, os, cluster, user, keyring, config, pool, define, rdefine, cpuprofile, memprofile string
}
type cephconnection struct {
conn *rados.Conn
ioctx *rados.IOContext
}
type Poolinfo struct {
Pool string `json:"pool,omitempty"`
PoolId uint64 `json:"pool_id,omitempty"`
Size uint64 `json:"size,omitempty"`
}
func (times *PlacementGroup) StringsToTimes() {
const LongForm = "2006-01-02 15:04:05.000000"
times.LastFreshT, _ = time.Parse(LongForm, times.LastFresh)
times.LastChangeT, _ = time.Parse(LongForm, times.LastChange)
times.LastActiveT, _ = time.Parse(LongForm, times.LastActive)
times.LastPeeredT, _ = time.Parse(LongForm, times.LastPeered)
times.LastCleanT, _ = time.Parse(LongForm, times.LastClean)
times.LastBecameActiveT, _ = time.Parse(LongForm, times.LastBecameActive)
times.LastBecamePeeredT, _ = time.Parse(LongForm, times.LastBecamePeered)
times.LastUnstaleT, _ = time.Parse(LongForm, times.LastUnstale)
times.LastUndegradedT, _ = time.Parse(LongForm, times.LastUndegraded)
times.LastFullsizedT, _ = time.Parse(LongForm, times.LastFullsized)
times.LastDeepScrubStampT, _ = time.Parse(LongForm, times.LastDeepScrubStamp)
times.LastDeepScrubT, _ = time.Parse(LongForm, times.LastDeepScrub)
times.LastCleanScrubStampT, _ = time.Parse(LongForm, times.LastCleanScrubStamp)
times.LastScrubStampT, _ = time.Parse(LongForm, times.LastScrubStamp)
times.LastScrubT, _ = time.Parse(LongForm, times.LastScrub)
}
type Bucket struct {
Alg string `json:"alg"`
Hash string `json:"hash"`
ID int64 `json:"id"`
Items []struct {
ID int64 `json:"id"`
Pos uint64 `json:"pos"`
Weight float64 `json:"weight"`
} `json:"items"`
Name string `json:"name"`
TypeID int64 `json:"type_id"`
TypeName string `json:"type_name"`
Weight float64 `json:"weight"`
}
type Device struct {
Class string `json:"class"`
ID int64 `json:"id"`
Name string `json:"name"`
Info OsdMetadata
}
type OsdCrushDump struct {
Buckets []Bucket `json:"buckets"`
ChooseArgs struct{} `json:"choose_args"`
Devices []Device `json:"devices"`
Rules []struct {
MaxSize uint64 `json:"max_size"`
MinSize uint64 `json:"min_size"`
RuleID int64 `json:"rule_id"`
RuleName string `json:"rule_name"`
Ruleset int64 `json:"ruleset"`
Steps []struct {
Item int64 `json:"item"`
ItemName string `json:"item_name"`
Num int64 `json:"num"`
Op string `json:"op"`
Type string `json:"type"`
} `json:"steps"`
Type uint64 `json:"type"`
} `json:"rules"`
Tunables struct {
AllowedBucketAlgs uint64 `json:"allowed_bucket_algs"`
ChooseLocalFallbackTries uint64 `json:"choose_local_fallback_tries"`
ChooseLocalTries uint64 `json:"choose_local_tries"`
ChooseTotalTries uint64 `json:"choose_total_tries"`
ChooseleafDescendOnce uint64 `json:"chooseleaf_descend_once"`
ChooseleafStable uint64 `json:"chooseleaf_stable"`
ChooseleafVaryR uint64 `json:"chooseleaf_vary_r"`
HasV2Rules uint64 `json:"has_v2_rules"`
HasV3Rules uint64 `json:"has_v3_rules"`
HasV4Buckets uint64 `json:"has_v4_buckets"`
HasV5Rules uint64 `json:"has_v5_rules"`
LegacyTunables uint64 `json:"legacy_tunables"`
MinimumRequiredVersion string `json:"minimum_required_version"`
OptimalTunables uint64 `json:"optimal_tunables"`
Profile string `json:"profile"`
RequireFeatureTunables uint64 `json:"require_feature_tunables"`
RequireFeatureTunables2 uint64 `json:"require_feature_tunables2"`
RequireFeatureTunables3 uint64 `json:"require_feature_tunables3"`
RequireFeatureTunables5 uint64 `json:"require_feature_tunables5"`
StrawCalcVersion uint64 `json:"straw_calc_version"`
} `json:"tunables"`
Types []struct {
Name string `json:"name"`
TypeID int64 `json:"type_id"`
} `json:"types"`
}
type Osd struct {
ClusterAddr string `json:"cluster_addr"`
DownAt uint64 `json:"down_at"`
HeartbeatBackAddr string `json:"heartbeat_back_addr"`
HeartbeatFrontAddr string `json:"heartbeat_front_addr"`
In uint64 `json:"in"`
LastCleanBegin uint64 `json:"last_clean_begin"`
LastCleanEnd uint64 `json:"last_clean_end"`
LostAt uint64 `json:"lost_at"`
Osd uint64 `json:"osd"`
PrimaryAffinity float64 `json:"primary_affinity"`
PublicAddr string `json:"public_addr"`
State []string `json:"state"`
Up uint64 `json:"up"`
UpFrom uint64 `json:"up_from"`
UpThru uint64 `json:"up_thru"`
UUID string `json:"uuid"`
Weight float64 `json:"weight"`
}
type OsdDump struct {
BackfillfullRatio float64 `json:"backfillfull_ratio"`
Blacklist struct{} `json:"blacklist"`
ClusterSnapshot string `json:"cluster_snapshot"`
Created string `json:"created"`
CrushVersion uint64 `json:"crush_version"`
Epoch uint64 `json:"epoch"`
ErasureCodeProfiles struct {
Default struct {
K string `json:"k"`
M string `json:"m"`
Plugin string `json:"plugin"`
Technique string `json:"technique"`
} `json:"default"`
} `json:"erasure_code_profiles"`
Flags string `json:"flags"`
FlagsNum uint64 `json:"flags_num"`
FlagsSet []string `json:"flags_set"`
Fsid string `json:"fsid"`
FullRatio float64 `json:"full_ratio"`
MaxOsd uint64 `json:"max_osd"`
MinCompatClient string `json:"min_compat_client"`
Modified string `json:"modified"`
NearfullRatio float64 `json:"nearfull_ratio"`
NewPurgedSnaps []interface{} `json:"new_purged_snaps"`
NewRemovedSnaps []interface{} `json:"new_removed_snaps"`
OsdXinfo []struct {
DownStamp string `json:"down_stamp"`
Features uint64 `json:"features"`
LaggyInterval uint64 `json:"laggy_interval"`
LaggyProbability float64 `json:"laggy_probability"`
OldWeight float64 `json:"old_weight"`
Osd uint64 `json:"osd"`
} `json:"osd_xinfo"`
Osds []Osd `json:"osds"`
PgTemp []interface{} `json:"pg_temp"`
PgUpmap []interface{} `json:"pg_upmap"`
PgUpmapItems []interface{} `json:"pg_upmap_items"`
PoolMax uint64 `json:"pool_max"`
Pools []struct {
ApplicationMetadata struct {
Rbd struct{} `json:"rbd"`
Rgw struct{} `json:"rgw"`
} `json:"application_metadata"`
Auid uint64 `json:"auid"`
CacheMinEvictAge uint64 `json:"cache_min_evict_age"`
CacheMinFlushAge uint64 `json:"cache_min_flush_age"`
CacheMode string `json:"cache_mode"`
CacheTargetDirtyHighRatioMicro uint64 `json:"cache_target_dirty_high_ratio_micro"`
CacheTargetDirtyRatioMicro uint64 `json:"cache_target_dirty_ratio_micro"`
CacheTargetFullRatioMicro uint64 `json:"cache_target_full_ratio_micro"`
CreateTime string `json:"create_time"`
CrushRule int64 `json:"crush_rule"`
ErasureCodeProfile string `json:"erasure_code_profile"`
ExpectedNumObjects uint64 `json:"expected_num_objects"`
FastRead bool `json:"fast_read"`
Flags uint64 `json:"flags"`
FlagsNames string `json:"flags_names"`
GradeTable []interface{} `json:"grade_table"`
HitSetCount uint64 `json:"hit_set_count"`
HitSetGradeDecayRate uint64 `json:"hit_set_grade_decay_rate"`
HitSetParams struct {
Type string `json:"type"`
} `json:"hit_set_params"`
HitSetPeriod uint64 `json:"hit_set_period"`
HitSetSearchLastN uint64 `json:"hit_set_search_last_n"`
LastChange string `json:"last_change"`
LastForceOpResend string `json:"last_force_op_resend"`
LastForceOpResendPreluminous string `json:"last_force_op_resend_preluminous"`
MinReadRecencyForPromote uint64 `json:"min_read_recency_for_promote"`
MinSize uint64 `json:"min_size"`
MinWriteRecencyForPromote uint64 `json:"min_write_recency_for_promote"`
ObjectHash uint64 `json:"object_hash"`
Options struct{} `json:"options"`
PgNum uint64 `json:"pg_num"`
PgPlacementNum uint64 `json:"pg_placement_num"`
Pool uint64 `json:"pool"`
PoolName string `json:"pool_name"`
PoolSnaps []interface{} `json:"pool_snaps"`
QuotaMaxBytes uint64 `json:"quota_max_bytes"`
QuotaMaxObjects uint64 `json:"quota_max_objects"`
ReadTier int64 `json:"read_tier"`
RemovedSnaps string `json:"removed_snaps"`
Size uint64 `json:"size"`
SnapEpoch uint64 `json:"snap_epoch"`
SnapMode string `json:"snap_mode"`
SnapSeq uint64 `json:"snap_seq"`
StripeWidth uint64 `json:"stripe_width"`
TargetMaxBytes uint64 `json:"target_max_bytes"`
TargetMaxObjects uint64 `json:"target_max_objects"`
TierOf int64 `json:"tier_of"`
Tiers []interface{} `json:"tiers"`
Type uint64 `json:"type"`
UseGmtHitset bool `json:"use_gmt_hitset"`
WriteTier int64 `json:"write_tier"`
} `json:"pools"`
PrimaryTemp []interface{} `json:"primary_temp"`
RemovedSnapsQueue []interface{} `json:"removed_snaps_queue"`
RequireMinCompatClient string `json:"require_min_compat_client"`
RequireOsdRelease string `json:"require_osd_release"`
}
type PlacementGroup struct {
Acting []int `json:"acting"`
ActingPrimary int `json:"acting_primary"`
AvailNoMissing []any `json:"avail_no_missing"`
BlockedBy []any `json:"blocked_by"`
Created int `json:"created"`
DirtyStatsInvalid bool `json:"dirty_stats_invalid"`
HitsetBytesStatsInvalid bool `json:"hitset_bytes_stats_invalid"`
HitsetStatsInvalid bool `json:"hitset_stats_invalid"`
LastActive string `json:"last_active"`
LastActiveT time.Time
LastBecameActive string `json:"last_became_active"`
LastBecameActiveT time.Time
LastBecamePeered string `json:"last_became_peered"`
LastBecamePeeredT time.Time
LastChange string `json:"last_change"`
LastChangeT time.Time
LastClean string `json:"last_clean"`
LastCleanT time.Time
LastCleanScrubStamp string `json:"last_clean_scrub_stamp"`
LastCleanScrubStampT time.Time
LastDeepScrub string `json:"last_deep_scrub"`
LastDeepScrubT time.Time
LastDeepScrubStamp string `json:"last_deep_scrub_stamp"`
LastDeepScrubStampT time.Time
LastEpochClean int `json:"last_epoch_clean"`
LastFresh string `json:"last_fresh"`
LastFreshT time.Time
LastFullsized string `json:"last_fullsized"`
LastFullsizedT time.Time
LastPeered string `json:"last_peered"`
LastPeeredT time.Time
LastScrub string `json:"last_scrub"`
LastScrubT time.Time
LastScrubDuration int `json:"last_scrub_duration"`
LastScrubStamp string `json:"last_scrub_stamp"`
LastScrubStampT time.Time
LastUndegraded string `json:"last_undegraded"`
LastUndegradedT time.Time
LastUnstale string `json:"last_unstale"`
LastUnstaleT time.Time
LogSize int `json:"log_size"`
LogStart string `json:"log_start"`
ManifestStatsInvalid bool `json:"manifest_stats_invalid"`
MappingEpoch int `json:"mapping_epoch"`
ObjectLocationCounts []any `json:"object_location_counts"`
ObjectsScrubbed int `json:"objects_scrubbed"`
ObjectsTrimmed int `json:"objects_trimmed"`
OmapStatsInvalid bool `json:"omap_stats_invalid"`
OndiskLogSize int `json:"ondisk_log_size"`
OndiskLogStart string `json:"ondisk_log_start"`
Parent string `json:"parent"`
ParentSplitBits int `json:"parent_split_bits"`
Pgid string `json:"pgid"`
PinStatsInvalid bool `json:"pin_stats_invalid"`
PurgedSnaps []any `json:"purged_snaps"`
ReportedEpoch int `json:"reported_epoch"`
ReportedSeq int `json:"reported_seq"`
ScrubDuration float64 `json:"scrub_duration"`
ScrubSchedule string `json:"scrub_schedule"`
SnaptrimDuration int `json:"snaptrim_duration"`
SnaptrimqLen int `json:"snaptrimq_len"`
StatSum struct {
NumBytes int `json:"num_bytes"`
NumBytesHitSetArchive int `json:"num_bytes_hit_set_archive"`
NumBytesRecovered int `json:"num_bytes_recovered"`
NumDeepScrubErrors int `json:"num_deep_scrub_errors"`
NumEvict int `json:"num_evict"`
NumEvictKb int `json:"num_evict_kb"`
NumEvictModeFull int `json:"num_evict_mode_full"`
NumEvictModeSome int `json:"num_evict_mode_some"`
NumFlush int `json:"num_flush"`
NumFlushKb int `json:"num_flush_kb"`
NumFlushModeHigh int `json:"num_flush_mode_high"`
NumFlushModeLow int `json:"num_flush_mode_low"`
NumKeysRecovered int `json:"num_keys_recovered"`
NumLargeOmapObjects int `json:"num_large_omap_objects"`
NumLegacySnapsets int `json:"num_legacy_snapsets"`
NumObjectClones int `json:"num_object_clones"`
NumObjectCopies int `json:"num_object_copies"`
NumObjects int `json:"num_objects"`
NumObjectsDegraded int `json:"num_objects_degraded"`
NumObjectsDirty int `json:"num_objects_dirty"`
NumObjectsHitSetArchive int `json:"num_objects_hit_set_archive"`
NumObjectsManifest int `json:"num_objects_manifest"`
NumObjectsMisplaced int `json:"num_objects_misplaced"`
NumObjectsMissing int `json:"num_objects_missing"`
NumObjectsMissingOnPrimary int `json:"num_objects_missing_on_primary"`
NumObjectsOmap int `json:"num_objects_omap"`
NumObjectsPinned int `json:"num_objects_pinned"`
NumObjectsRecovered int `json:"num_objects_recovered"`
NumObjectsRepaired int `json:"num_objects_repaired"`
NumObjectsUnfound int `json:"num_objects_unfound"`
NumOmapBytes int `json:"num_omap_bytes"`
NumOmapKeys int `json:"num_omap_keys"`
NumPromote int `json:"num_promote"`
NumRead int `json:"num_read"`
NumReadKb int `json:"num_read_kb"`
NumScrubErrors int `json:"num_scrub_errors"`
NumShallowScrubErrors int `json:"num_shallow_scrub_errors"`
NumWhiteouts int `json:"num_whiteouts"`
NumWrite int `json:"num_write"`
NumWriteKb int `json:"num_write_kb"`
} `json:"stat_sum"`
State string `json:"state"`
StatsInvalid bool `json:"stats_invalid"`
Up []int `json:"up"`
UpPrimary int `json:"up_primary"`
Version string `json:"version"`
}
type OsdMetadata struct {
Arch string `json:"arch"`
BackAddr string `json:"back_addr"`
BackIface string `json:"back_iface"`
Bluefs string `json:"bluefs"`
BluefsSingleSharedDevice string `json:"bluefs_single_shared_device"`
BluestoreBdevAccessMode string `json:"bluestore_bdev_access_mode"`
BluestoreBdevBlockSize string `json:"bluestore_bdev_block_size"`
BluestoreBdevDev string `json:"bluestore_bdev_dev"`
BluestoreBdevDevNode string `json:"bluestore_bdev_dev_node"`
BluestoreBdevDriver string `json:"bluestore_bdev_driver"`
BluestoreBdevModel string `json:"bluestore_bdev_model"`
BluestoreBdevPartitionPath string `json:"bluestore_bdev_partition_path"`
BluestoreBdevRotational string `json:"bluestore_bdev_rotational"`
BluestoreBdevSize string `json:"bluestore_bdev_size"`
BluestoreBdevType string `json:"bluestore_bdev_type"`
CephRelease string `json:"ceph_release"`
CephVersion string `json:"ceph_version"`
CephVersionShort string `json:"ceph_version_short"`
CPU string `json:"cpu"`
DefaultDeviceClass string `json:"default_device_class"`
Devices string `json:"devices"`
Distro string `json:"distro"`
DistroDescription string `json:"distro_description"`
DistroVersion string `json:"distro_version"`
FrontAddr string `json:"front_addr"`
FrontIface string `json:"front_iface"`
HbBackAddr string `json:"hb_back_addr"`
HbFrontAddr string `json:"hb_front_addr"`
Hostname string `json:"hostname"`
ID int64 `json:"id"`
JournalRotational string `json:"journal_rotational"`
KernelDescription string `json:"kernel_description"`
KernelVersion string `json:"kernel_version"`
MemSwapKb string `json:"mem_swap_kb"`
MemTotalKb string `json:"mem_total_kb"`
Os string `json:"os"`
OsdData string `json:"osd_data"`
OsdObjectstore string `json:"osd_objectstore"`
Rotational string `json:"rotational"`
}
type OsdMap struct {
Acting []uint64 `json:"acting"`
ActingPrimary uint64 `json:"acting_primary"`
Epoch uint64 `json:"epoch"`
Objname string `json:"objname"`
Pgid string `json:"pgid"`
Pool string `json:"pool"`
PoolID uint64 `json:"pool_id"`
RawPgid string `json:"raw_pgid"`
Up []uint64 `json:"up"`
UpPrimary int64 `json:"up_primary"`
}
type avgLatencies struct {
latencyTotal int64
len int64
}
type placementGroupNautilus struct {
PgReady bool `json:"pg_ready"`
PgStats []PlacementGroup `json:"pg_stats"`
}
type osdStatLine struct {
num int64
line string
}