use of org.ovirt.engine.sdk4.types.StorageDomain in project ovirt-engine-sdk-java by oVirt.
the class AddNfsIsoStorageDomain method main.
public static void main(String[] args) throws Exception {
// Create the connection to the server:
Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
// Get the reference to the storage domains service:
StorageDomainsService sdsService = connection.systemService().storageDomainsService();
// Create a new NFS storage domain:
StorageDomain sd = sdsService.add().storageDomain(storageDomain().name("myiso").description("My ISO").type(StorageDomainType.ISO).host(host().name("myhost")).storage(hostStorage().type(StorageType.NFS).address("server0.example.com").path("/nfs/ovirt/40/myiso"))).send().storageDomain();
// Wait till the storage domain is unattached:
StorageDomainService sdService = sdsService.storageDomainService(sd.id());
for (; ; ) {
Thread.sleep(5 * 1000);
sd = sdService.get().send().storageDomain();
if (sd.status() == StorageDomainStatus.UNATTACHED) {
break;
}
}
// Close the connection to the server:
connection.close();
}
Aggregations