arrayfreenas

package
v1.0.0-alpha1.0...-2e0dbe4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Head                  = "/api/v2.0"
	DatasetTypeVolume     = "VOLUME"
	DatasetTypeFilesystem = "FILESYSTEM"
	RequestTimeout        = 10 * time.Second
)

Functions

func NewDriver

func NewDriver() array.Driver

Types

type AddDiskOptions

type AddDiskOptions struct {
	AddZvolOptions
	InsecureTPC bool
	Mapping     string
	LunId       *int
}

type AddISCSIExtentOptions

type AddISCSIExtentOptions struct {
	Name        string
	Disk        string
	Blocksize   string
	InsecureTPC bool
}

type AddISCSITargetGroupOptions

type AddISCSITargetGroupOptions struct {
	PortalId      int
	Target        string
	InitiatorName string
	InitiatorId   int
	AuthMethod    string
	Auth          string
}

type AddZvolOptions

type AddZvolOptions struct {
	Name          string
	Size          string
	Blocksize     string
	Sparse        bool
	Deduplication string
	Compression   string
}

AddZvolOptions receives "add zvol" and "add disk" command line flags values

func (AddZvolOptions) Params

type Array

type Array struct {
	*array.Array
}

func New

func New() *Array

func (Array) AddDisk

func (t Array) AddDisk(opt AddDiskOptions) (*Disk, error)

func (Array) AddISCSIExtent

func (t Array) AddISCSIExtent(opt AddISCSIExtentOptions) (*ISCSIExtent, error)

func (Array) AddZvol

func (t Array) AddZvol(opt AddZvolOptions) (*Dataset, error)

func (Array) CreateDataset

func (t Array) CreateDataset(params CreateDatasetParams) (*Dataset, error)

func (Array) DelDisk

func (t Array) DelDisk(name string) (*Disk, error)

func (Array) DelISCSIExtent

func (t Array) DelISCSIExtent(opt DelISCSIExtentOptions) (*ISCSIExtent, error)

func (Array) DelZvol

func (t Array) DelZvol(name string) (*Dataset, error)

func (Array) DeleteDataset

func (t Array) DeleteDataset(name string) (*Dataset, error)

func (Array) DiskId

func (t Array) DiskId(disk Disk) string

DiskId return the NAA from the created disk dataset

func (Array) DiskPaths

func (t Array) DiskPaths(disk Disk) (san.Paths, error)

DiskPaths return the san paths list from the created disk dataset and api query responses

func (*Array) Do

func (t *Array) Do(req *http.Request, v interface{}) (*http.Response, error)

func (Array) GetDataset

func (t Array) GetDataset(name string) (*Dataset, error)

func (Array) GetDatasets

func (t Array) GetDatasets() (Datasets, error)

func (Array) GetDisk

func (t Array) GetDisk(name string) (*Disk, error)

func (Array) GetISCSIExtent

func (t Array) GetISCSIExtent(name string) (*ISCSIExtent, error)

func (Array) GetISCSIExtents

func (t Array) GetISCSIExtents() (ISCSIExtents, error)

func (Array) GetISCSIInitiators

func (t Array) GetISCSIInitiators() (ISCSIInitiators, error)

func (Array) GetISCSIPortals

func (t Array) GetISCSIPortals() ([]any, error)

func (Array) GetISCSITargetExtents

func (t Array) GetISCSITargetExtents() (ISCSITargetExtents, error)

func (Array) GetISCSITargets

func (t Array) GetISCSITargets() (ISCSITargets, error)

func (Array) GetPoolByName

func (t Array) GetPoolByName(name string) (Pool, error)

func (Array) GetPools

func (t Array) GetPools() ([]Pool, error)

func (Array) GetSystemInfo

func (t Array) GetSystemInfo() (*SystemInfo, error)

func (Array) MapDisk

func (t Array) MapDisk(opt MapDiskOptions) (ISCSITargetExtents, error)

func (*Array) Run

func (t *Array) Run(args []string) error

func (Array) UnmapDisk

func (t Array) UnmapDisk(opt UnmapDiskOptions) (ISCSITargetExtents, error)

func (Array) UpdateDataset

func (t Array) UpdateDataset(id string, params UpdateDatasetParams) (*Dataset, error)

type CompositeValue

type CompositeValue struct {
	Rawvalue string  `json:"rawvalue"`
	Source   *string `json:"source,omitempty"`
	Value    *string `json:"value,omitempty"`
}

CompositeValue defines model for CompositeValue.

type CreateDatasetParams

