Skip to content

Commit

Permalink
UpdateStatus was not sufficient for certain snapshot controller updates
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Henriksen <[email protected]>
  • Loading branch information
mhenriks committed Aug 17, 2020
1 parent c794ac0 commit ebde161
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pkg/virt-controller/watch/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ func (s *vmSnapshotSource) Lock() (bool, error) {
vmCopy.Status.SnapshotInProgress = &s.snapshot.Name
controller.AddFinalizer(vmCopy, sourceFinalizer)

_, err := s.client.VirtualMachine(vmCopy.Namespace).UpdateStatus(vmCopy)
_, err := s.client.VirtualMachine(vmCopy.Namespace).Update(vmCopy)
if err != nil {
return false, err
}
Expand All @@ -705,7 +705,7 @@ func (s *vmSnapshotSource) Unlock() error {
vmCopy.Status.SnapshotInProgress = nil
controller.RemoveFinalizer(vmCopy, sourceFinalizer)

_, err := s.client.VirtualMachine(vmCopy.Namespace).UpdateStatus(vmCopy)
_, err := s.client.VirtualMachine(vmCopy.Namespace).Update(vmCopy)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/virt-controller/watch/snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ var _ = Describe("Snapshot controlleer", func() {
updatedVM.Finalizers = []string{}
updatedVM.ResourceVersion = "1"
vmSource.Add(vm)
vmInterface.EXPECT().UpdateStatus(updatedVM).Return(updatedVM, nil)
vmInterface.EXPECT().Update(updatedVM).Return(updatedVM, nil)
addVirtualMachineSnapshot(vmSnapshot)
controller.processVMSnapshotWorkItem()
})
Expand Down Expand Up @@ -603,7 +603,7 @@ var _ = Describe("Snapshot controlleer", func() {
vmUpdate.Status.SnapshotInProgress = &vmSnapshotName

vmSource.Add(vm)
vmInterface.EXPECT().UpdateStatus(vmUpdate).Return(vmUpdate, nil)
vmInterface.EXPECT().Update(vmUpdate).Return(vmUpdate, nil)
addVirtualMachineSnapshot(vmSnapshot)
controller.processVMSnapshotWorkItem()
})
Expand All @@ -617,7 +617,7 @@ var _ = Describe("Snapshot controlleer", func() {
vmUpdate.Status.SnapshotInProgress = &vmSnapshotName

vmSnapshotSource.Add(vmSnapshot)
vmInterface.EXPECT().UpdateStatus(vmUpdate).Return(vmUpdate, nil)
vmInterface.EXPECT().Update(vmUpdate).Return(vmUpdate, nil)
addVM(vm)
controller.processVMSnapshotWorkItem()
})
Expand Down

0 comments on commit ebde161

Please sign in to comment.