gpt4 book ai didi

org.jvnet.solaris.libzfs.ZFSPool.getAvailableSize()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 19:29:31 27 4
gpt4 key购买 nike

本文整理了Java中org.jvnet.solaris.libzfs.ZFSPool.getAvailableSize()方法的一些代码示例,展示了ZFSPool.getAvailableSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZFSPool.getAvailableSize()方法的具体详情如下:
包路径:org.jvnet.solaris.libzfs.ZFSPool
类名称:ZFSPool
方法名:getAvailableSize

ZFSPool.getAvailableSize介绍

[英]Gets the remaining free space size of this pool in bytes.

Because of the way libzfs report the size information (as strings like 1.2G), the precision of this information is low.
[中]获取此池的剩余可用空间大小(字节)。
由于libzfs报告大小信息的方式(如字符串1.2G),该信息的精度较低。

代码示例

代码示例来源: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.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: 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;
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com