本文整理了Java中hudson.os.solaris.ZFSInstaller
类的一些代码示例,展示了ZFSInstaller
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZFSInstaller
类的具体详情如下:
包路径:hudson.os.solaris.ZFSInstaller
类名称:ZFSInstaller
[英]Encourages the user to migrate HUDSON_HOME on a ZFS file system.
[中]鼓励用户将HUDSON_迁移到ZFS文件系统上。
代码示例来源:origin: jenkinsci/jenkins
@Extension
public static AdministrativeMonitor init() {
String migrationTarget = SystemProperties.getString(ZFSInstaller.class.getName() + ".migrate");
if(migrationTarget!=null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamTaskListener listener = new StreamTaskListener(new ForkOutputStream(System.out, out));
try {
if(migrate(listener,migrationTarget)) {
// completed successfully
return new MigrationCompleteNotice();
}
} catch (Exception e) {
// if we let any exception from here, it will prevent Hudson from starting.
Functions.printStackTrace(e, listener.error("Migration failed"));
}
// migration failed
return new MigrationFailedNotice(out);
}
// install the monitor if applicable
ZFSInstaller zi = new ZFSInstaller();
if(zi.isActivated())
return zi;
return null;
}
代码示例来源:origin: jenkinsci/jenkins
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;
}
}
代码示例来源:origin: jenkinsci/jenkins
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
Functions.printStackTrace(e, listener.error(e.getMessage()));
sendError(log.toString(),req,rsp);
return;
代码示例来源:origin: org.eclipse.hudson/hudson-core
requirePOST();
Hudson hudson = Hudson.getInstance();
hudson.checkPermission(Hudson.ADMINISTER);
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener, username, password);
} catch (Exception e) {
e.printStackTrace(listener.error(e.getMessage()));
sendError(log.toString(), req, rsp);
return;
代码示例来源:origin: hudson/hudson-2.x
/**
* Called from the management screen.
*/
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
requirePOST();
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
if(req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
代码示例来源:origin: jenkinsci/jenkins
if(system(home,listener, "/usr/bin/cp","-pR",".", tmpDir.getAbsolutePath())!=0) {
out.println("Failed to copy "+home+" to "+tmpDir);
return false;
if(system(new File("/"),listener,"/usr/bin/rm","-rf",backup.getAbsolutePath())!=0) {
out.println("Failed to delete "+backup.getAbsolutePath());
return false;
代码示例来源:origin: jenkinsci/jenkins
/**
* Called from the management screen.
*/
@RequirePOST
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
if(req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
requirePOST();
Hudson hudson = Hudson.getInstance();
hudson.checkPermission(Hudson.ADMINISTER);
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
e.printStackTrace(listener.error(e.getMessage()));
sendError(log.toString(),req,rsp);
return;
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Called from the management screen.
*/
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
requirePOST();
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
if(req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
if (system(home, listener, "/usr/bin/cp", "-pR", ".", tmpDir.getAbsolutePath()) != 0) {
out.println("Failed to copy " + home + " to " + tmpDir);
return false;
if (system(new File("/"), listener, "/usr/bin/rm", "-rf", backup.getAbsolutePath()) != 0) {
out.println("Failed to delete " + backup.getAbsolutePath());
return false;
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Called from the management screen.
*/
@RequirePOST
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
if(req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
@Extension
public static AdministrativeMonitor init() {
String migrationTarget = System.getProperty(ZFSInstaller.class.getName() + ".migrate");
if(migrationTarget!=null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamTaskListener listener = new StreamTaskListener(new ForkOutputStream(System.out, out));
try {
if(migrate(listener,migrationTarget)) {
// completed successfully
return new MigrationCompleteNotice();
}
} catch (Exception e) {
// if we let any exception from here, it will prevent Hudson from starting.
e.printStackTrace(listener.error("Migration failed"));
}
// migration failed
return new MigrationFailedNotice(out);
}
// install the monitor if applicable
ZFSInstaller zi = new ZFSInstaller();
if(zi.isActivated())
return zi;
return null;
}
代码示例来源:origin: hudson/hudson-2.x
requirePOST();
Hudson hudson = Hudson.getInstance();
hudson.checkPermission(Hudson.ADMINISTER);
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
e.printStackTrace(listener.error(e.getMessage()));
sendError(log.toString(),req,rsp);
return;
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Called from the management screen.
*/
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
requirePOST();
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
if (req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
Functions.printStackTrace(e, listener.error(e.getMessage()));
sendError(log.toString(),req,rsp);
return;
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
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;
}
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
if(system(home,listener, "/usr/bin/cp","-pR",".", tmpDir.getAbsolutePath())!=0) {
out.println("Failed to copy "+home+" to "+tmpDir);
return false;
if(system(new File("/"),listener,"/usr/bin/rm","-rf",backup.getAbsolutePath())!=0) {
out.println("Failed to delete "+backup.getAbsolutePath());
return false;
代码示例来源:origin: org.eclipse.hudson/hudson-core
@Extension
public static AdministrativeMonitor init() {
String migrationTarget = System.getProperty(ZFSInstaller.class.getName() + ".migrate");
if (migrationTarget != null) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
StreamTaskListener listener = new StreamTaskListener(new ForkOutputStream(System.out, out));
try {
if (migrate(listener, migrationTarget)) {
// completed successfully
return new MigrationCompleteNotice();
}
} catch (Exception e) {
// if we let any exception from here, it will prevent Hudson from starting.
e.printStackTrace(listener.error("Migration failed"));
}
// migration failed
return new MigrationFailedNotice(out);
}
// install the monitor if applicable
ZFSInstaller zi = new ZFSInstaller();
if (zi.isActivated()) {
return zi;
}
return null;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
requirePOST();
Hudson hudson = Hudson.getInstance();
hudson.checkPermission(Hudson.ADMINISTER);
StreamTaskListener listener = new StreamTaskListener(log);
try {
datasetName = createZfsFileSystem(listener,username,password);
} catch (Exception e) {
e.printStackTrace(listener.error(e.getMessage()));
sendError(log.toString(),req,rsp);
return;
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Called from the management screen.
*/
public HttpResponse doAct(StaplerRequest req) throws ServletException, IOException {
requirePOST();
Hudson.getInstance().checkPermission(Hudson.ADMINISTER);
if(req.hasParameter("n")) {
// we'll shut up
disable(true);
return HttpResponses.redirectViaContextPath("/manage");
}
return new HttpRedirect("confirm");
}
内容来源于网络,如有侵权,请联系作者删除!