storageVolume

package
v0.4.0-dev Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestPrecondition

func RequestPrecondition[RequestStructure utils.RequestStructure](
	httpRequest *http.Request,
	expectedRequestMethod string,
	structure *RequestStructure,
	applicationName string,
	jwtSigningMethod *jwt.SigningMethodHMAC,
	jwtSignatureKey []byte,
) (virest.Connection, virest.Error, bool)

Validate user request using given bearer token which is generated JWT by ViRest Utilities 'auth.BasicAuth()' module. Look up hypervisor URI on 'Hypervisor-Uri' request header field. Connect to hypervisor via SSH tunnel and check the expected HTTP request method then convert the JSON request body to structure if any. SSH tunnel work with Key-Based authentication. Please, create SSH Key on the host and copy it on the remote libvirt-daemon host

~/.ssh/authorized_keys

Notes for HTTP GET method:

- Query parameter and structure field will be compared in case sensitive.

- Every structure field data type must be string, so You must convert it to the right data type before You use it.

- Untested for array query argument.

Notes for HTTP POST, PUT, PATCH and DELETE method:

- This function always looking for request body for data and parse them to 'structure' parameter.

func VolumeCreate

func VolumeCreate(connection virest.Connection, poolUuid string, xmlConfig libvirtxml.StorageVolume, option uint) (volumeCreate.Key, virest.Error, bool)

Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes.

Option:

  • 1 = (0x1; 1 << 0) : Prealloc metadata in flags can be used to get higher performance with qcow2 image files which don't support full preallocation, by creating a sparse image file with metadata.

  • 2 = (0x2; 1 << 1) : perform a btrfs lightweight copy.

  • 4 = (0x4; 1 << 2) : Validate the XML document against schema.

func VolumeDelete

func VolumeDelete(connection virest.Connection, poolUuid, volumeName string, option uint) (virest.Error, bool)

func VolumeListAll

func VolumeListAll(connection virest.Connection, poolUuid string) ([]volumeListAll.Data, virest.Error, bool)

Collect the list of all storage volumes inside a pool. The physical on disk usage can be different than the calculated allocation value as is the case with qcow2 files.

Storage Volume Type:

  • 0 = (0x0) : Regular file based volumes

  • 1 = (0x1) : Block based volumes

  • 2 = (0x2) : Directory-passthrough based volume

  • 3 = (0x3) : Network volumes like RBD (RADOS Block Device)

  • 4 = (0x4) : Network accessible directory that can contain other network volumes

  • 5 = (0x5) : Ploop based volumes

  • 6 = (0x6)

Types

This section is empty.

Jump to

Keyboard shortcuts

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