spdk

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package jsonrpc implements a JSON-RPC 1.0 ClientCodec and ServerCodec for the rpc package. For JSON-RPC 2.0 support, see https://godoc.org/?q=json-rpc+2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	DefaultSpdkSocket         = "/var/tmp/spdk.sock"
	DefaultVhostUserStorePath = "/var/run/kata-containers/vhost-user/"
)
View Source
const VhostUserBlkMajor = 241

Variables

This section is empty.

Functions

func Dial

func Dial(network, address string) (*rpc.Client, error)

Dial connects to a JSON-RPC server at the specified network address.

func EnsureLVNameValid

func EnsureLVNameValid(name string) string

ensure logical volume name length not exceed 63

func GenerateDeviceTempBackingFile

func GenerateDeviceTempBackingFile(dev string) (string, error)

GenerateDeviceTempBackingFile creates and attaches a small file to a loop device and return the attached loop device.

func NewClient

func NewClient(conn io.ReadWriteCloser) *rpc.Client

NewClient returns a new rpc.Client to handle requests to the set of services at the other end of the connection.

func NewClientCodec

func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec

NewClientCodec returns a new rpc.ClientCodec using JSON-RPC on conn.

Types

type Bdev

type Bdev struct {
	Name             string                 `json:"name"`
	Aliases          []string               `json:"aliases"`
	UUID             string                 `json:"uuid"`
	NumBlocks        uint64                 `json:"num_blocks"`
	BlockSize        uint64                 `json:"block_size"`
	SupportedIoTypes map[string]bool        `json:"supported_io_types,omitempty"`
	DriverSpecific   map[string]interface{} `json:"driver_specific,omitempty"`
}

func (*Bdev) GetFilename

func (d *Bdev) GetFilename() string

func (*Bdev) GetLvstoreUuid

func (d *Bdev) GetLvstoreUuid() string

func (*Bdev) IsClone

func (d *Bdev) IsClone() bool

func (*Bdev) IsLogicalVolume

func (d *Bdev) IsLogicalVolume() bool

func (*Bdev) IsReadonly

func (d *Bdev) IsReadonly() bool

func (*Bdev) IsSnapshot

func (d *Bdev) IsSnapshot() bool

type Ctrlr

type Ctrlr struct {
	Name            string                 `json:"ctrlr"`
	BackendSpecific map[string]interface{} `json:"backend_specific"`
}

func (*Ctrlr) GetBdev

func (c *Ctrlr) GetBdev() string

type Lvol

type Lvol struct {
	Name     string
	UUID     string
	Total    uint64
	LvsUuid  string //lvstore uuid
	ReadOnly bool
	Snapshot bool
	Clone    bool
}

type Lvstore

type Lvstore struct {
	Uuid          string `json:"uuid"`
	Name          string `json:"name"`
	BaseBdev      string `json:"base_bdev"`
	TotalClusters uint64 `json:"total_data_clusters"`
	FreeClusters  uint64 `json:"free_clusters"`
	ClusterSize   uint64 `json:"cluster_size"`
}

type SpdkClient

type SpdkClient struct {
	// contains filtered or unexported fields
}

func NewSpdkClient

func NewSpdkClient(rpcSocket string) *SpdkClient

func (*SpdkClient) CleanBdev

func (client *SpdkClient) CleanBdev(name string) error

CleanBdev deletes a bdev or vbdev (LV) and the relative vhost device

func (*SpdkClient) CloneLV

func (client *SpdkClient) CloneLV(snapshotName, cloneName string) (string, error)

CloneLV creates a logical volume based on a snapshot

func (*SpdkClient) Connect

func (client *SpdkClient) Connect() (*rpc.Client, error)

func (*SpdkClient) CreateBdev

func (client *SpdkClient) CreateBdev(name, filename string) (string, error)

CreateBdev creates a bdev

func (*SpdkClient) CreateLV

func (client *SpdkClient) CreateLV(lvsName, lvName string, size uint64) (string, error)

CreateLV creates a new logical volume

func (*SpdkClient) CreateLvstore

func (client *SpdkClient) CreateLvstore(bdevName, lvsName string) (string, error)

CreateLvstore creates a logical volume store

func (*SpdkClient) CreateVhostDevice

func (client *SpdkClient) CreateVhostDevice(ctrlrName, bdevName string) (string, error)

CreateVhostDevice creates a vhost device

func (*SpdkClient) DeleteBdev

func (client *SpdkClient) DeleteBdev(name string) error

DeleteBdev deletes a bdev

func (*SpdkClient) DeleteLV

func (client *SpdkClient) DeleteLV(lvName string) error

DeleteLV deletes a logical volume

func (*SpdkClient) DeleteVhostDevice

func (client *SpdkClient) DeleteVhostDevice(name string) error

DeleteVhostDevice deletes a vhost device

func (*SpdkClient) FindVhostDevice

func (client *SpdkClient) FindVhostDevice(bdevName string) (string, error)

func (*SpdkClient) GetBdevs

func (client *SpdkClient) GetBdevs() (*[]Bdev, error)

GetBdevs gets SPDK block devices (include logical volumes)

func (*SpdkClient) GetLV

func (client *SpdkClient) GetLV(aliase string) (*[]Lvol, error)

GetLV gets logical volumes. Note: Just to keep compatible to lvmd. In fact, it only return one LV at most.

func (*SpdkClient) GetLvStores

func (client *SpdkClient) GetLvStores() (*[]Lvstore, error)

GetLvStores gets a list of logical volume stores

func (*SpdkClient) GetVhostControllers

func (client *SpdkClient) GetVhostControllers() (*[]Ctrlr, error)

func (*SpdkClient) MakeFs

func (client *SpdkClient) MakeFs(bdevName, fsType string) bool

func (*SpdkClient) RemoveLvstore

func (client *SpdkClient) RemoveLvstore(lvsName string) error

RemoveLvstore destroys a logical volume store

func (*SpdkClient) ResizeLV

func (client *SpdkClient) ResizeLV(lvName string, size uint64) error

ResizeLV resizes a logical volume

func (*SpdkClient) Snapshot

func (client *SpdkClient) Snapshot(lvolName, snapShotName string) (string, error)

Snapshot captures a snapshot of the current state of a logical volume

Jump to

Keyboard shortcuts

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