type CreateDatasetParams struct {
	Aclmode           *string                               `json:"aclmode,omitempty"`
	Atime             *string                               `json:"atime,omitempty"`
	Casesensitivity   *string                               `json:"casesensitivity,omitempty"`
	Comments          *string                               `json:"comments,omitempty"`
	Compression       *string                               `json:"compression,omitempty"`
	Copies            *int                                  `json:"copies,omitempty"`
	Deduplication     *string                               `json:"deduplication,omitempty"`
	Encryption        *bool                                 `json:"encryption,omitempty"`
	EncryptionOptions *CreateDatasetParamsEncryptionOptions `json:"encryption_options,omitempty"`
	Exec              *string                               `json:"exec,omitempty"`
	ForceSize         *bool                                 `json:"force_size,omitempty"`
	InheritEncryption *bool                                 `json:"inherit_encryption,omitempty"`
	Sparse            *bool                                 `json:"sparse,omitempty"`
	Name              string                                `json:"name"`
	Quota             *int64                                `json:"quota,omitempty"`
	QuotaCritical     *int64                                `json:"quota_critical,omitempty"`
	QuotaWarning      *int64                                `json:"quota_warning,omitempty"`
	Readonly          *string                               `json:"readonly,omitempty"`
	Recordsize        *string                               `json:"recordsize,omitempty"`
	Refquota          *int64                                `json:"refquota,omitempty"`
	RefquotaCritical  *int64                                `json:"refquota_critical,omitempty"`
	RefquotaWarning   *int64                                `json:"refquota_warning,omitempty"`
	Refreservation    *int64                                `json:"refreservation,omitempty"`
	Reservation       *int64                                `json:"reservation,omitempty"`
	ShareType         *string                               `json:"share_type,omitempty"`
	Snapdir           *string                               `json:"snapdir,omitempty"`
	Sync              *string                               `json:"sync,omitempty"`
	Type              *string                               `json:"type,omitempty"`
	Volblocksize      *string                               `json:"volblocksize,omitempty"`
	Volsize           *int64                                `json:"volsize,omitempty"`
}

CreateDatasetParams defines model for CreateDatasetParams.

type CreateDatasetParamsEncryptionOptions

type CreateDatasetParamsEncryptionOptions struct {
	Algorithm   *string `json:"algorithm,omitempty"`
	GenerateKey *bool   `json:"generate_key,omitempty"`
	Key         *string `json:"key,omitempty"`
	Passphrase  *string `json:"passphrase,omitempty"`
}

CreateDatasetParamsEncryptionOptions defines model for CreateDatasetParams_encryption_options.

type CreateISCSIExtentParams

type CreateISCSIExtentParams struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	InsecureTPC bool   `json:"insecure_tpc"`
	Blocksize   int    `json:"blocksize"`
	Disk        string `json:"disk"`
}

CreateISCSIExtentParams defines model for CreateISCSIExtentParams.

type CreateISCSIInitiatorParams

type CreateISCSIInitiatorParams struct {
	Initiators  []string `json:"initiators"`
	AuthNetwork []string `json:"auth_network,omitempty"`
	Comment     string   `json:"comment,omitempty"`
}

CreateISCSIInitiatorParams defines model for CreateISCSIInitiatorParams.

type CreateISCSIPortalParams

type CreateISCSIPortalParams struct {
	Comment             string                `json:"comment,omitempty"`
	DiscoveryAuthMethod string                `json:"discovery_authmethod,omitempty"`
	DiscoveryAuthGroup  int                   `json:"discovery_authgroup,omitempty"`
	Listen              []ISCSIPortalListenIp `json:"listen"`
}

type CreateISCSITargetExtentParams

type CreateISCSITargetExtentParams struct {
	Target int  `json:"target"`
	Extent int  `json:"extent"`
	LunId  *int `json:"lunid"`
}

CreateISCSITargetExtentParams defines model for CreateISCSITargetExtentParams.

type CreateISCSITargetParams

type CreateISCSITargetParams struct {
	Name  string `json:"name"`
	Alias string `json:"alias,omitempty"`
}

CreateISCSITargetParams defines model for CreateISCSITargetParams.

type Dataset

