MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / buildOCIStorageVolume

Function buildOCIStorageVolume

pkg/mockpve/state.go:1164–1185  ·  view source on GitHub ↗
(node, storage, reference, filename string)

Source from the content-addressed store, hash-verified

1162}
1163
1164func buildOCIStorageVolume(node, storage, reference, filename string) *MockStorageVolume {
1165 filename = strings.TrimSpace(filename)
1166 if filename == "" {
1167 filename = normalizeStorageFilename(strings.NewReplacer("/", "_", ":", "_", "@", "_").Replace(reference))
1168 }
1169 if !strings.Contains(filename, ".") {
1170 filename += ".oci"
1171 }
1172
1173 size := int64(350 * 1024 * 1024)
1174 return &MockStorageVolume{
1175 VolID: fmt.Sprintf("%s:import/%s", storage, filename),
1176 Node: node,
1177 Storage: storage,
1178 Content: contentImport,
1179 Format: "oci",
1180 Size: size,
1181 Used: size,
1182 CreatedAt: time.Now().Unix(),
1183 Notes: reference,
1184 }
1185}
1186
1187func normalizeStorageFilename(filename string) string {
1188 filename = strings.TrimSpace(filename)

Callers 1

Calls 1

normalizeStorageFilenameFunction · 0.85

Tested by

no test coverage detected