gpt4 book ai didi

java - 如何使用 netapp ontap api (8.1) 和 java 获取存储系统的磁盘、聚合和 LUN 信息?

转载 作者:行者123 更新时间:2023-12-01 13:39:03 27 4
gpt4 key购买 nike

我想使用 netapp ontap api 8.1 获取有关磁盘、聚合和 LUN 的信息。我可以使用以下代码获取卷列表:

VolumeListInfoIterStartRequest volumeListReq = new VolumeListInfoIterStartRequest();
Iterator<VolumeInfo> volumeIter = apirunner.iterate(volumeListReq,10);
VolumeInfo volume ;

while(volumeIter.hasNext()) {
System.out.println("------------------------------------------------");
volume = volumeIter.next();
System.out.println("Name : " + volume.getName());
System.out.println("Type : " + volume.getType());
System.out.println("State : " + volume.getState());
System.out.println("Total size (bytes) : " + volume.getSizeTotal());
System.out.println("Used size (bytes) : " + volume.getSizeUsed());
System.out.println("Total disk count is .. "+ volume.getDiskCount());
System.out.println("sysinfo is .. "+ volume.getSis());
System.out.println("Total available size .. " + volume.getSizeAvailable());
System.out.println("UUID is .. "+volume.getUuid());
String vol = volume.getName();
System.out.println("snapshot is "+ volume);
System.out.println("------------------------------------------------");

}

但是当我尝试使用与上面完全相同的 LUN api 时,我在迭代函数中遇到错误。我的代码是:

LunListInfoRequest lunreq = new LunListInfoRequest();
System.out.println("luninfo is .. " + lunreq);

Iterator<LunInfo> lunInfoIter = apirunner.iterate(lunreq,10);

我在最后一行遇到错误。

如何获取有关磁盘、聚合和 LUN 的信息?

最佳答案

import java.util.List;

import com.netapp.nmsdk.client.ApiRunner;
import com.netapp.nmsdk.client.ApiTarget;
import com.netapp.nmsdk.client.ApiTarget.TargetType;
import com.netapp.nmsdk.ontap.api.lun.LunStatsInfo;
import com.netapp.nmsdk.ontap.api.lun.LunStatsListInfoRequest;
import com.netapp.nmsdk.ontap.api.lun.LunStatsListInfoResponse;


public class LUN {
public static void main(String[] args) {

String host="";
String userName="";
String password="";



try {
ApiRunner runner = new ApiRunner(ApiTarget.builder()
.withHost(host)
.withUserName(userName)
.withPassword(password)
.withTargetType(TargetType.FILER)
.useHttp()
.build());


LunStatsListInfoRequest req=new LunStatsListInfoRequest();
LunStatsListInfoResponse res= runner.run(req);
List<LunStatsInfo> list=res.getLunStats();


for (LunStatsInfo luninfo : list) {
System.out.println("*****************************");
System.out.println("Block Size=="+luninfo.getBlockSize());
System.out.println("Read Blocks=="+luninfo.getReadBlocks());
System.out.println("Read Ops=="+luninfo.getReadOps());
System.out.println("Write Blocks=="+luninfo.getWriteBlocks());
System.out.println("write Ops=="+luninfo.getWriteOps());
System.out.println("Other OPs=="+luninfo.getOtherOps());
System.out.println("*****************************");


}




}
catch(Exception e){

}
}
}

关于java - 如何使用 netapp ontap api (8.1) 和 java 获取存储系统的磁盘、聚合和 LUN 信息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20989703/

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