MCPcopy
hub / github.com/lxc/incus / VolumeTypeToDBType

Function VolumeTypeToDBType

internal/server/storage/utils.go:99–112  ·  view source on GitHub ↗

VolumeTypeToDBType converts volume type to internal volume type DB code.

(volType drivers.VolumeType)

Source from the content-addressed store, hash-verified

97
98// VolumeTypeToDBType converts volume type to internal volume type DB code.
99func VolumeTypeToDBType(volType drivers.VolumeType) (int, error) {
100 switch volType {
101 case drivers.VolumeTypeContainer:
102 return db.StoragePoolVolumeTypeContainer, nil
103 case drivers.VolumeTypeVM:
104 return db.StoragePoolVolumeTypeVM, nil
105 case drivers.VolumeTypeImage:
106 return db.StoragePoolVolumeTypeImage, nil
107 case drivers.VolumeTypeCustom:
108 return db.StoragePoolVolumeTypeCustom, nil
109 }
110
111 return -1, fmt.Errorf("Invalid storage volume type: %q", volType)
112}
113
114// VolumeDBTypeToType converts internal volume type DB code to storage driver volume type.
115func VolumeDBTypeToType(volDBType int) (drivers.VolumeType, error) {

Callers 12

VolumeDBGetFunction · 0.85
VolumeDBCreateFunction · 0.85
VolumeDBDeleteFunction · 0.85
VolumeDBSnapshotsGetFunction · 0.85
RenameInstanceMethod · 0.85
UpdateInstanceMethod · 0.85
qcow2MigrateVolumeMethod · 0.85
volIDFuncMakeFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…