mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
Register the Bricks hosting directory using, ``` glustercli device add <peerid> <path> --provisioner loop ``` Example: ``` glustercli device add 70d79c3f-e7af-43f6-8b65-05dff2423da1 \ /exports --provisioner loop ``` Now create the volume using, ``` glustercli volume create gv1 --size 1G \ --provisioner loop \ --replica 3 ``` Fixes: #1418 Signed-off-by: Aravinda VK <avishwan@redhat.com>
174 lines
7.0 KiB
Go
174 lines
7.0 KiB
Go
package api
|
|
|
|
// BrickReq represents Brick Request
|
|
type BrickReq struct {
|
|
Type string `json:"type"`
|
|
PeerID string `json:"peerid"`
|
|
Path string `json:"path"`
|
|
TpMetadataSize uint64 `json:"metadata-size,omitempty"`
|
|
TpSize uint64 `json:"thinpool-size,omitempty"`
|
|
TotalSize uint64 `json:"total-size,omitempty"`
|
|
VgName string `json:"vg-name,omitempty"`
|
|
RootDevice string `json:"root-device,omitempty"`
|
|
TpName string `json:"thinpool-name,omitempty"`
|
|
LvName string `json:"logical-volume,omitempty"`
|
|
Size uint64 `json:"size,omitempty"`
|
|
VgID string `json:"vg-id,omitempty"`
|
|
BrickDirSuffix string `json:"brick-dir-suffix,omitempty"`
|
|
DevicePath string `json:"device-path,omitempty"`
|
|
MntOpts string `json:"mnt-opts,omitempty"`
|
|
FsType string `json:"fs-type,omitempty"`
|
|
}
|
|
|
|
// SubvolReq represents Sub volume Request
|
|
type SubvolReq struct {
|
|
Type string `json:"type"`
|
|
Bricks []BrickReq `json:"bricks"`
|
|
Subvols []SubvolReq `json:"subvols"`
|
|
ReplicaCount int `json:"replica"`
|
|
ArbiterCount int `json:"arbiter"`
|
|
DisperseCount int `json:"disperse-count,omitempty"`
|
|
DisperseData int `json:"disperse-data,omitempty"`
|
|
DisperseRedundancy int `json:"disperse-redundancy,omitempty"`
|
|
}
|
|
|
|
// VolCreateReq represents a Volume Create Request
|
|
/*supported Flags
|
|
"reuse-bricks" : for reusing of bricks
|
|
"allow-root-dir" : allow root directory to create brick
|
|
"allow-mount-as-brick" : reuse if its already mountpoint
|
|
"create-brick-dir" : if brick dir is not present, create it
|
|
*/
|
|
type VolCreateReq struct {
|
|
Name string `json:"name"`
|
|
Transport string `json:"transport,omitempty"`
|
|
Subvols []SubvolReq `json:"subvols"`
|
|
Force bool `json:"force,omitempty"`
|
|
Metadata map[string]string `json:"metadata,omitempty"`
|
|
Flags map[string]bool `json:"flags,omitempty"`
|
|
Size uint64 `json:"size"`
|
|
MaxBrickSize uint64 `json:"max-brick-size,omitempty"`
|
|
DistributeCount int `json:"distribute,omitempty"`
|
|
ReplicaCount int `json:"replica,omitempty"`
|
|
ArbiterCount int `json:"arbiter,omitempty"`
|
|
AverageFileSize uint64 `json:"average-file-size,omitempty"`
|
|
DisperseCount int `json:"disperse,omitempty"`
|
|
DisperseRedundancyCount int `json:"disperse-redundancy,omitempty"`
|
|
DisperseDataCount int `json:"disperse-data,omitempty"`
|
|
SnapshotEnabled bool `json:"snapshot,omitempty"`
|
|
SnapshotReserveFactor float64 `json:"snapshot-reserve-factor,omitempty"`
|
|
LimitPeers []string `json:"limit-peers,omitempty"`
|
|
LimitZones []string `json:"limit-zones,omitempty"`
|
|
ExcludePeers []string `json:"exclude-peers,omitempty"`
|
|
ExcludeZones []string `json:"exclude-zones,omitempty"`
|
|
SubvolZonesOverlap bool `json:"subvolume-zones-overlap,omitempty"`
|
|
SubvolType string `json:"subvolume-type,omitempty"`
|
|
ProvisionerType string `json:"provisioner"`
|
|
VolOptionReq
|
|
}
|
|
|
|
// VolOptionFlags is set of flags that allow/disallow setting certain kinds
|
|
// of volume options.
|
|
type VolOptionFlags struct {
|
|
AllowAdvanced bool `json:"allow-advanced-options,omitempty"`
|
|
AllowExperimental bool `json:"allow-experimental-options,omitempty"`
|
|
AllowDeprecated bool `json:"allow-deprecated-options,omitempty"`
|
|
}
|
|
|
|
// VolOptionReq represents an incoming request to set volume options
|
|
type VolOptionReq struct {
|
|
Options map[string]string `json:"options"`
|
|
VolOptionFlags
|
|
}
|
|
|
|
// VolOptionResetReq represents a request to reset volume options
|
|
type VolOptionResetReq struct {
|
|
Options []string `json:"options,omitempty"`
|
|
Force bool `json:"force,omitempty"`
|
|
All bool `json:"all,omitempty"`
|
|
}
|
|
|
|
// VolExpandReq represents a request to expand the volume by adding more bricks
|
|
/*supported Flags
|
|
"reuse-bricks" : for reusing of bricks
|
|
"allow-root-dir" : allow root directory to create brick
|
|
"allow-mount-as-brick" : reuse if its already mountpoint
|
|
"create-brick-dir" : if brick dir is not present, create it
|
|
*/
|
|
type VolExpandReq struct {
|
|
ReplicaCount int `json:"replica,omitempty"`
|
|
Bricks []BrickReq `json:"bricks,omitempty"`
|
|
Force bool `json:"force,omitempty"`
|
|
Flags map[string]bool `json:"flags,omitempty"`
|
|
Size uint64 `json:"size,omitempty"`
|
|
DistributeCount int `json:"distribute,omitempty"`
|
|
}
|
|
|
|
// VolumeOption represents an option that is part of a profile
|
|
type VolumeOption struct {
|
|
Name string `json:"name"`
|
|
OnValue string `json:"onvalue"`
|
|
}
|
|
|
|
// OptionGroup represents a group of options
|
|
type OptionGroup struct {
|
|
Name string `json:"name"`
|
|
Options []VolumeOption `json:"options"`
|
|
Description string `json:"description"`
|
|
}
|
|
|
|
// OptionGroupReq represents a request to create a new option group
|
|
type OptionGroupReq struct {
|
|
OptionGroup
|
|
VolOptionFlags
|
|
}
|
|
|
|
// ClientStatedump uniquely identifies a client (only gfapi) connected to
|
|
// glusterd2
|
|
type ClientStatedump struct {
|
|
Host string `json:"host" valid:"host,required"`
|
|
Pid int `json:"pid" valid:"required"`
|
|
}
|
|
|
|
// VolStatedumpReq represents a request to take statedump of various processes
|
|
// of a volume
|
|
type VolStatedumpReq struct {
|
|
Bricks bool `json:"bricks,omitempty"`
|
|
Quota bool `json:"quotad,omitempty"`
|
|
Client ClientStatedump `json:"client,omitempty"`
|
|
}
|
|
|
|
// VolEditReq represents a volume metadata edit request
|
|
type VolEditReq struct {
|
|
Metadata map[string]string `json:"metadata"`
|
|
DeleteMetadata bool `json:"delete-metadata"`
|
|
}
|
|
|
|
// ReplaceBrickReq represents replace brick request
|
|
type ReplaceBrickReq struct {
|
|
SrcPeerID string `json:"src-peerid"`
|
|
SrcBrickPath string `json:"src-brickpath"`
|
|
LimitPeers []string `json:"limit-peers,omitempty"`
|
|
LimitZones []string `json:"limit-zones,omitempty"`
|
|
ExcludePeers []string `json:"exclude-peers,omitempty"`
|
|
ExcludeZones []string `json:"exclude-zones,omitempty"`
|
|
SubvolZonesOverlap bool `json:"subvolume-zones-overlap,omitempty"`
|
|
Force bool `json:"force,omitempty"`
|
|
Flags map[string]bool `json:"flags,omitempty"`
|
|
}
|
|
|
|
// VolumeStartReq represents a request to start volume
|
|
type VolumeStartReq struct {
|
|
ForceStartBricks bool `json:"force-start-bricks,omitempty"`
|
|
}
|
|
|
|
// MetadataSize returns the size of the volume metadata in VolCreateReq
|
|
func (v *VolCreateReq) MetadataSize() int {
|
|
return mapSize(v.Metadata)
|
|
}
|
|
|
|
// MetadataSize returns the size of the volume metadata in VolEditReq
|
|
func (v *VolEditReq) MetadataSize() int {
|
|
return mapSize(v.Metadata)
|
|
}
|