cmd

package
v0.9.280 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DumpCmd = &cobra.Command{
	Use:   "kata",
	Short: "Dump a kata vm or container (w/o rootfs)",
	Long:  "Dump a kata vm or container (w/o rootfs). Provide a vm type for vm snapshots. For container c/r, cedana agent will need to be deployed w/ the running sandbox VM.",
	RunE: func(cmd *cobra.Command, args []string) error {
		req, ok := cmd.Context().Value(keys.DUMP_REQ_CONTEXT_KEY).(*daemon.DumpVMReq)
		if !ok {
			return fmt.Errorf("invalid dump request in context")
		}

		dir, _ := cmd.Flags().GetString(kata_flags.DirFlag.Full)
		port, _ := cmd.Flags().GetUint32(kata_flags.PortFlag.Full)
		vmType, _ := cmd.Flags().GetString(kata_flags.VmTypeFlag.Full)
		vmSocket, _ := cmd.Flags().GetString(kata_flags.VmSocketFlag.Full)
		vmID, _ := cmd.Flags().GetString(kata_flags.VmIDFlag.Full)

		req.Type = vmType
		req.Details = &daemon.Details{Kata: &kata.Kata{
			Dir:      dir,
			Port:     port,
			VmType:   vmType,
			VmSocket: vmSocket,
			VmID:     vmID,
		}}

		if dir != "" {
			req.Dir = dir
		}

		ctx := context.WithValue(cmd.Context(), keys.DUMP_REQ_CONTEXT_KEY, req)
		cmd.SetContext(ctx)

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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