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; } });
return existing.getName(); hudson.setMountPoint(dir); hudson.mount(); if (nativeUtils.chown(dir, uid, gid)) { throw new IOException("Failed to chown " + dir); hudson.unmount(); hudson.setProperty("hudson:managed-by", "hudson"); // mark this file system as "managed by Hudson" hudson.allow(userName); return hudson.getName(); } catch (NativeAccessException ex) { Logger.getLogger(ZFSInstaller.class.getName()).log(Level.SEVERE, null, ex); if (hudson != null) { hudson.destory();
hudson.setMountPoint(tmpDir); hudson.setProperty("hudson:managed-by", "hudson"); // mark this file system as "managed by Hudson" hudson.mount(); hudson.unmount(NativeZfsFileSystem.MS_FORCE); hudson.setMountPoint(home); hudson.mount(); hudson.setProperty("sharesmb", "on"); hudson.setProperty("sharenfs", "on"); hudson.share();
private static String computeHudsonFileSystemName(NativeZfsFileSystem top) { try { NativeUtils nativeUtils = NativeUtils.getInstance(); if (!nativeUtils.zfsExists(top.getName() + "/hudson")) { return top.getName() + "/hudson"; } for (int i = 2;; i++) { String name = top.getName() + "/hudson" + i; if (!nativeUtils.zfsExists(name)) { return name; } } } catch (NativeAccessException ex) { Logger.getLogger(ZFSInstaller.class.getName()).log(Level.SEVERE, null, ex); } return null; }