private boolean shouldBeActive() { if(!System.getProperty("os.name").equals("SunOS") || disabled) // on systems that don't have ZFS, we don't need this monitor return false; try { LibZFS zfs = new LibZFS(); List<ZFSFileSystem> roots = zfs.roots(); if(roots.isEmpty()) return false; // no active ZFS pool // if we don't run on a ZFS file system, activate ZFSFileSystem hudsonZfs = zfs.getFileSystemByMountPoint(Jenkins.getInstance().getRootDir()); if(hudsonZfs!=null) return false; // already on ZFS // decide what file system we'll create ZFSFileSystem pool = roots.get(0); prospectiveZfsFileSystemName = computeHudsonFileSystemName(zfs,pool); return true; } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to detect whether Hudson is on ZFS",e); return false; } catch (LinkageError e) { LOGGER.info("No ZFS available. If you believe this is an error, increase the logging level to get the stack trace"); LOGGER.log(Level.FINE,"Stack trace of failed ZFS load",e); return false; } }
String name = computeHudsonFileSystemName(zfs, zfs.roots().get(0)); out.println("Creating "+name); ZFSFileSystem hudson = zfs.create(name, ZFSFileSystem.class);
public List<ZFSFileSystem> children() { return roots(); }
public List<ZFSFileSystem> children() { return roots(); }
public <T extends ZFSObject> List<T> children(Class<T> type) { if(type.isAssignableFrom(ZFSFileSystem.class)) return (List)roots(); else return Collections.emptyList(); }
public <T extends ZFSObject> List<T> children(Class<T> type) { if(type.isAssignableFrom(ZFSFileSystem.class)) return (List)roots(); else return Collections.emptyList(); }
@Override public List<NativeZfsFileSystem> getZfsRoots() throws NativeAccessException { List<NativeZfsFileSystem> zfsRoots = new ArrayList<NativeZfsFileSystem>(); List<ZFSFileSystem> roots = zfs.roots(); for (ZFSFileSystem fs : roots) { zfsRoots.add(new ZfsFileSystemImpl(fs)); } return zfsRoots; }
public <T extends ZFSObject> List<T> descendants(Class<T> type) { ArrayList<T> r = new ArrayList<T>(); r.addAll(children(type)); for (ZFSFileSystem p : roots()) r.addAll(p.descendants(type)); return r; }
public <T extends ZFSObject> List<T> descendants(Class<T> type) { ArrayList<T> r = new ArrayList<T>(); r.addAll(children(type)); for (ZFSFileSystem p : roots()) r.addAll(p.descendants(type)); return r; }
public static void main(String[] args) { LibZFS zfs = new LibZFS(); for (ZFSFileSystem fs : zfs.roots()) { System.out.println(fs.getName()); for (ZFSFileSystem c : fs.children(ZFSFileSystem.class)) { System.out.println(c.getName()); } } } }
private boolean shouldBeActive() { if(!System.getProperty("os.name").equals("SunOS") || disabled) // on systems that don't have ZFS, we don't need this monitor return false; try { LibZFS zfs = new LibZFS(); List<ZFSFileSystem> roots = zfs.roots(); if(roots.isEmpty()) return false; // no active ZFS pool // if we don't run on a ZFS file system, activate ZFSFileSystem hudsonZfs = zfs.getFileSystemByMountPoint(Hudson.getInstance().getRootDir()); if(hudsonZfs!=null) return false; // already on ZFS // decide what file system we'll create ZFSFileSystem pool = roots.get(0); prospectiveZfsFileSystemName = computeHudsonFileSystemName(zfs,pool); return true; } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to detect whether Hudson is on ZFS",e); return false; } catch (LinkageError e) { LOGGER.info("No ZFS available. If you believe this is an error, increase the logging level to get the stack trace"); LOGGER.log(Level.FINE,"Stack trace of failed ZFS load",e); return false; } }
private boolean shouldBeActive() { if(!System.getProperty("os.name").equals("SunOS") || disabled) // on systems that don't have ZFS, we don't need this monitor return false; try { LibZFS zfs = new LibZFS(); List<ZFSFileSystem> roots = zfs.roots(); if(roots.isEmpty()) return false; // no active ZFS pool // if we don't run on a ZFS file system, activate ZFSFileSystem hudsonZfs = zfs.getFileSystemByMountPoint(Jenkins.getInstance().getRootDir()); if(hudsonZfs!=null) return false; // already on ZFS // decide what file system we'll create ZFSFileSystem pool = roots.get(0); prospectiveZfsFileSystemName = computeHudsonFileSystemName(zfs,pool); return true; } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to detect whether Hudson is on ZFS",e); return false; } catch (LinkageError e) { LOGGER.info("No ZFS available. If you believe this is an error, increase the logging level to get the stack trace"); LOGGER.log(Level.FINE,"Stack trace of failed ZFS load",e); return false; } }
private boolean shouldBeActive() { if(!System.getProperty("os.name").equals("SunOS") || disabled) // on systems that don't have ZFS, we don't need this monitor return false; try { LibZFS zfs = new LibZFS(); List<ZFSFileSystem> roots = zfs.roots(); if(roots.isEmpty()) return false; // no active ZFS pool // if we don't run on a ZFS file system, activate ZFSFileSystem hudsonZfs = zfs.getFileSystemByMountPoint(Hudson.getInstance().getRootDir()); if(hudsonZfs!=null) return false; // already on ZFS // decide what file system we'll create ZFSFileSystem pool = roots.get(0); prospectiveZfsFileSystemName = computeHudsonFileSystemName(zfs,pool); return true; } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to detect whether Hudson is on ZFS",e); return false; } catch (LinkageError e) { LOGGER.info("No ZFS available. If you believe this is an error, increase the logging level to get the stack trace"); LOGGER.log(Level.FINE,"Stack trace of failed ZFS load",e); return false; } }
String name = computeHudsonFileSystemName(zfs, zfs.roots().get(0)); out.println("Creating "+name); ZFSFileSystem hudson = zfs.create(name, ZFSFileSystem.class);
String name = computeHudsonFileSystemName(zfs, zfs.roots().get(0)); out.println("Creating "+name); ZFSFileSystem hudson = zfs.create(name, ZFSFileSystem.class);
String name = computeHudsonFileSystemName(zfs, zfs.roots().get(0)); out.println("Creating "+name); ZFSFileSystem hudson = zfs.create(name, ZFSFileSystem.class);