@Override public void entityLifeCycleEvent(EntityEvent evt, Object o) { VolumeSnapshotVO s = (VolumeSnapshotVO) o; String info = String.format("[VolumeSnapshot:Create][name=%s, uuid=%s]: %s", s.getName(), s.getUuid(), s.getSize()); logger.debug(info); loggerd.debug(info); printCallTrace(); } });
private ErrorCode isOperationAllowed(Message msg) { if (allowedStatus.isOperationAllowed(msg.getClass().getName(), currentRoot.getStatus().toString())) { return null; } else { return err(VolumeSnapshotErrors.NOT_IN_CORRECT_STATE, "snapshot[uuid:%s, name:%s]'s status[%s] is not allowed for message[%s], allowed status%s", currentRoot.getUuid(), currentRoot.getName(), currentRoot.getStatus(), msg.getClass().getName(), allowedStatus.getStatesForOperation(msg.getClass().getName())); } }
private void refreshVO() { VolumeSnapshotVO vo = dbf.reload(currentRoot); if (vo == null) { throw new OperationFailureException(operr("cannot find volume snapshot[uuid:%s, name:%s], it may have been deleted by previous operation", currentRoot.getUuid(), currentRoot.getName())); } currentRoot = vo; buildFullSnapshotTree(); currentLeaf = fullTree.findSnapshot(new Function<Boolean, VolumeSnapshotInventory>() { @Override public Boolean call(VolumeSnapshotInventory arg) { return arg.getUuid().equals(currentRoot.getUuid()); } }); }
throw new CloudRuntimeException( String.format("cannot find reference of snapshot[uuid:%s, name:%s] on the local storage[uuid:%s, name:%s]", vo.getUuid(), vo.getName(), self.getUuid(), self.getName()));
public static VolumeSnapshotInventory valueOf(VolumeSnapshotVO vo) { VolumeSnapshotInventory inv = new VolumeSnapshotInventory(); inv.setName(vo.getName()); inv.setCreateDate(vo.getCreateDate()); inv.setDescription(vo.getDescription()); inv.setLastOpDate(vo.getLastOpDate()); inv.setParentUuid(vo.getParentUuid()); inv.setState(vo.getState().toString()); inv.setType(vo.getType()); inv.setVolumeUuid(vo.getVolumeUuid()); inv.setFormat(vo.getFormat()); inv.setUuid(vo.getUuid()); inv.setStatus(vo.getStatus().toString()); inv.setPrimaryStorageUuid(vo.getPrimaryStorageUuid()); inv.setPrimaryStorageInstallPath(vo.getPrimaryStorageInstallPath()); inv.setLatest(vo.isLatest()); inv.setSize(vo.getSize()); inv.setVolumeType(vo.getVolumeType()); inv.setTreeUuid(vo.getTreeUuid()); inv.setBackupStorageRefs(VolumeSnapshotBackupStorageRefInventory.valueOf(vo.getBackupStorageRefs())); return inv; }