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

Function newGuestsMigrateCmd

internal/cli/guests.go:1183–1211  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1181}
1182
1183func newGuestsMigrateCmd() *cobra.Command {
1184 cmd := &cobra.Command{
1185 Use: "migrate <vmid> <target-node>",
1186 Short: "Migrate a guest to another node",
1187 Long: `Migrate a VM or LXC container to another node in the same cluster.
1188
1189Migration mode is selected automatically:
1190 - QEMU running → online migration
1191 - QEMU stopped → offline migration
1192 - LXC → restart migration`,
1193 Example: ` # Migrate guest 100 to pve02 (auto mode)
1194 pvetui guests migrate 100 pve02
1195
1196 # Force offline migration for a running QEMU VM
1197 pvetui guests migrate 100 pve02 --offline
1198
1199 # Return UPID immediately
1200 pvetui guests migrate 100 pve02 --no-wait`,
1201 Args: cobra.ExactArgs(2),
1202 RunE: runGuestsMigrate,
1203 ValidArgsFunction: completeVMIDs,
1204 }
1205
1206 cmd.Flags().Bool("online", false, "Force online migration (QEMU only)")
1207 cmd.Flags().Bool("offline", false, "Force offline migration (QEMU only)")
1208 addNoWaitFlag(cmd)
1209
1210 return cmd
1211}
1212
1213func runGuestsMigrate(cmd *cobra.Command, args []string) error {
1214 vmid, err := parseVMID(args[0])

Callers 1

newGuestsCmdFunction · 0.85

Calls 1

addNoWaitFlagFunction · 0.85

Tested by

no test coverage detected