ovirt - engine - sdk - java 4.0.0 학습 기록
import org.ovirt.engine.sdk4.Connection;
import org.ovirt.engine.sdk4.services.ClustersService;
import org.ovirt.engine.sdk4.services.ClustersService.ListResponse;
import org.ovirt.engine.sdk4.services.DataCentersService;
import org.ovirt.engine.sdk4.services.HostsService;
import org.ovirt.engine.sdk4.services.VmsService;
import org.ovirt.engine.sdk4.types.Cluster;
import org.ovirt.engine.sdk4.types.DataCenter;
import org.ovirt.engine.sdk4.types.Host;
import org.ovirt.engine.sdk4.types.Vm;
import static org.ovirt.engine.sdk4.ConnectionBuilder.connection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Test {
private static final String URL = "https://svcloud.casvip.com:443/ovirt-engine/api";
private static final String USERNAME = "admin@internal";
private static final String PASSWORD = "Admin123***";
public static void main(String[] args) {
// 1.
Connection connection = connection()
.url(URL)
.user(USERNAME)
.password(PASSWORD)
.build();
// 2.
DataCentersService dataCentersSevice = connection.systemService().dataCentersService();
List dataCenters = dataCentersSevice.list().send().dataCenters();
Map dataCenterMap = new HashMap();
System.out.println(" :");
for(DataCenter dt : dataCenters) {
System.out.println("\t - " + dt.name());
System.out.println("\t\tID - " + dt.id());
System.out.println("\t\tClusters - " + dt.clusters().size());
dataCenterMap.put(dt.id(), dt.name());
}
// 3.
ClustersService clustersService = connection.systemService().clustersService();
List clusters = clustersService.list().send().clusters();
Map clusterMap = new HashMap();
System.out.println(" :");
for(Cluster clu : clusters) {
if(clu.id() != null) {
System.out.println("\t - " + clu.name());
System.out.println("\t\tID - " + clu.id());
System.out.println("\t\tData Center - " + clu.dataCenter());
clusterMap.put(clu.id(), clu.name());
}
}
// 4.
HostsService hostsService = connection.systemService().hostsService();
List hosts = hostsService.list().send().hosts();
Map hostMap = new HashMap();
System.out.println(" :");
for(Host host : hosts) {
System.out.println("\t - " + host.name());
System.out.println("\t\tID - " + host.id());
System.out.println("\t\tIP - " + host.address());
System.out.println("\t\tCluster - " + clusterMap.get(host.cluster().id()));
System.out.println("\t\tData Center - " + host.cluster().dataCenter());
hostMap.put(host.id(), host.name());
}
// 5.
VmsService vmsService = connection.systemService().vmsService();
List vms = vmsService.list().send().vms();
System.out.println(" :");
for(Vm vm : vms) {
System.out.println("\t - " + vm.name());
System.out.println("\t\t - " + vm.description());
if(vm.host() != null) {
System.out.println("\t\t - " + hostMap.get(vm.host().id()));
}
System.out.println("\t\tIP - " + vm.display().address());
System.out.println("\t\tFQDN - " + vm.fqdn());
System.out.println("\t\tCluster - " + clusterMap.get(vm.cluster().id()));
System.out.println("\t\tMemory - " + vm.memory());
System.out.println("\t\tOS - " + vm.os().type());
System.out.println("\t\tCPU - " + vm.cpu().architecture());
System.out.println("\t\tCPU Level - " + vm.cpu().level());
System.out.println("\t\t - " + vm.display().type().value());
System.out.println("\t\tStauts - " + vm.status().value());
System.out.println("\t\t - " + vm.creationTime());
System.out.println("\t\t - " + vm.comment());
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
oVirt'e NFS DATA ve Expert Storage Eklenmesi1.그룹/Kullanıcı Hesabı Oluşturma - Önce NFS sunucusuna giriş yapın ve halihazırda mevcut değilse, NFS sunucusunda kvm adl...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.