我想使用 netapp 可管理性 sdk 和 java 在存储系统上获取卷列表。我只能获得存储系统的版本和类型。我正在运行一个用 sdk 给出的示例程序,但它给了我空值......
这是一个代码...
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.volume.VolumeInfo;
import com.netapp.nmsdk.ontap.api.volume.VolumeListInfoIterStartRequest;
import com.netapp.nmsdk.ontap.api.volume.VolumeListInfoIterStartRequest;
import java.util.Iterator;
import java.util.List;
public class VolList {
public static void main(String[] args) {
if (args.length < 3) {
System.err.println("Usage: VolList <storage-system> <user> <passwd> [<volume>]");
System.err.println(" Note: This sample code will list the volume information of a 7-Mode Storage system.");
System.exit(1);
}
try {
ApiRunner runner = new ApiRunner(ApiTarget.builder()
.withHost(args[0])
.withUserName(args[1])
.withPassword(args[2])
.withTargetType(TargetType.FILER)
.useHttp()
.build());
VolumeListInfoIterStartRequest volListReq = new VolumeListInfoIterStartRequest();
if (args.length > 3) {
volListReq.setVolume(args[3]);
}
Iterator<VolumeInfo> volumeIter = runner.iterate(volListReq, 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("------------------------------------------------");
}
} catch(Exception e) {
e.printStackTrace();
}
}
}
我应该如何使用 netapp 和 java 获取 volumelist?