Skip to content

Commit 6c7ba29

Browse files
authored
Merge pull request #962 from yastij/automated-cherry-pick-of-#946-upstream-release-0.6
Automated cherry pick of #946: re-apply the conccurent clones fix
2 parents 548cbca + 9e4f8a4 commit 6c7ba29

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

controllers/vspherevm_controller.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -332,13 +332,6 @@ func (r vmReconciler) reconcileNormal(ctx *context.VMContext) (reconcile.Result,
332332
return reconcile.Result{}, errors.Errorf("bios uuid is empty while VM is ready")
333333
}
334334

335-
// patch the vsphereVM early to ensure that the task is
336-
// reflected in the status right away, this avoid situations
337-
// of concurrent clones
338-
if err := ctx.Patch(); err != nil {
339-
ctx.Logger.Error(err, "patch failed", "vspherevm", ctx.VSphereVM)
340-
}
341-
342335
// Update the VSphereVM's network status.
343336
r.reconcileNetwork(ctx, vm)
344337

pkg/services/govmomi/vcenter/clone.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,12 @@ func Clone(ctx *context.VMContext, bootstrapData []byte) error {
182182

183183
ctx.VSphereVM.Status.TaskRef = task.Reference().Value
184184

185+
// patch the vsphereVM early to ensure that the task is
186+
// reflected in the status right away, this avoid situations
187+
// of concurrent clones
188+
if err := ctx.Patch(); err != nil {
189+
ctx.Logger.Error(err, "patch failed", "vspherevm", ctx.VSphereVM)
190+
}
185191
return nil
186192
}
187193

0 commit comments

Comments
 (0)