@Override public void fail(ErrorCode errorCode) { if (errorCode.getDetails().contains("java.net.SocketTimeoutException: Read timed out")) { // socket read timeout is caused by timeout of mounting a wrong URL errorCode = touterr(errorCode, "mount timeout. Please the check if the URL[%s] is" + " valid to mount", inv.getUrl()); } completion.fail(errorCode); } });
@Override public IncreasePrimaryStorageCapacityMsg call(VolumeSpec arg) { if (arg.isVolumeCreated()) { // don't return capacity as it has been returned when the volume is deleted return null; } IncreasePrimaryStorageCapacityMsg msg = new IncreasePrimaryStorageCapacityMsg(); msg.setDiskSize(arg.getSize()); msg.setPrimaryStorageUuid(arg.getPrimaryStorageInventory().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, arg.getPrimaryStorageInventory().getUrl()); return msg; } });
@Override public IncreasePrimaryStorageCapacityMsg call(VolumeSpec arg) { if (arg.isVolumeCreated()) { // don't return capacity as it has been returned when the volume is deleted return null; } IncreasePrimaryStorageCapacityMsg msg = new IncreasePrimaryStorageCapacityMsg(); msg.setDiskSize(arg.getSize()); msg.setPrimaryStorageUuid(arg.getPrimaryStorageInventory().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, arg.getPrimaryStorageInventory().getUrl()); return msg; } });
private void mount(PrimaryStorageInventory inv, String hostUuid, Completion completion) { MountCmd cmd = new MountCmd(); cmd.setUrl(inv.getUrl()); cmd.setMountPath(inv.getMountPath()); cmd.setOptions(NfsSystemTags.MOUNT_OPTIONS.getTokenByResourceUuid(inv.getUuid(), NfsSystemTags.MOUNT_OPTIONS_TOKEN)); syncHttpCall(MOUNT_PRIMARY_STORAGE_PATH, hostUuid, cmd, true, MountAgentResponse.class, inv, new ReturnValueCompletion<MountAgentResponse>(completion) { @Override public void success(MountAgentResponse returnValue) { logger.debug(String.format( "Successfully mounted nfs primary storage[uuid:%s] on kvm host[uuid:%s]", inv.getUuid(), hostUuid)); completion.success(); } @Override public void fail(ErrorCode errorCode) { if (errorCode.getDetails().contains("java.net.SocketTimeoutException: Read timed out")) { // socket read timeout is caused by timeout of mounting a wrong URL errorCode = touterr(errorCode, "mount timeout. Please the check if the URL[%s] is" + " valid to mount", inv.getUrl()); } completion.fail(errorCode); } }); }
new While<>(huuids).all((hostUuid, compl) -> { RemountCmd cmd = new RemountCmd(); cmd.url = pinv.getUrl(); cmd.mountPath = pinv.getMountPath(); cmd.options = NfsSystemTags.MOUNT_OPTIONS.getTokenByResourceUuid(pinv.getUuid(), NfsSystemTags.MOUNT_OPTIONS_TOKEN);
private void unmount(PrimaryStorageInventory inv, String hostUuid) { UnmountCmd cmd = new UnmountCmd(); cmd.setUuid(inv.getUuid()); cmd.setMountPath(inv.getMountPath()); cmd.setUrl(inv.getUrl()); KVMHostSyncHttpCallMsg msg = new KVMHostSyncHttpCallMsg(); msg.setCommand(cmd); msg.setPath(UNMOUNT_PRIMARY_STORAGE_PATH); msg.setHostUuid(hostUuid); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, hostUuid); MessageReply reply = bus.call(msg); if (!reply.isSuccess()) { throw new OperationFailureException(reply.getError()); } AgentResponse rsp = ((KVMHostSyncHttpCallReply) reply).toResponse(AgentResponse.class); if (!rsp.isSuccess()) { String err = String.format("Unable to unmount nfs primary storage[uuid:%s] on kvm host[uuid:%s], because %s", inv.getUuid(), hostUuid, rsp.getError()); logger.warn(err); } else { String info = String.format("Successfully unmount nfs primary storage[uuid:%s] on kvm host[uuid:%s]", inv.getUuid(), hostUuid); logger.debug(info); nfsFactory.updateNfsHostStatus(inv.getUuid(), hostUuid, PrimaryStorageHostStatus.Disconnected); } }
cmd.setUuid(psInv.getUuid()); cmd.mountPath = psInv.getMountPath(); cmd.url = psInv.getUrl();
cmd.url = dstPsInv.getUrl(); cmd.mountPath = dstPsInv.getMountPath();
cmd.setSshPort(r.getSshPort()); cmd.setUsername(r.getUsername()); cmd.storagePath = pinv.getUrl();
cmd.setBackupStorageInstallPath(backupStorageInstallPath); cmd.setPrimaryStorageInstallPath(primaryStorageInstallPath); cmd.storagePath = pinv.getUrl();