public Void invoke(File f, VirtualChannel channel) throws IOException { try { NativeZfsFileSystem fs = nativeUtils.getZfsByMountPoint(f); if(fs != null){ fs.destory(true); } } catch (NativeAccessException ex) { Logger.getLogger(ZFSProvisioner.class.getName()).log(Level.SEVERE, null, ex); } return null; } });
public String invoke(File f, VirtualChannel channel) throws IOException { try { NativeZfsFileSystem fs = nativeUtils.getZfsByMountPoint(f); if(fs != null) return fs.getName(); } catch (NativeAccessException ex) { Logger.getLogger(ZFSProvisioner.class.getName()).log(Level.SEVERE, null, ex); } // 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 { try { NativeZfsFileSystem fs = nativeUtils.getZfsByMountPoint(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 = nativeUtils.createZfs(fullName); fs.setMountPoint(f); fs.mount(); } catch (NativeAccessException ex) { Logger.getLogger(ZFSProvisioner.class.getName()).log(Level.SEVERE, null, ex); } 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 { List<NativeZfsFileSystem> roots = nativeUtils.getZfsRoots(); if(roots.isEmpty()) return false; // no active ZFS pool // if we don't run on a ZFS file system, activate NativeZfsFileSystem hudsonZfs = nativeUtils.getZfsByMountPoint(Hudson.getInstance().getRootDir()); if(hudsonZfs!=null) return false; // already on ZFS // decide what file system we'll create NativeZfsFileSystem pool = roots.get(0); prospectiveZfsFileSystemName = computeHudsonFileSystemName(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; } }
NativeZfsFileSystem existing = nativeUtils.getZfsByMountPoint(home); if(existing!=null) { out.println(home+" is already on ZFS. Doing nothing");
NativeZfsFileSystem existing = nativeUtils.getZfsByMountPoint(home);