@@ -82,12 +82,12 @@ func (c *Controller) ReconcileVM(vm *v1.VirtualMachine) error {
8282 }
8383
8484 // Check if VM exists; if not, create it
85- if vm .Status . CloudStackID == "" {
85+ if vm .CloudStackID == "" {
8686 if id , err := handlers .ApplyVirtualMachineManaged (vm , true ); err != nil {
8787 return err
8888 } else {
8989 if id != "" {
90- vm .Status . CloudStackID = id
90+ vm .CloudStackID = id
9191 db .DB .Save (vm )
9292 }
9393 }
@@ -112,8 +112,8 @@ func (c *Controller) ReconcileVM(vm *v1.VirtualMachine) error {
112112func (c * Controller ) populateObservedSpec (vm * v1.VirtualMachine ) error {
113113 // Use SDK to list by id or name
114114 lp := c .csClient .VirtualMachine .NewListVirtualMachinesParams ()
115- if vm .Status . CloudStackID != "" {
116- lp .SetId (vm .Status . CloudStackID )
115+ if vm .CloudStackID != "" {
116+ lp .SetId (vm .CloudStackID )
117117 } else {
118118 lp .SetName (vm .Metadata .Name )
119119 }
@@ -128,9 +128,9 @@ func (c *Controller) populateObservedSpec(vm *v1.VirtualMachine) error {
128128
129129 v := resp .VirtualMachines [0 ]
130130
131- // if vm.Status. CloudStackID is not set, set it from the observed VM
132- if vm .Status . CloudStackID == "" && v .Id != "" {
133- vm .Status . CloudStackID = v .Id
131+ // if vm.CloudStackID is not set, set it from the observed VM
132+ if vm .CloudStackID == "" && v .Id != "" {
133+ vm .CloudStackID = v .Id
134134 }
135135
136136 // Map some observed fields into ObservedSpec using SDK types directly
@@ -194,9 +194,9 @@ func (c *Controller) populateObservedSpec(vm *v1.VirtualMachine) error {
194194 }
195195
196196 // Volumes: list volumes attached to the VM if we have CloudStack ID
197- if vm .Status . CloudStackID != "" {
197+ if vm .CloudStackID != "" {
198198 vp := c .csClient .Volume .NewListVolumesParams ()
199- vp .SetVirtualmachineid (vm .Status . CloudStackID )
199+ vp .SetVirtualmachineid (vm .CloudStackID )
200200 volResp , verr := c .csClient .Volume .ListVolumes (vp )
201201 if verr == nil && volResp != nil && len (volResp .Volumes ) > 0 {
202202 obs .Volumes = []v1.VolumeSpec {}
@@ -280,7 +280,7 @@ func (c *Controller) createComponentVMs(comp *v1.Component, compRef v1.Component
280280 return err
281281 } else {
282282 if id != "" {
283- vm .Status . CloudStackID = id
283+ vm .CloudStackID = id
284284 db .DB .Save (vm )
285285 }
286286 }
0 commit comments