diff --git a/cmd/pvecsictl/migrate.go b/cmd/pvecsictl/migrate.go index 152a2c1..8e27391 100644 --- a/cmd/pvecsictl/migrate.go +++ b/cmd/pvecsictl/migrate.go @@ -65,7 +65,7 @@ func setMigrateCmdFlags(cmd *cobra.Command) { flags.StringP("namespace", "n", "", "namespace of the persistentvolumeclaims") flags.BoolP("force", "f", false, "force migration even if the persistentvolumeclaims is in use") - flags.Int("timeout", 3600, "task timeout in seconds") + flags.Int("timeout", 7200, "task timeout in seconds") } // nolint: cyclop, gocyclo diff --git a/cmd/pvecsictl/utils.go b/cmd/pvecsictl/utils.go index 36d4e4a..e5ba530 100644 --- a/cmd/pvecsictl/utils.go +++ b/cmd/pvecsictl/utils.go @@ -114,6 +114,9 @@ func renamePVC( newPVC.ObjectMeta.UID = "" newPVC.ObjectMeta.ResourceVersion = "" newPVC.Status = corev1.PersistentVolumeClaimStatus{} + newPVC.Spec.Resources.Requests = corev1.ResourceList{ + corev1.ResourceStorage: pvc.Status.Capacity[corev1.ResourceStorage], + } patch := []byte(`{"spec":{"persistentVolumeReclaimPolicy":"` + corev1.PersistentVolumeReclaimRetain + `"}}`) diff --git a/pkg/proxmox/volume.go b/pkg/proxmox/volume.go index ae285bd..e07e53e 100644 --- a/pkg/proxmox/volume.go +++ b/pkg/proxmox/volume.go @@ -90,7 +90,17 @@ func MoveQemuDisk(cluster *pxapi.Client, vol *volume.Volume, node string, taskTi return fmt.Errorf("failed to parse response: %v", err) } - if _, err := cluster.WaitForCompletion(taskResponse); err != nil { + for i := 0; i < 3; i++ { + if _, err = cluster.WaitForCompletion(taskResponse); err != nil { + time.Sleep(2 * time.Second) + + continue + } + + break + } + + if err != nil { return fmt.Errorf("failed to wait for task completion: %v", err) }