Skip to content

Commit 04913a4

Browse files
committed
fix unused aurgument
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent e2a6450 commit 04913a4

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

server/src/main/java/com/cloud/ha/HighAvailabilityManagerImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ protected Long restart(final HaWorkVO work) {
578578
logger.info("Unable to find vm: " + vmId);
579579
return null;
580580
}
581-
if (checkAndCancelWorkIfNeeded(work, vm)) {
581+
if (checkAndCancelWorkIfNeeded(work)) {
582582
return null;
583583
}
584584

@@ -782,7 +782,7 @@ protected Long restart(final HaWorkVO work) {
782782
return (System.currentTimeMillis() >> 10) + _restartRetryInterval;
783783
}
784784

785-
protected boolean checkAndCancelWorkIfNeeded(final HaWorkVO work, final VirtualMachine vm) {
785+
protected boolean checkAndCancelWorkIfNeeded(final HaWorkVO work) {
786786
if (!Step.Investigating.equals(work.getStep())) {
787787
return false;
788788
}
@@ -809,7 +809,7 @@ public Long migrate(final HaWorkVO work) {
809809
logger.info("Unable to find vm: " + vmId + ", skipping migrate.");
810810
return null;
811811
}
812-
if (checkAndCancelWorkIfNeeded(work, vm)) {
812+
if (checkAndCancelWorkIfNeeded(work)) {
813813
return null;
814814
}
815815
logger.info("Migration attempt: for VM {}from host {}. Starting attempt: {}/{} times.", vm, srcHost, 1 + work.getTimesTried(), _maxRetries);
@@ -878,7 +878,7 @@ protected Long destroyVM(final HaWorkVO work) {
878878
logger.info("No longer can find VM " + work.getInstanceId() + ". Throwing away " + work);
879879
return null;
880880
}
881-
if (checkAndCancelWorkIfNeeded(work, vm)) {
881+
if (checkAndCancelWorkIfNeeded(work)) {
882882
return null;
883883
}
884884
boolean expunge = VirtualMachine.Type.SecondaryStorageVm.equals(vm.getType())
@@ -915,7 +915,7 @@ protected Long stopVM(final HaWorkVO work) throws ConcurrentOperationException {
915915
work.setStep(Step.Done);
916916
return null;
917917
}
918-
if (checkAndCancelWorkIfNeeded(work, vm)) {
918+
if (checkAndCancelWorkIfNeeded(work)) {
919919
return null;
920920
}
921921
logger.info("Stopping " + vm);

server/src/test/java/com/cloud/ha/HighAvailabilityManagerImplTest.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ public class HighAvailabilityManagerImplTest {
137137

138138
@Mock
139139
private HaWorkVO mockWork;
140-
@Mock
141-
private VirtualMachine mockVm;
142140

143141
HighAvailabilityManagerImpl highAvailabilityManager;
144142
HighAvailabilityManagerImpl highAvailabilityManagerSpy;
@@ -438,15 +436,15 @@ public void testCheckAndCancelWorkIfNeeded_Success() {
438436
Mockito.when(mockWork.getHostId()).thenReturn(1L);
439437
Mockito.doReturn(Status.Up).when(highAvailabilityManagerSpy).investigate(1L);
440438
Mockito.doNothing().when(mockWork).setStep(Step.Cancelled);
441-
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork, mockVm);
439+
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork);
442440
assertTrue(result);
443441
Mockito.verify(mockWork).setStep(Step.Cancelled);
444442
}
445443

446444
@Test
447445
public void testCheckAndCancelWorkIfNeeded_StepNotInvestigating() {
448446
Mockito.when(mockWork.getStep()).thenReturn(Step.Cancelled);
449-
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork, mockVm);
447+
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork);
450448
assertFalse(result);
451449
Mockito.verify(mockWork, Mockito.never()).setStep(Mockito.any());
452450
}
@@ -455,7 +453,7 @@ public void testCheckAndCancelWorkIfNeeded_StepNotInvestigating() {
455453
public void testCheckAndCancelWorkIfNeeded_InvalidReasonType() {
456454
Mockito.when(mockWork.getStep()).thenReturn(Step.Investigating);
457455
Mockito.when(mockWork.getReasonType()).thenReturn(HighAvailabilityManager.ReasonType.Unknown);
458-
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork, mockVm);
456+
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork);
459457
assertFalse(result);
460458
Mockito.verify(mockWork, Mockito.never()).setStep(Mockito.any());
461459
}
@@ -466,7 +464,7 @@ public void testCheckAndCancelWorkIfNeeded_HostStatusNotUp() {
466464
Mockito.when(mockWork.getReasonType()).thenReturn(HighAvailabilityManager.ReasonType.HostDown);
467465
Mockito.when(mockWork.getHostId()).thenReturn(1L);
468466
Mockito.doReturn(Status.Down).when(highAvailabilityManagerSpy).investigate(1L);
469-
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork, mockVm);
467+
boolean result = highAvailabilityManagerSpy.checkAndCancelWorkIfNeeded(mockWork);
470468
assertFalse(result);
471469
Mockito.verify(mockWork, Mockito.never()).setStep(Mockito.any());
472470
}

0 commit comments

Comments
 (0)