@Override @Transactional(readOnly = true) public FusionstorPrimaryStorageVO call() { String sql = "select pri from FusionstorPrimaryStorageVO pri, ImageCacheVO c where pri.uuid = c.primaryStorageUuid" + " and c.imageUuid = :imgUuid"; TypedQuery<FusionstorPrimaryStorageVO> q = dbf.getEntityManager().createQuery(sql, FusionstorPrimaryStorageVO.class); q.setParameter("imgUuid", to.getImageUuid()); return q.getSingleResult(); } }.call();
@Override @Transactional(readOnly = true) public CephPrimaryStorageVO call() { String sql = "select pri from CephPrimaryStorageVO pri, ImageCacheVO c where pri.uuid = c.primaryStorageUuid" + " and c.imageUuid = :imgUuid and c.installUrl = :path"; TypedQuery<CephPrimaryStorageVO> q = dbf.getEntityManager().createQuery(sql, CephPrimaryStorageVO.class); q.setParameter("imgUuid", to.getImageUuid()); q.setParameter("path", to.getPath()); return q.getSingleResult(); } }.call();
private IsoTO convertIsoToCephIfNeeded(final IsoTO to) { if (to == null || !to.getPath().startsWith(VolumeTO.CEPH)) { return to;
private IsoTO convertIsoToFusionstorIfNeeded(final IsoTO to) { if (to == null || !to.getPath().startsWith(VolumeTO.FUSIONSTOR)) { return to;
private void attachIso(final AttachIsoOnHypervisorMsg msg, final NoErrorCompletion completion) { final AttachIsoOnHypervisorReply reply = new AttachIsoOnHypervisorReply(); IsoTO iso = new IsoTO(); iso.setImageUuid(msg.getIsoSpec().getImageUuid()); iso.setPath(msg.getIsoSpec().getInstallPath()); iso.setDeviceId(msg.getIsoSpec().getDeviceId()); AttachIsoCmd cmd = new AttachIsoCmd(); cmd.vmUuid = msg.getVmInstanceUuid(); cmd.iso = iso; KVMHostInventory inv = (KVMHostInventory) getSelfInventory(); for (KVMPreAttachIsoExtensionPoint ext : pluginRgty.getExtensionList(KVMPreAttachIsoExtensionPoint.class)) { ext.preAttachIsoExtensionPoint(inv, cmd); } new Http<>(attachIsoPath, cmd, AttachIsoRsp.class).call(new ReturnValueCompletion<AttachIsoRsp>(msg, completion) { @Override public void success(AttachIsoRsp ret) { if (!ret.isSuccess()) { reply.setError(operr("operation error, because:%s", ret.getError())); } bus.reply(msg, reply); completion.done(); } @Override public void fail(ErrorCode err) { reply.setError(err); bus.reply(msg, reply); completion.done(); } }); }