@@ -120,17 +120,17 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
120120
121121 folder , err := vmCtx .Session .Finder .FolderOrDefault (ctx , vmCtx .VSphereVM .Spec .Folder )
122122 if err != nil {
123- return errors .Wrapf (err , "unable to get folder for %q" , ctx )
123+ return errors .Wrapf (err , "unable to get folder for %q" , vmCtx )
124124 }
125125
126126 pool , err := vmCtx .Session .Finder .ResourcePoolOrDefault (ctx , vmCtx .VSphereVM .Spec .ResourcePool )
127127 if err != nil {
128- return errors .Wrapf (err , "unable to get resource pool for %q" , ctx )
128+ return errors .Wrapf (err , "unable to get resource pool for %q" , vmCtx )
129129 }
130130
131131 devices , err := tpl .Device (ctx )
132132 if err != nil {
133- return errors .Wrapf (err , "error getting devices for %q" , ctx )
133+ return errors .Wrapf (err , "error getting devices for %q" , vmCtx )
134134 }
135135
136136 // Create a new list of device specs for cloning the VM.
@@ -140,14 +140,14 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
140140 if snapshotRef == nil {
141141 diskSpecs , err := getDiskSpec (vmCtx , devices )
142142 if err != nil {
143- return errors .Wrapf (err , "error getting disk spec for %q" , ctx )
143+ return errors .Wrapf (err , "error getting disk spec for %q" , vmCtx )
144144 }
145145 deviceSpecs = append (deviceSpecs , diskSpecs ... )
146146 }
147147
148148 networkSpecs , err := getNetworkSpecs (ctx , vmCtx , devices )
149149 if err != nil {
150- return errors .Wrapf (err , "error getting network specs for %q" , ctx )
150+ return errors .Wrapf (err , "error getting network specs for %q" , vmCtx )
151151 }
152152
153153 deviceSpecs = append (deviceSpecs , networkSpecs ... )
@@ -207,7 +207,7 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
207207 if vmCtx .VSphereVM .Spec .Datastore != "" {
208208 datastore , err := vmCtx .Session .Finder .Datastore (ctx , vmCtx .VSphereVM .Spec .Datastore )
209209 if err != nil {
210- return errors .Wrapf (err , "unable to get datastore %s for %q" , vmCtx .VSphereVM .Spec .Datastore , ctx )
210+ return errors .Wrapf (err , "unable to get datastore %s for %q" , vmCtx .VSphereVM .Spec .Datastore , vmCtx )
211211 }
212212 datastoreRef = types .NewReference (datastore .Reference ())
213213 spec .Location .Datastore = datastoreRef
@@ -217,12 +217,12 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
217217 if vmCtx .VSphereVM .Spec .StoragePolicyName != "" {
218218 pbmClient , err := pbm .NewClient (ctx , vmCtx .Session .Client .Client )
219219 if err != nil {
220- return errors .Wrapf (err , "unable to create pbm client for %q" , ctx )
220+ return errors .Wrapf (err , "unable to create pbm client for %q" , vmCtx )
221221 }
222222
223223 storageProfileID , err = pbmClient .ProfileIDByName (ctx , vmCtx .VSphereVM .Spec .StoragePolicyName )
224224 if err != nil {
225- return errors .Wrapf (err , "unable to get storageProfileID from name %s for %q" , vmCtx .VSphereVM .Spec .StoragePolicyName , ctx )
225+ return errors .Wrapf (err , "unable to get storageProfileID from name %s for %q" , vmCtx .VSphereVM .Spec .StoragePolicyName , vmCtx )
226226 }
227227
228228 var hubs []pbmTypes.PbmPlacementHub
@@ -279,7 +279,7 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
279279 // if no datastore defined through VM spec or storage policy, use default
280280 datastore , err := vmCtx .Session .Finder .DefaultDatastore (ctx )
281281 if err != nil {
282- return errors .Wrapf (err , "unable to get default datastore for %q" , ctx )
282+ return errors .Wrapf (err , "unable to get default datastore for %q" , vmCtx )
283283 }
284284 datastoreRef = types .NewReference (datastore .Reference ())
285285 }
@@ -292,7 +292,7 @@ func Clone(ctx context.Context, vmCtx *capvcontext.VMContext, bootstrapData []by
292292 log .Info (fmt .Sprintf ("Cloning Machine with clone mode %s" , vmCtx .VSphereVM .Status .CloneMode ))
293293 task , err := tpl .Clone (ctx , folder , vmCtx .VSphereVM .Name , spec )
294294 if err != nil {
295- return errors .Wrapf (err , "error trigging clone op for machine %s" , ctx )
295+ return errors .Wrapf (err , "error trigging clone op for machine %s" , vmCtx )
296296 }
297297
298298 vmCtx .VSphereVM .Status .TaskRef = task .Reference ().Value
@@ -415,11 +415,11 @@ func getNetworkSpecs(ctx context.Context, vmCtx *capvcontext.VMContext, devices
415415 }
416416 backing , err := ref .EthernetCardBackingInfo (ctx )
417417 if err != nil {
418- return nil , errors .Wrapf (err , "unable to create new ethernet card backing info for network %q on %q" , netSpec .NetworkName , ctx )
418+ return nil , errors .Wrapf (err , "unable to create new ethernet card backing info for network %q on %q" , netSpec .NetworkName , vmCtx )
419419 }
420420 dev , err := object .EthernetCardTypes ().CreateEthernetCard (ethCardType , backing )
421421 if err != nil {
422- return nil , errors .Wrapf (err , "unable to create new ethernet card %q for network %q on %q" , ethCardType , netSpec .NetworkName , ctx )
422+ return nil , errors .Wrapf (err , "unable to create new ethernet card %q for network %q on %q" , ethCardType , netSpec .NetworkName , vmCtx )
423423 }
424424
425425 // Get the actual NIC object. This is safe to assert without a check
0 commit comments