forked from Telmate/proxmox-api-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add qemu guest pause and hibernate commands
- Loading branch information
1 parent
ee8e24d
commit 0815cb9
Showing
3 changed files
with
66 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_hibernateCmd = &cobra.Command{ | ||
Use: "hibernate GUESTID", | ||
Short: "Hibernates the speciefid guest", | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
vmr := proxmox.NewVmRef(cli.ValidateIntIDset(args, "GuestID")) | ||
c := cli.NewClient() | ||
_, err = c.HibernateVm(vmr) | ||
if err == nil { | ||
cli.PrintGuestStatus(qemuCmd.OutOrStdout(), vmr.VmId(), "suspended to disk") | ||
} | ||
return | ||
}, | ||
} | ||
|
||
func init() { | ||
qemuCmd.AddCommand(qemu_hibernateCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_pauseCmd = &cobra.Command{ | ||
Use: "pause GUESTID", | ||
Short: "Pauses the speciefid guest", | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
vmr := proxmox.NewVmRef(cli.ValidateIntIDset(args, "GuestID")) | ||
c := cli.NewClient() | ||
_, err = c.PauseVm(vmr) | ||
if err == nil { | ||
cli.PrintGuestStatus(qemuCmd.OutOrStdout(), vmr.VmId(), "paused") | ||
} | ||
return | ||
}, | ||
} | ||
|
||
func init() { | ||
qemuCmd.AddCommand(qemu_pauseCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters