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

Function newStorageRestoreCmd

internal/cli/storage.go:700–729  ·  view source on GitHub ↗

── storage restore ───────────────────────────────────────────────────────────

()

Source from the content-addressed store, hash-verified

698// ── storage restore ───────────────────────────────────────────────────────────
699
700func newStorageRestoreCmd() *cobra.Command {
701 cmd := &cobra.Command{
702 Use: "restore <node> <storage> <volid> <vmid>",
703 Short: "Restore a guest from a backup",
704 Long: `Restore a guest from a vzdump backup volume.
705
706WARNING: This overwrites the target VMID's configuration and disk(s).
707
708Without --confirm, prints what would be restored and exits without making changes.
709The guest type is inferred from the volid prefix (vzdump-qemu-* or vzdump-lxc-*);
710use --type to override when inference fails.`,
711 Args: cobra.ExactArgs(4),
712 Example: ` # Dry-run preview (no changes made)
713 pvetui storage restore pve01 local local:backup/vzdump-qemu-100-2024.tar.zst 100
714
715 # Actually restore
716 pvetui storage restore pve01 local local:backup/vzdump-qemu-100-2024.tar.zst 100 --confirm
717 pvetui storage restore pve01 local local:backup/vzdump-lxc-101-2024.tar.zst 101 --confirm --type lxc`,
718 RunE: runStorageRestore,
719 }
720
721 cmd.Flags().Bool("confirm", false, "Actually perform the restore (required; without it a dry-run summary is printed)")
722 cmd.Flags().String("type", "", "Guest type override: qemu or lxc (inferred from volid when omitted)")
723 cmd.Flags().StringP("output", "o", "json", "Output format: json or table")
724 addNoWaitFlag(cmd)
725
726 cmd.ValidArgsFunction = completeStorageNames
727
728 return cmd
729}
730
731func runStorageRestore(cmd *cobra.Command, args []string) error {
732 ctx := context.Background()

Callers 1

newStorageCmdFunction · 0.85

Calls 2

addNoWaitFlagFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected