private List<NativeZfsSupport> getAvailableNativeZfsSupports() { List<NativeZfsSupport> nativeZfsSupports = new ArrayList<NativeZfsSupport>(); if (NativeZfsSupport.all() != null && !NativeZfsSupport.all().isEmpty()) { for (Descriptor<NativeZfsSupport> nativeZfsSupport : NativeZfsSupport.all()) { try { nativeZfsSupports.add(nativeZfsSupport.newInstance(null, null)); } catch (Throwable exc) { logger.info("Failed to instantiate Native Zfs Support - " + nativeZfsSupport.getDisplayName()); } } } return nativeZfsSupports; }
/** * Create ZFS File System corresponding to the mount name * * @param mountPoint * @return ZFS File System if created successfully * @throws hudson.util.jna.Native.NativeExecutionException */ public NativeZfsFileSystem createZfs(String mountName) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.createZfs(mountName); }
/** * Get the error associated with the last Native Unix Operation * * @return String error message */ public String getLastZfsError() { if (!hasZfsSupport()) { return "Native Unix Support plugin not installed"; } return nativeZfsSupport.getLastError(); } }
/** * Open the target ZFS File System * * @param mountPoint * @return ZFS File System if opened successfully * @throws hudson.util.jna.Native.NativeExecutionException */ public NativeZfsFileSystem openZfs(String target) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.openZfs(target); }
/** * Check if the named ZFS exists * * @param zfsName * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public boolean zfsExists(String zfsName) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.zfsExists(zfsName); }
/** * Fetch the list of mounted ZFS roots * * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public List<NativeZfsFileSystem> getZfsRoots() throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.getZfsRoots(); }
/** * Find the ZFS File System by its mount point * * @return * @throws hudson.util.jna.Native.NativeExecutionException */ public NativeZfsFileSystem getZfsByMountPoint(File mountPoint) throws NativeAccessException { ensureZfsSupport(NativeFunction.ZFS); return nativeZfsSupport.getZfsByMountPoint(mountPoint); }
private void ensureZfsSupport(NativeFunction function) throws NativeAccessException { if (!hasZfsSupport()) { throw new NativeAccessException("Native ZFS Support plugin not installed"); } if (!nativeZfsSupport.hasSupportFor(function)) { throw new NativeAccessException("Installed Native ZFS Support plugin does not support " + function); } }