type Dataset struct {
	Aclmode             *CompositeValue `json:"aclmode,omitempty"`
	Acltype             *CompositeValue `json:"acltype,omitempty"`
	Atime               *CompositeValue `json:"atime,omitempty"`
	Available           *CompositeValue `json:"available,omitempty"`
	Casesensitivity     *CompositeValue `json:"casesensitivity,omitempty"`
	Comments            *CompositeValue `json:"comments,omitempty"`
	Compression         *CompositeValue `json:"compression,omitempty"`
	Copies              *CompositeValue `json:"copies,omitempty"`
	Deduplication       *CompositeValue `json:"deduplication,omitempty"`
	Encrypted           *bool           `json:"encrypted,omitempty"`
	EncryptionAlgorithm *CompositeValue `json:"encryption_algorithm,omitempty"`
	EncryptionRoot      *string         `json:"encryption_root,omitempty"`
	Exec                *CompositeValue `json:"exec,omitempty"`
	Id                  string          `json:"id"`
	KeyFormat           *CompositeValue `json:"key_format,omitempty"`
	KeyLoaded           *bool           `json:"key_loaded,omitempty"`
	Locked              *bool           `json:"locked,omitempty"`
	Managedby           *CompositeValue `json:"managedby,omitempty"`
	Mountpoint          *string         `json:"mountpoint,omitempty"`
	Name                string          `json:"name"`
	Origin              *CompositeValue `json:"origin,omitempty"`
	Pbkdf2iters         *CompositeValue `json:"pbkdf2iters,omitempty"`
	Pool                string          `json:"pool"`
	Quota               *CompositeValue `json:"quota,omitempty"`
	QuotaCritical       *CompositeValue `json:"quota_critical,omitempty"`
	QuotaWarning        *CompositeValue `json:"quota_warning,omitempty"`
	Readonly            *CompositeValue `json:"readonly,omitempty"`
	Recordsize          *CompositeValue `json:"recordsize,omitempty"`
	Refquota            *CompositeValue `json:"refquota,omitempty"`
	RefquotaCritical    *CompositeValue `json:"refquota_critical,omitempty"`
	RefquotaWarning     *CompositeValue `json:"refquota_warning,omitempty"`
	Refreservation      *CompositeValue `json:"refreservation,omitempty"`
	Reservation         *CompositeValue `json:"reservation,omitempty"`
	Snapdir             *CompositeValue `json:"snapdir,omitempty"`
	Sync                *CompositeValue `json:"sync,omitempty"`
	Type                string          `json:"type"`
	Used                *CompositeValue `json:"used,omitempty"`
	Volblocksize        *CompositeValue `json:"volblocksize,omitempty"`
	Volsize             *CompositeValue `json:"volsize,omitempty"`
	Xattr               *CompositeValue `json:"xattr,omitempty"`
}

Dataset defines model for Dataset.

type Datasets

type Datasets []Dataset

func (Datasets) GetByName

func (t Datasets) GetByName(name string) (*Dataset, bool)

type DelISCSIExtentOptions

type DelISCSIExtentOptions struct {
	Id   int
	Name string
}

type Disk

type Disk struct {
	Dataset *Dataset   `json:"dataset"`
	ISCSI   *DiskISCSI `json:"iscsi,omitempty"`
}

type DiskISCSI

type DiskISCSI struct {
	Extent        *ISCSIExtent        `json:"extent,omitempty"`
	TargetExtents []ISCSITargetExtent `json:"targetextents,omitempty"`
}

type GetDatasetParams

type GetDatasetParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetDatasetParams defines parameters for GetDataset.

type GetDatasetsParams

type GetDatasetsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetDatasetsParams defines parameters for GetDatasets.

type GetISCSIExtentsParams

type GetISCSIExtentsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetISCSIExtentsParams defines parameters for GetISCSIExtents.

type GetISCSIInitiatorsParams

type GetISCSIInitiatorsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetISCSIInitiatorsParams defines parameters for GetISCSIInitiators.

type GetISCSITargetExtentsParams

type GetISCSITargetExtentsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetISCSITargetExtentsParams defines parameters for GetISCSITargetExtents.

type GetISCSITargetsParams

type GetISCSITargetsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetISCSITargetsParams defines parameters for GetISCSITargets.

type GetPoolsParams

