diff --git a/cli/command/commands/commands.go b/cli/command/commands/commands.go index 569704d1..57bbfa18 100644 --- a/cli/command/commands/commands.go +++ b/cli/command/commands/commands.go @@ -7,6 +7,7 @@ import ( _ "github.com/Telmate/proxmox-api-go/cli/command/get" _ "github.com/Telmate/proxmox-api-go/cli/command/get/id" _ "github.com/Telmate/proxmox-api-go/cli/command/guest" + _ "github.com/Telmate/proxmox-api-go/cli/command/guest/qemu" _ "github.com/Telmate/proxmox-api-go/cli/command/list" _ "github.com/Telmate/proxmox-api-go/cli/command/set" _ "github.com/Telmate/proxmox-api-go/cli/command/update" diff --git a/cli/command/guest/qemu/guest-qemu-reset.go b/cli/command/guest/qemu/guest-qemu-reset.go new file mode 100644 index 00000000..192cd5b3 --- /dev/null +++ b/cli/command/guest/qemu/guest-qemu-reset.go @@ -0,0 +1,25 @@ +package qemu + +import ( + "github.com/Telmate/proxmox-api-go/cli" + "github.com/Telmate/proxmox-api-go/proxmox" + "github.com/spf13/cobra" +) + +var qemu_resetCmd = &cobra.Command{ + Use: "reset GUESTID", + Short: "Resets the speciefid guest", + RunE: func(cmd *cobra.Command, args []string) (err error) { + vmr := proxmox.NewVmRef(cli.ValidateIntIDset(args, "GuestID")) + c := cli.NewClient() + _, err = c.StartVm(vmr) + if err == nil { + cli.PrintGuestStatus(qemuCmd.OutOrStdout(), vmr.VmId(), "reset") + } + return + }, +} + +func init() { + qemuCmd.AddCommand(qemu_resetCmd) +} diff --git a/cli/command/guest/qemu/guest-qemu-resume.go b/cli/command/guest/qemu/guest-qemu-resume.go new file mode 100644 index 00000000..5bca51ff --- /dev/null +++ b/cli/command/guest/qemu/guest-qemu-resume.go @@ -0,0 +1,25 @@ +package qemu + +import ( + "github.com/Telmate/proxmox-api-go/cli" + "github.com/Telmate/proxmox-api-go/proxmox" + "github.com/spf13/cobra" +) + +var qemu_resumeCmd = &cobra.Command{ + Use: "resume GUESTID", + Short: "Resumes the speciefid guest", + RunE: func(cmd *cobra.Command, args []string) (err error) { + vmr := proxmox.NewVmRef(cli.ValidateIntIDset(args, "GuestID")) + c := cli.NewClient() + _, err = c.ResumeVm(vmr) + if err == nil { + cli.PrintGuestStatus(qemuCmd.OutOrStdout(), vmr.VmId(), "resumed") + } + return + }, +} + +func init() { + qemuCmd.AddCommand(qemu_resumeCmd) +} diff --git a/cli/command/guest/qemu/guest-qemu.go b/cli/command/guest/qemu/guest-qemu.go new file mode 100644 index 00000000..dafc2779 --- /dev/null +++ b/cli/command/guest/qemu/guest-qemu.go @@ -0,0 +1,15 @@ +package qemu + +import ( + "github.com/Telmate/proxmox-api-go/cli/command/guest" + "github.com/spf13/cobra" +) + +var qemuCmd = &cobra.Command{ + Use: "qemu", + Short: "Commands to interact with the qemu guests on Proxmox", +} + +func init() { + guest.GuestCmd.AddCommand(qemuCmd) +}