/** * Creates a ZFS file system to migrate the data to. * * <p> * This has to be done while we still have an interactive access with the user, since it involves the password. * * <p> * An exception will be thrown if the operation fails. A normal completion means a success. * * @return * The ZFS dataset name to migrate the data to. */ private String createZfsFileSystem(final TaskListener listener, String rootUsername, String rootPassword) throws IOException, InterruptedException, ZFSException { // capture the UID that Hudson runs under // so that we can allow this user to do everything on this new partition final int uid = LIBC.geteuid(); final int gid = LIBC.getegid(); passwd pwd = LIBC.getpwuid(uid); if(pwd==null) throw new IOException("Failed to obtain the current user information for "+uid); final String userName = pwd.pw_name; final File home = Jenkins.getInstance().getRootDir(); // this is the actual creation of the file system. // return true indicating a success return SU.execute(listener, rootUsername, rootPassword, new Create(listener, home, uid, gid, userName)); } private static class Create extends MasterToSlaveCallable<String, IOException> {
return SU.execute(listener, rootUsername, rootPassword, new Callable<String, IOException>() {
return SU.execute(listener, rootUsername, rootPassword, new Callable<String, IOException>() { public String call() throws IOException { NativeZfsFileSystem hudson = null;
String rootPassword = prompter.promptPassword("Specify your password for sudo (or empty if you can sudo without password)"); SU.execute(listener, rootUser, rootPassword, new Callable<Void, IOException>() { public Void call() throws IOException { try {
return SU.execute(listener, rootUsername, rootPassword, new MasterToSlaveCallable<String,IOException>() { private static final long serialVersionUID = 7731167233498214301L;
return SU.execute(listener, rootUsername, rootPassword, new Callable<String,IOException>() { public String call() throws IOException { PrintStream out = listener.getLogger();
return SU.execute(listener, rootUsername, rootPassword, new Callable<String,IOException>() { public String call() throws IOException { PrintStream out = listener.getLogger();