type GetPoolsParams struct {
	Limit  *int    `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int    `form:"offset,omitempty" json:"offset,omitempty"`
	Count  *bool   `form:"count,omitempty" json:"count,omitempty"`
	Sort   *string `form:"sort,omitempty" json:"sort,omitempty"`
}

GetPoolsParams defines parameters for GetPools.

type ISCSIExtent

type ISCSIExtent struct {
	Id             int     `json:"id"`
	Name           string  `json:"name"`
	Serial         string  `json:"serial"`
	Type           string  `json:"type"`
	Path           string  `json:"path"`
	Filesize       any     `json:"filesize"`
	Blocksize      uint64  `json:"blocksize"`
	PBlocksize     bool    `json:"pblocksize"`
	AvailThreshold *uint64 `json:"avail_threshold"`
	Comment        string  `json:"comment"`
	NAA            string  `json:"naa"`
	InsecureTPC    bool    `json:"insecure_tpc"`
	Xen            bool    `json:"xen"`
	RPM            string  `json:"rpm"`
	RO             bool    `json:"ro"`
	Enabled        bool    `json:"enabled"`
	Vendor         string  `json:"vendor"`
	Disk           string  `json:"disk"`
	Locked         bool    `json:"locked"`
}

ISCSIExtent defines model for ISCSIExtent.

{
  "id": 218,
  "name": "c28_disk_md4",
  "serial": "08002734c651217",
  "type": "DISK",
  "path": "zvol/osvcdata/c28_disk_md4",
  "filesize": "0",
  "blocksize": 512,
  "pblocksize": false,
  "avail_threshold": null,
  "comment": "",
  "naa": "0x6589cfc000000f487531b4688113d131",
  "insecure_tpc": true,
  "xen": false,
  "rpm": "SSD",
  "ro": false,
  "enabled": true,
  "vendor": "TrueNAS",
  "disk": "zvol/osvcdata/c28_disk_md4",
  "locked": false
}

type ISCSIExtents

type ISCSIExtents []ISCSIExtent

func (ISCSIExtents) GetById

func (t ISCSIExtents) GetById(s int) *ISCSIExtent

func (ISCSIExtents) GetByName

func (t ISCSIExtents) GetByName(name string) *ISCSIExtent

func (ISCSIExtents) GetByPath

func (t ISCSIExtents) GetByPath(s string) *ISCSIExtent

func (ISCSIExtents) WithPath

func (t ISCSIExtents) WithPath(s string) ISCSIExtents

func (ISCSIExtents) WithType

func (t ISCSIExtents) WithType(s string) ISCSIExtents

type ISCSIExtentsResponse

type ISCSIExtentsResponse = []ISCSIExtent

ISCSIExtentsResponse defines model for ISCSIExtentsResponse.

type ISCSIInitiator

type ISCSIInitiator struct {
	Id         int      `json:"id"`
	Initiators []string `json:"initiators"`
	Comment    string   `json:"comment"`
}

ISCSIInitiator defines model for ISCSIInitiator.

{
    "id": 40,
    "initiators": [
        "iqn.2009-11.com.opensvc.srv:qau22c13n3.storage.initiator"
    ],
    "auth_network": [],
    "comment": ""
}

type ISCSIInitiators

type ISCSIInitiators []ISCSIInitiator

func (ISCSIInitiators) GetById

func (t ISCSIInitiators) GetById(id int) (ISCSIInitiator, bool)

func (ISCSIInitiators) WithName

func (t ISCSIInitiators) WithName(s string) ISCSIInitiators

type ISCSIPortal

type ISCSIPortal struct {
	Id                  int                   `json:"id,omitempty"`
	Comment             string                `json:"comment,omitempty"`
	DiscoveryAuthMethod string                `json:"discovery_authmethod,omitempty"`
	DiscoveryAuthGroup  int                   `json:"discovery_authgroup,omitempty"`
	Listen              []ISCSIPortalListenIp `json:"listen"`
}

type ISCSIPortalListenIp

type ISCSIPortalListenIp struct {
	Ip   string `json:"ip"`
	Port int    `json:"port"`
}

type ISCSITarget

type ISCSITarget struct {
	Id     int               `json:"id"`
	Name   string            `json:"name"`
	Alias  *string           `json:"alias,omitempty"`
	Mode   string            `json:"mode"`
	Groups ISCSITargetGroups `json:"groups"`
}

ISCSITarget defines model for ISCSITarget.

{
 "id": 79,
 "name": "iqn.2009-11.com.opensvc.srv:qau20c26n3.storage.target.1",
 "alias": null,
 "mode": "ISCSI",
 "groups": [
  {
   "portal": 1,
   "initiator": 43,
   "auth": null,
   "authmethod": "NONE"
  }
 ]
},

type ISCSITargetExtent

type ISCSITargetExtent struct {
	Id       int `json:"id"`
	LunId    int `json:"lunid"`
	ExtentId int `json:"extent"`
	TargetId int `json:"target"`
}

ISCSITargetExtent defines model for ISCSITargetExtent.

 {
    "id": 1463,
    "lunid": 42,
    "extent": 211,
    "target": 76
}

type ISCSITargetExtents

type ISCSITargetExtents []ISCSITargetExtent

func (ISCSITargetExtents) WithExtent

func (t ISCSITargetExtents) WithExtent(extent ISCSIExtent) ISCSITargetExtents

func (ISCSITargetExtents) WithTarget

func (t ISCSITargetExtents) WithTarget(target ISCSITarget) ISCSITargetExtents

type ISCSITargetGroup

type ISCSITargetGroup struct {
	PortalId    int     `json:"portal"`
	InitiatorId int     `json:"initiator"`
	Auth        *string `json:"auth"`
	AuthMethod  string  `json:"authmethod"`
}

type ISCSITargetGroups

type ISCSITargetGroups []ISCSITargetGroup

type ISCSITargets

type ISCSITargets []ISCSITarget

func (ISCSITargets) GetById

func (t ISCSITargets) GetById(id int) (ISCSITarget, bool)

func (ISCSITargets) GetByName

func (t ISCSITargets) GetByName(name string) (ISCSITarget, bool)

func (ISCSITargets) WithName

func (t ISCSITargets) WithName(s string) ISCSITargets

type ISCSITargetsResponse

type ISCSITargetsResponse = []ISCSITarget

ISCSITargetsResponse defines model for ISCSITargetsResponse.

type MapDiskOptions

type MapDiskOptions struct {
	Name    string
	Mapping string
	LunId   *int
}

type Pool

type Pool struct {
	EncryptkeyPath *string `json:"encryptkey_path,omitempty"`
	Guid           *string `json:"guid,omitempty"`
	Healthy        *bool   `json:"healthy,omitempty"`
	Id             int     `json:"id"`
	IsDecrypted    *bool   `json:"is_decrypted,omitempty"`
	Name           string  `json:"name"`
	Path           string  `json:"path"`
	Status         *string `json:"status,omitempty"`
}

Pool defines model for Pool.

type PoolsResponse

type PoolsResponse = []Pool

PoolsResponse defines model for PoolsResponse.

type SystemInfo

type SystemInfo struct {
	Version              string     `json:"version"`                // "TrueNAS-13.0-U2"
	Hostname             string     `json:"hostname"`               //  "truenas.vdc.opensvc.com"
	PhysMem              uint64     `json:"physmem"`                // 4241022976
	Model                string     `json:"model"`                  // "Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz"
	Cores                uint       `json:"cores"`                  // 2
	Uptime               string     `json:"uptime"`                 // "4 days, 4:59:17.134670"
	UptimeSeconds        float64    `json:"uptime_seconds"`         // 363557.134669586
	SystemSerial         string     `json:"system_serial"`          // "0",
	SystemProduct        string     `json:"system_product"`         // "VirtualBox"
	SystemProductVersion string     `json:"system_product_version"` // "1.2"
	Timezone             string     `json:"timezone"`               // "Europe/Paris"
	SystemManufacturer   string     `json:"system_manufacturer"`    // "innotek GmbH"
	LoadAvg              [3]float64 `json:"loadavg"`                // [0.32470703125, 0.39111328125, 0.3564453125]

}

SystemInfo defines model for GetSystemInfo

type UnmapDiskOptions

type UnmapDiskOptions struct {
	Name    string
	Mapping string
}

type UpdateDatasetParams

type UpdateDatasetParams struct {
	Aclmode        *string `json:"aclmode,omitempty"`
	Atime          *string `json:"atime,omitempty"`
	Comments       *string `json:"comments,omitempty"`
	Compression    *string `json:"compression,omitempty"`
	Copies         *int    `json:"copies,omitempty"`
	Deduplication  *string `json:"deduplication,omitempty"`
	Exec           *string `json:"exec,omitempty"`
	ForceSize      *bool   `json:"force_size,omitempty"`
	Quota          *int64  `json:"quota,omitempty"`
	Readonly       *string `json:"readonly,omitempty"`
	Recordsize     *string `json:"recordsize,omitempty"`
	Refquota       *int64  `json:"refquota,omitempty"`
	Refreservation *int64  `json:"refreservation,omitempty"`
	Snapdir        *string `json:"snapdir,omitempty"`
	Sync           *string `json:"sync,omitempty"`
	Volsize        *int64  `json:"volsize,omitempty"`
}

UpdateDatasetParams defines model for UpdateDatasetParams.

type UpdateISCSITargetParams

type UpdateISCSITargetParams struct {
	Name   string            `json:"name"`
	Alias  string            `json:"alias,omitempty"`
	Mode   string            `json:"mode"`
	Groups ISCSITargetGroups `json:"groups,omitempty"`
}

UpdateISCSITargetParams defines model for UpdateISCSITargetParams.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL