@Override public String invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return fs.getName(); // TODO: for now, only support agents that are already on ZFS. throw new IOException("Not on ZFS"); } }
@Override public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) fs.destory(true); return null; } }
@Override public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return null; // already on ZFS // nope. create a file system String fullName = rootDataset + '/' + name; listener.getLogger().println("Creating a ZFS file system "+fullName+" at "+f); fs = libzfs.create(fullName, ZFSFileSystem.class); fs.setMountPoint(f); fs.mount(); return null; } }
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; } }
ZFSFileSystem existing = zfs.getFileSystemByMountPoint(home); if(existing!=null) { out.println(home+" is already on ZFS. Doing nothing");
ZFSFileSystem existing = zfs.getFileSystemByMountPoint(home); if(existing!=null) {
public String invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return fs.getName(); // TODO: for now, only support agents that are already on ZFS. throw new IOException("Not on ZFS"); } });
public String invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return fs.getName(); // TODO: for now, only support slaves that are already on ZFS. throw new IOException("Not on ZFS"); } });
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) fs.destory(true); return null; } });
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) fs.destory(true); return null; } });
public String invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return fs.getName(); // TODO: for now, only support slaves that are already on ZFS. throw new IOException("Not on ZFS"); } });
@Override public NativeZfsFileSystem getZfsByMountPoint(File mountPoint) throws NativeAccessException { ZFSFileSystem fs = zfs.getFileSystemByMountPoint(mountPoint); return new ZfsFileSystemImpl(fs); }
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) fs.destory(true); return null; } });
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return null; // already on ZFS // nope. create a file system String fullName = rootDataset + '/' + name; listener.getLogger().println("Creating a ZFS file system "+fullName+" at "+f); fs = libzfs.create(fullName, ZFSFileSystem.class); fs.setMountPoint(f); fs.mount(); return null; } });
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return null; // already on ZFS // nope. create a file system String fullName = rootDataset + '/' + name; listener.getLogger().println("Creating a ZFS file system "+fullName+" at "+f); fs = libzfs.create(fullName, ZFSFileSystem.class); fs.setMountPoint(f); fs.mount(); return null; } });
public Void invoke(File f, VirtualChannel channel) throws IOException { ZFSFileSystem fs = libzfs.getFileSystemByMountPoint(f); if(fs!=null) return null; // already on ZFS // nope. create a file system String fullName = rootDataset + '/' + name; listener.getLogger().println("Creating a ZFS file system "+fullName+" at "+f); fs = libzfs.create(fullName, ZFSFileSystem.class); fs.setMountPoint(f); fs.mount(); return null; } });
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; } }
@Override protected void doRun() { ZFSFileSystem fs=null; try { if(isInsideEC2()) fs = new LibZFS().getFileSystemByMountPoint(Hudson.getInstance().getRootDir()); } catch (LinkageError e) { // probably not running on OpenSolaris } if(fs==null) { cancel(); return; } ZFSPool pool = fs.getPool(); long a = pool.getAvailableSize(); long t = pool.getSize(); // if the disk is 90% filled up and the available space is less than 1GB, // notify the user ZPoolExpandNotice zen = AdministrativeMonitor.all().get(ZPoolExpandNotice.class); zen.activated = t/a>10 && a<1000L*1000*1000; }
@Override protected void doRun() { ZPoolExpandNotice zen = AdministrativeMonitor.all().get(ZPoolExpandNotice.class); Jenkins jenkinsInstance = Jenkins.getInstance(); ZFSFileSystem fs = null; try { if (isInsideEC2() && jenkinsInstance != null) fs = new LibZFS().getFileSystemByMountPoint(jenkinsInstance.getRootDir()); } catch (LinkageError e) { // probably not running on OpenSolaris } if (fs == null || zen == null) { cancel(); return; } ZFSPool pool = fs.getPool(); long a = pool.getAvailableSize(); long t = pool.getSize(); // if the disk is 90% filled up and the available space is less than // 1GB, // notify the user zen.activated = t / a > 10 && a < 1000L * 1000 * 1000; }