public static String makeTemplateFromVolumeInWorkspacePath(PrimaryStorageInventory pinv, String imageUuid) { return PathUtil.join(pinv.getMountPath(), "templateWorkspace", String.format("image-%s", imageUuid), String.format("%s.qcow2", imageUuid)); }
public static String makeSnapshotWorkspacePath(PrimaryStorageInventory pinv, String imageUuid) { return PathUtil.join( pinv.getMountPath(), PrimaryStoragePathMaker.makeImageFromSnapshotWorkspacePath(imageUuid), String.format("%s.qcow2", imageUuid) ); }
public static String makeDataVolumeInstallUrl(PrimaryStorageInventory pinv, String volUuid) { return PathUtil.join(pinv.getMountPath(), PrimaryStoragePathMaker.makeDataVolumeInstallPath(volUuid)); }
public static String makeCachedImageInstallUrl(PrimaryStorageInventory pinv, ImageInventory iminv) { return PathUtil.join(pinv.getMountPath(), PrimaryStoragePathMaker.makeCachedImageInstallPath(iminv)); }
public static String makeRootVolumeInstallUrl(PrimaryStorageInventory pinv, VolumeInventory vol) { return PathUtil.join(pinv.getMountPath(), PrimaryStoragePathMaker.makeRootVolumeInstallPath(vol)); }
public static String getCachedImageDir(PrimaryStorageInventory pinv){ return PathUtil.join(pinv.getMountPath(), PrimaryStoragePathMaker.getCachedImageInstallDir()); }
public static String makeCachedImageInstallUrlFromImageUuidForTemplate(PrimaryStorageInventory pinv, String imageUuid) { return PathUtil.join(pinv.getMountPath(), PrimaryStoragePathMaker.makeCachedImageInstallPathFromImageUuidForTemplate(imageUuid)); }
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); } }); }
RemountCmd cmd = new RemountCmd(); cmd.url = pinv.getUrl(); cmd.mountPath = pinv.getMountPath(); cmd.options = NfsSystemTags.MOUNT_OPTIONS.getTokenByResourceUuid(pinv.getUuid(), NfsSystemTags.MOUNT_OPTIONS_TOKEN);
cmd.setMountPath(inv.getMountPath()); cmd.setUuid(inv.getUuid());
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); } }
PingCmd cmd = new PingCmd(); cmd.setUuid(psInv.getUuid()); cmd.mountPath = psInv.getMountPath(); cmd.url = psInv.getUrl();
cmd.options = NfsSystemTags.MOUNT_OPTIONS.getTokenByResourceUuid(dstPsInv.getUuid(), NfsSystemTags.MOUNT_OPTIONS_TOKEN); cmd.url = dstPsInv.getUrl(); cmd.mountPath = dstPsInv.getMountPath();