Search in sources :

Example 1 with NfsStoragePool

use of com.cloud.agent.resource.kvm.ha.KvmHaBase.NfsStoragePool in project cosmic by MissionCriticalCloud.

the class LibvirtComputingResourceTest method testFenceCommand.

@Test
public void testFenceCommand() {
    final VirtualMachine vm = Mockito.mock(VirtualMachine.class);
    final Host host = Mockito.mock(Host.class);
    final FenceCommand command = new FenceCommand(vm, host);
    final KvmHaMonitor monitor = Mockito.mock(KvmHaMonitor.class);
    final NfsStoragePool storagePool = Mockito.mock(NfsStoragePool.class);
    final List<NfsStoragePool> pools = new ArrayList<>();
    pools.add(storagePool);
    when(this.libvirtComputingResource.getMonitor()).thenReturn(monitor);
    when(monitor.getStoragePools()).thenReturn(pools);
    final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
    assertNotNull(wrapper);
    final Answer answer = wrapper.execute(command, this.libvirtComputingResource);
    assertFalse(answer.getResult());
    verify(this.libvirtComputingResource, times(1)).getMonitor();
    verify(monitor, times(1)).getStoragePools();
}
Also used : Answer(com.cloud.legacymodel.communication.answer.Answer) CheckRouterAnswer(com.cloud.legacymodel.communication.answer.CheckRouterAnswer) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) FenceCommand(com.cloud.legacymodel.communication.command.FenceCommand) LibvirtRequestWrapper(com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper) NfsStoragePool(com.cloud.agent.resource.kvm.ha.KvmHaBase.NfsStoragePool) ArrayList(java.util.ArrayList) Host(com.cloud.legacymodel.dc.Host) KvmHaMonitor(com.cloud.agent.resource.kvm.ha.KvmHaMonitor) VirtualMachine(com.cloud.legacymodel.vm.VirtualMachine) Test(org.junit.Test)

Aggregations

NfsStoragePool (com.cloud.agent.resource.kvm.ha.KvmHaBase.NfsStoragePool)1 KvmHaMonitor (com.cloud.agent.resource.kvm.ha.KvmHaMonitor)1 LibvirtRequestWrapper (com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper)1 Answer (com.cloud.legacymodel.communication.answer.Answer)1 AttachAnswer (com.cloud.legacymodel.communication.answer.AttachAnswer)1 CheckRouterAnswer (com.cloud.legacymodel.communication.answer.CheckRouterAnswer)1 FenceCommand (com.cloud.legacymodel.communication.command.FenceCommand)1 Host (com.cloud.legacymodel.dc.Host)1 VirtualMachine (com.cloud.legacymodel.vm.VirtualMachine)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1