@Test public void testSuccessfulDelete() throws Throwable { doNothing().when(vmBackend).detachIso(vm); command.execute(); InOrder inOrder = inOrder(hostClient, vmBackend); inOrder.verify(hostClient).detachISO(vm.getId(), true); inOrder.verify(vmBackend).detachIso(vm); verifyNoMoreInteractions(hostClient, vmBackend); }
@Override protected void execute() throws ApiFeException, InterruptedException, RpcException { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); checkArgument(entityList.size() == 1, "There should be only 1 vm referenced by step %s", step.getId()); VmEntity vmEntity = entityList.get(0); try { detachIsoOp(vmEntity); vmBackend.detachIso(vmEntity); } catch (IsoNotAttachedException ex) { if (!vmBackend.isosAttached(vmEntity).isEmpty()) { vmBackend.detachIso(vmEntity); logger.warn("Database Iso record cleaned up, " + "Iso is not attached to vm: {}", vmEntity.getId()); return; } throw new NoIsoAttachedException(vmEntity.getId()); } }
IsoDetachStepCmd extends StepCommand { @Override protected void execute() throws ApiFeException, InterruptedException, RpcException { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); checkArgument(entityList.size() == 1, "There should be only 1 vm referenced by step %s", step.getId()); VmEntity vmEntity = entityList.get(0); try { detachIsoOp(vmEntity); vmBackend.detachIso(vmEntity); } catch (IsoNotAttachedException ex) { if (!vmBackend.isosAttached(vmEntity).isEmpty()) { vmBackend.detachIso(vmEntity); logger.warn("Database Iso record cleaned up, " + "Iso is not attached to vm: {}", vmEntity.getId()); return; } throw new NoIsoAttachedException(vmEntity.getId()); } } }
IsoDetachStepCmd extends StepCommand { @Override protected void execute() throws ApiFeException, InterruptedException, RpcException { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); checkArgument(entityList.size() == 1, "There should be only 1 vm referenced by step %s", step.getId()); VmEntity vmEntity = entityList.get(0); try { detachIsoOp(vmEntity); vmBackend.detachIso(vmEntity); } catch (IsoNotAttachedException ex) { if (!vmBackend.isosAttached(vmEntity).isEmpty()) { vmBackend.detachIso(vmEntity); logger.warn("Database Iso record cleaned up, " + "Iso is not attached to vm: {}", vmEntity.getId()); return; } throw new NoIsoAttachedException(vmEntity.getId()); } } IsoDetachStepCmd(TaskCommand taskCommand, StepBackend stepBackend, StepEntity step,
                          VmBackend vmBackend); }
IsoDetachStepCmd extends StepCommand { @Override protected void execute() throws ApiFeException, InterruptedException, RpcException { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); checkArgument(entityList.size() == 1, "There should be only 1 vm referenced by step %s", step.getId()); VmEntity vmEntity = entityList.get(0); try { detachIsoOp(vmEntity); vmBackend.detachIso(vmEntity); } catch (IsoNotAttachedException ex) { if (!vmBackend.isosAttached(vmEntity).isEmpty()) { vmBackend.detachIso(vmEntity); logger.warn("Database Iso record cleaned up, " + "Iso is not attached to vm: {}", vmEntity.getId()); return; } throw new NoIsoAttachedException(vmEntity.getId()); } } IsoDetachStepCmd(TaskCommand taskCommand, StepBackend stepBackend, StepEntity step,
                          VmBackend vmBackend);  }
IsoDetachStepCmd extends StepCommand { @Override protected void execute() throws ApiFeException, InterruptedException, RpcException { List<VmEntity> entityList = step.getTransientResourceEntities(Vm.KIND); checkArgument(entityList.size() == 1, "There should be only 1 vm referenced by step %s", step.getId()); VmEntity vmEntity = entityList.get(0); try { detachIsoOp(vmEntity); vmBackend.detachIso(vmEntity); } catch (IsoNotAttachedException ex) { if (!vmBackend.isosAttached(vmEntity).isEmpty()) { vmBackend.detachIso(vmEntity); logger.warn("Database Iso record cleaned up, " + "Iso is not attached to vm: {}", vmEntity.getId()); return; } throw new NoIsoAttachedException(vmEntity.getId()); } } IsoDetachStepCmd(TaskCommand taskCommand, StepBackend stepBackend, StepEntity step,
                          VmBackend vmBackend);   }