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
Copyright 2022 Intel Corporation ¶
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.
Copyright 2022 Intel Corporation ¶
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
- func Dial(network, address string) (*rpc.Client, error)
- func EnsureLVNameValid(name string) string
- func GenerateDeviceTempBackingFile(dev string) (string, error)
- func NewClient(conn io.ReadWriteCloser) *rpc.Client
- func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
- type Bdev
- type Ctrlr
- type Lvol
- type Lvstore
- type SpdkClient
- func (client *SpdkClient) CleanBdev(name string) error
- func (client *SpdkClient) CloneLV(snapshotName, cloneName string) (string, error)
- func (client *SpdkClient) Connect() (*rpc.Client, error)
- func (client *SpdkClient) CreateBdev(name, filename string) (string, error)
- func (client *SpdkClient) CreateLV(lvsName, lvName string, size uint64) (string, error)
- func (client *SpdkClient) CreateLvstore(bdevName, lvsName string) (string, error)
- func (client *SpdkClient) CreateVhostDevice(ctrlrName, bdevName string) (string, error)
- func (client *SpdkClient) DeleteBdev(name string) error
- func (client *SpdkClient) DeleteLV(lvName string) error
- func (client *SpdkClient) DeleteVhostDevice(name string) error
- func (client *SpdkClient) FindVhostDevice(bdevName string) (string, error)
- func (client *SpdkClient) GetBdevs() (*[]Bdev, error)
- func (client *SpdkClient) GetLV(aliase string) (*[]Lvol, error)
- func (client *SpdkClient) GetLvStores() (*[]Lvstore, error)
- func (client *SpdkClient) GetVhostControllers() (*[]Ctrlr, error)
- func (client *SpdkClient) MakeFs(bdevName, fsType string) bool
- func (client *SpdkClient) RemoveLvstore(lvsName string) error
- func (client *SpdkClient) ResizeLV(lvName string, size uint64) error
- func (client *SpdkClient) Snapshot(lvolName, snapShotName string) (string, error)
Constants ¶
const ( DefaultSpdkSocket = "/var/tmp/spdk.sock" DefaultVhostUserStorePath = "/var/run/kata-containers/vhost-user/" )
const VhostUserBlkMajor = 241
Variables ¶
This section is empty.
Functions ¶
func EnsureLVNameValid ¶
ensure logical volume name length not exceed 63
func GenerateDeviceTempBackingFile ¶
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 (*Bdev) GetLvstoreUuid ¶
func (*Bdev) IsLogicalVolume ¶
func (*Bdev) IsReadonly ¶
func (*Bdev) IsSnapshot ¶
type Ctrlr ¶
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) 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