Skip to content

Commit

Permalink
fix: cli migration
Browse files Browse the repository at this point in the history
Use current pv size for creating new one.

Signed-off-by: Serge Logvinov <[email protected]>
  • Loading branch information
sergelogvinov committed Mar 10, 2024
1 parent 1810ec7 commit 41b19bd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/pvecsictl/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions cmd/pvecsictl/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 + `"}}`)

Expand Down
12 changes: 11 additions & 1 deletion pkg/proxmox/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 41b19bd

Please sign in to comment.