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

Function runStorageContentDelete

internal/cli/storage.go:373–423  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

371}
372
373func runStorageContentDelete(cmd *cobra.Command, args []string) error {
374 ctx := context.Background()
375 nodeName := args[0]
376 storageName := args[1]
377 volID := args[2]
378
379 session, err := initCLISession(cmd)
380 if err != nil {
381 return printError(err)
382 }
383
384 if session == nil {
385 return nil
386 }
387
388 client, err := session.clientForNode(ctx, nodeName)
389 if err != nil {
390 return printError(err)
391 }
392
393 upid, err := client.DeleteStorageContent(nodeName, storageName, volID)
394 if err != nil {
395 return printError(fmt.Errorf("failed to delete content: %w", err))
396 }
397
398 out := storageTaskOutput{
399 Node: nodeName,
400 Storage: storageName,
401 VolID: volID,
402 UPID: upid,
403 Status: "running",
404 }
405
406 if getNoWait(cmd) {
407 return printJSON(out)
408 }
409
410 exitStatus, waitErr := waitForTask(ctx, client, nodeName, upid, "delete content")
411 out.Status = "complete"
412 out.ExitStatus = exitStatus
413
414 if err := printJSON(out); err != nil {
415 return err
416 }
417
418 if waitErr != nil {
419 return waitErr
420 }
421
422 return nil
423}
424
425// ── storage download ──────────────────────────────────────────────────────────
426

Callers

nothing calls this directly

Calls 7

initCLISessionFunction · 0.85
printErrorFunction · 0.85
getNoWaitFunction · 0.85
printJSONFunction · 0.85
waitForTaskFunction · 0.85
clientForNodeMethod · 0.80
DeleteStorageContentMethod · 0.80

Tested by

no test coverage detected