本文整理了Java中org.jvnet.solaris.libzfs.ZFSPool
类的一些代码示例,展示了ZFSPool
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZFSPool
类的具体详情如下:
包路径:org.jvnet.solaris.libzfs.ZFSPool
类名称:ZFSPool
[英]zpool, which is a storage abstraction.
[中]zpool是一种存储抽象。
代码示例来源:origin: org.kohsuke/libzfs
public int callback(zpool_handle_t handle, Pointer arg) {
r.add(new ZFSPool(LibZFS.this, handle));
return 0;
}
}, null);
代码示例来源:origin: org.jvnet.libzfs/libzfs
@Override
protected void finalize() throws Throwable {
dispose();
super.finalize();
}
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Gets the size of this pool that's already used in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getUsedSize() {
return Math.max(0, getSize()-getAvailableSize());
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Gets the total size of this pool in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getSize() {
return toSize(getProperty(zpool_prop_t.ZPOOL_PROP_SIZE));
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Does "zpool export".
*/
public void export(boolean force, boolean hardForce) {
disableDatasets(force);
if(hardForce)
check(LIBZFS.zpool_export_force(handle));
else
check(LIBZFS.zpool_export(handle,force));
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Disables datasets within a pool by unmounting/unsharing them all.
*
* @param force
* Not exactly sure what this does.
*/
public void disableDatasets(boolean force) {
check(LIBZFS.zpool_disable_datasets(handle,force));
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Gets the size of this pool that's already used in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getUsedSize() {
return toSize(getProperty(zpool_prop_t.ZPOOL_PROP_USED));
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Does "zpool export".
*/
public void export(boolean force, boolean hardForce) {
disableDatasets(force);
if(hardForce)
check(LIBZFS.zpool_export_force(handle));
else
check(LIBZFS.zpool_export(handle,force));
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Disables datasets within a pool by unmounting/unsharing them all.
*
* @param force
* Not exactly sure what this does.
*/
public void disableDatasets(boolean force) {
check(LIBZFS.zpool_disable_datasets(handle,force));
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Gets the total size of this pool in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getSize() {
return toSize(getProperty(zpool_prop_t.ZPOOL_PROP_SIZE));
}
代码示例来源:origin: org.jenkins-ci.plugins/ec2
@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;
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
public int callback(zpool_handle_t handle, Pointer arg) {
r.add(new ZFSPool(LibZFS.this, handle));
return 0;
}
}, null);
代码示例来源:origin: org.kohsuke/libzfs
@Override
protected void finalize() throws Throwable {
dispose();
super.finalize();
}
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Gets the remaining free space size of this pool in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getAvailableSize() {
return toSize(getProperty(zpool_prop_t.ZPOOL_PROP_AVAILABLE));
}
代码示例来源:origin: jenkinsci/ec2-plugin
@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;
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Gets the pool of the given name.
*/
public ZFSPool getPool(String name) {
zpool_handle_t h = LIBZFS.zpool_open(handle, name);
if(h==null) return null; // not found
return new ZFSPool(this,h);
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Gets the remaining free space size of this pool in bytes.
*
* <p>
* Because of the way libzfs report the size information
* (as strings like 1.2G), the precision of this information is low.
*/
public long getAvailableSize() {
return toSize(getProperty(zpool_prop_t.ZPOOL_PROP_FREE));
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Gets the pool of the given name.
*/
public ZFSPool getPool(String name) {
zpool_handle_t h = LIBZFS.zpool_open(handle, name);
if(h==null) return null; // not found
return new ZFSPool(this,h);
}
代码示例来源:origin: org.jvnet.libzfs/libzfs
/**
* Lists up all the ZFS pools.
*
* @return can be empty but never null.
*/
public List<ZFSPool> pools() {
final List<ZFSPool> r = new ArrayList<ZFSPool>();
LIBZFS.zpool_iter(handle, new zpool_iter_f() {
public int callback(zpool_handle_t handle, Pointer arg) {
r.add(new ZFSPool(LibZFS.this, handle));
return 0;
}
}, null);
return r;
}
代码示例来源:origin: org.kohsuke/libzfs
/**
* Lists up all the ZFS pools.
*
* @return can be empty but never null.
*/
public List<ZFSPool> pools() {
final List<ZFSPool> r = new ArrayList<ZFSPool>();
LIBZFS.zpool_iter(handle, new zpool_iter_f() {
public int callback(zpool_handle_t handle, Pointer arg) {
r.add(new ZFSPool(LibZFS.this, handle));
return 0;
}
}, null);
return r;
}
内容来源于网络,如有侵权,请联系作者删除!