@Test public void testStateTransit() { final boolean result = volumeObject.stateTransit(Volume.Event.OperationFailed); Assert.assertFalse("since the volume doesnt exist in the db, the operation should fail but, should not throw any exception", result); }
@Override public boolean stateTransit(final Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if (volumeVO != null) { result = new StateMachine2Transitions(_volStateMachine).transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (final NoTransitionException e) { final String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; }
VolumeObject implements VolumeInfo { @Override public boolean stateTransit(final Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if (volumeVO != null) { result = new StateMachine2Transitions(_volStateMachine).transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (final NoTransitionException e) { final String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; } }
VolumeObject implements VolumeInfo { @Override public boolean stateTransit(final Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if (volumeVO != null) { result = new StateMachine2Transitions(_volStateMachine).transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (final NoTransitionException e) { final String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; } VolumeObject(); }
VolumeObject implements VolumeInfo { @Override public boolean stateTransit(final Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if (volumeVO != null) { result = new StateMachine2Transitions(_volStateMachine).transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (final NoTransitionException e) { final String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; } VolumeObject(); static VolumeObject getVolumeObject(final DataStore dataStore, final VolumeVO volumeVO); static VolumeObject getVolumeObject(final DataStore dataStore, final VolumeVO volumeVO, final boolean toBeLiveMigrated); void update(); @Override boolean isToBeLiveMigrated(); @Override boolean isAttachedVM(); @Override void addPayload(final Object data); @Override Object getpayload(); @Override HypervisorType getHypervisorType(); @Override Long getLastPoolId(); @Override DiskControllerType getDiskController(); @Override String getAttachedVmName(); @Override VirtualMachine getAttachedVM(); @Override void processEventOnly(final ObjectInDataStoreStateMachine.Event event); @Override void processEventOnly(final ObjectInDataStoreStateMachine.Event event, final Answer answer); @Override boolean stateTransit(final Volume.Event event); @Override Long getBytesReadRate(); @Override Long getBytesWriteRate(); @Override Long getIopsReadRate(); @Override Long getIopsWriteRate(); @Override Long getIopsTotalRate(); @Override Boolean getIopsRatePerGb(); @Override DiskCacheMode getCacheMode(); @Override long getId(); @Override String getUri(); @Override DataTO getTO(); @Override DataStore getDataStore(); @Override Long getSize(); void setSize(final Long size); @Override DataObjectType getType(); @Override String getUuid(); void setUuid(final String uuid); @Override boolean delete(); @Override void processEvent(final ObjectInDataStoreStateMachine.Event event); @Override void processEvent(final ObjectInDataStoreStateMachine.Event event, final Answer answer); long getVolumeId(); @Override void incRefCount(); @Override void decRefCount(); @Override Long getRefCount(); @Override String getName(); @Override Long getMinIops(); @Override Long getMaxIops(); @Override String get_iScsiName(); @Override Long getInstanceId(); @Override String getFolder(); @Override String getPath(); @Override Long getPodId(); @Override long getDataCenterId(); @Override VolumeType getVolumeType(); @Override Long getPoolId(); @Override Volume.State getState(); @Override Date getAttached(); @Override Long getDeviceId(); @Override Date getCreated(); @Override Long getDiskOfferingId(); @Override String getChainInfo(); @Override boolean isRecreatable(); @Override long getUpdatedCount(); @Override void incrUpdatedCount(); @Override Date getUpdated(); @Override String getReservationId(); @Override void setReservationId(final String reserv); @Override ImageFormat getFormat(); @Override StorageProvisioningType getProvisioningType(); @Override Long getVmSnapshotChainSize(); @Override Integer getHypervisorSnapshotReserve(); @Override boolean isDisplayVolume(); @Override boolean isDisplay(); @Override long getAccountId(); @Override long getDomainId(); @Override Long getTemplateId(); VolumeVO getVolume(); @Override Class<?> getEntityType(); }
VolumeObject implements VolumeInfo { @Override public boolean stateTransit(final Volume.Event event) { boolean result = false; try { volumeVO = volumeDao.findById(volumeVO.getId()); if (volumeVO != null) { result = new StateMachine2Transitions(_volStateMachine).transitTo(volumeVO, event, null, volumeDao); volumeVO = volumeDao.findById(volumeVO.getId()); } } catch (final NoTransitionException e) { final String errorMessage = "Failed to transit volume: " + getVolumeId() + ", due to: " + e.toString(); s_logger.debug(errorMessage); throw new CloudRuntimeException(errorMessage); } return result; } VolumeObject(); static VolumeObject getVolumeObject(final DataStore dataStore, final VolumeVO volumeVO); static VolumeObject getVolumeObject(final DataStore dataStore, final VolumeVO volumeVO, final boolean toBeLiveMigrated); void update(); @Override boolean isToBeLiveMigrated(); @Override boolean isAttachedVM(); @Override void addPayload(final Object data); @Override Object getpayload(); @Override HypervisorType getHypervisorType(); @Override Long getLastPoolId(); @Override DiskControllerType getDiskController(); @Override String getAttachedVmName(); @Override VirtualMachine getAttachedVM(); @Override void processEventOnly(final ObjectInDataStoreStateMachine.Event event); @Override void processEventOnly(final ObjectInDataStoreStateMachine.Event event, final Answer answer); @Override boolean stateTransit(final Volume.Event event); @Override Long getBytesReadRate(); @Override Long getBytesWriteRate(); @Override Long getIopsReadRate(); @Override Long getIopsWriteRate(); @Override Long getIopsTotalRate(); @Override Boolean getIopsRatePerGb(); @Override DiskCacheMode getCacheMode(); @Override long getId(); @Override String getUri(); @Override DataTO getTO(); @Override DataStore getDataStore(); @Override Long getSize(); void setSize(final Long size); @Override DataObjectType getType(); @Override String getUuid(); void setUuid(final String uuid); @Override boolean delete(); @Override void processEvent(final ObjectInDataStoreStateMachine.Event event); @Override void processEvent(final ObjectInDataStoreStateMachine.Event event, final Answer answer); long getVolumeId(); @Override void incRefCount(); @Override void decRefCount(); @Override Long getRefCount(); @Override String getName(); @Override Long getMinIops(); @Override Long getMaxIops(); @Override String get_iScsiName(); @Override Long getInstanceId(); @Override String getFolder(); @Override String getPath(); @Override Long getPodId(); @Override long getDataCenterId(); @Override VolumeType getVolumeType(); @Override Long getPoolId(); @Override Volume.State getState(); @Override Date getAttached(); @Override Long getDeviceId(); @Override Date getCreated(); @Override Long getDiskOfferingId(); @Override String getChainInfo(); @Override boolean isRecreatable(); @Override long getUpdatedCount(); @Override void incrUpdatedCount(); @Override Date getUpdated(); @Override String getReservationId(); @Override void setReservationId(final String reserv); @Override ImageFormat getFormat(); @Override StorageProvisioningType getProvisioningType(); @Override Long getVmSnapshotChainSize(); @Override Integer getHypervisorSnapshotReserve(); @Override boolean isDisplayVolume(); @Override boolean isDisplay(); @Override long getAccountId(); @Override long getDomainId(); @Override Long getTemplateId(); VolumeVO getVolume(); @Override Class<?> getEntityType();  }