@Override public void success() { DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); completion.success(reply); }
@Override public void fail(ErrorCode errorCode) { DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); reply.setError(errorCode); bus.reply(msg, reply); } });
@Override protected void handle(DeleteSnapshotOnPrimaryStorageMsg msg) { DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); reply.setSuccess(true); bus.reply(msg, reply); }
@Override public void fail(ErrorCode errorCode) { reply.setError(errorCode); bus.reply(msg, reply); } });
@Override void handle(final DeleteSnapshotOnPrimaryStorageMsg msg, final String hostUuid, final ReturnValueCompletion<DeleteSnapshotOnPrimaryStorageReply> completion) { final DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); deleteBits(msg.getSnapshot().getPrimaryStorageInstallPath(), hostUuid, new Completion(completion) { @Override public void success() { completion.success(reply); } @Override public void fail(ErrorCode errorCode) { completion.fail(errorCode); } }); }
@Override protected void handle(final DeleteSnapshotOnPrimaryStorageMsg msg) { final DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); DeleteSnapshotCmd cmd = new DeleteSnapshotCmd(); cmd.snapshotPath = msg.getSnapshot().getPrimaryStorageInstallPath(); httpCall(DELETE_SNAPSHOT_PATH, cmd, DeleteSnapshotRsp.class, new ReturnValueCompletion<DeleteSnapshotRsp>(msg) { @Override public void success(DeleteSnapshotRsp returnValue) { bus.reply(msg, reply); } @Override public void fail(ErrorCode errorCode) { reply.setError(errorCode); bus.reply(msg, reply); } }); }
@Override protected void handle(final DeleteSnapshotOnPrimaryStorageMsg msg) { final DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); DeleteSnapshotCmd cmd = new DeleteSnapshotCmd(); cmd.snapshotPath = msg.getSnapshot().getPrimaryStorageInstallPath(); httpCall(DELETE_SNAPSHOT_PATH, cmd, DeleteSnapshotRsp.class, new ReturnValueCompletion<DeleteSnapshotRsp>(msg) { @Override public void success(DeleteSnapshotRsp returnValue) { bus.reply(msg, reply); } @Override public void fail(ErrorCode errorCode) { reply.setError(errorCode); bus.reply(msg, reply); } }, TimeUnit.MILLISECONDS, msg.getTimeout()); }
@Override protected void handle(final DeleteSnapshotOnPrimaryStorageMsg msg) { final DeleteSnapshotOnPrimaryStorageReply reply = new DeleteSnapshotOnPrimaryStorageReply(); final VolumeSnapshotInventory sinv = msg.getSnapshot(); final NfsPrimaryStorageBackend bkd = getBackend(nfsMgr.findHypervisorTypeByImageFormatAndPrimaryStorageUuid(sinv.getFormat(), self.getUuid())); bkd.delete(getSelfInventory(), sinv.getPrimaryStorageInstallPath(), new Completion(msg) { @Override public void success() { bus.reply(msg, reply); } @Override public void fail(ErrorCode errorCode) { NfsDeleteVolumeSnapshotGC gc = new NfsDeleteVolumeSnapshotGC(); gc.NAME = String.format("gc-nfs-%s-snapshot-%s", self.getUuid(), sinv.getUuid()); gc.snapshot = sinv; gc.primaryStorageUuid = self.getUuid(); gc.hypervisorType = bkd.getHypervisorType().toString(); gc.submit(NfsPrimaryStorageGlobalConfig.GC_INTERVAL.value(Long.class), TimeUnit.SECONDS); N.New(PrimaryStorageVO.class, self.getUuid()).warn_("NFS primary storage[uuid:%s] failed to delete a volume snapshot[uuid:%s], %s. A GC" + " job[uuid:%s] is scheduled to cleanup it in the interval of %s seconds", self.getUuid(), sinv.getUuid(), errorCode, NfsPrimaryStorageGlobalConfig.GC_INTERVAL.value(Long.class)); bus.reply(msg, reply); } }); }