Source:
public static void main ( java.lang.String [ ] args ) throws java.lang.Exception { org.ovirt.engine.sdk4.Connection connection = org.ovirt.engine.sdk4.ConnectionBuilder.connection ( ) . url ( "https://engine40.example.com/ovirt-engine/api" ) . user ( "admin@internal" ) . password ( "redhat123" ) . trustStoreFile ( "truststore.jks" ) . build ( ) ; org.ovirt.engine.sdk4.services.StorageDomainsService sdsService = connection.systemService ( ) . storageDomainsService ( ) ; org.ovirt.engine.sdk4.types.StorageDomain sd = sdsService.list ( ) . search ( "name=myiso" ) . send ( ) . storageDomains ( ) . get ( 0 ) ; org.ovirt.engine.sdk4.services.DataCentersService dcsService = connection.systemService ( ) . dataCentersService ( ) ; org.ovirt.engine.sdk4.types.DataCenter dc = dcsService.list ( ) . search ( "name=mydc" ) . send ( ) . dataCenters ( ) . get ( 0 ) ; org.ovirt.engine.sdk4.services.DataCenterService dcService = dcsService.dataCenterService ( dc.id ( ) ) ; org.ovirt.engine.sdk4.services.AttachedStorageDomainsService attachedSdsService = dcService.storageDomainsService ( ) ; attachedSdsService.add ( ) . storageDomain ( org.ovirt.engine.sdk4.builders.Builders.storageDomain ( ) . id ( sd.id ( ) ) ) . send ( ) ; org.ovirt.engine.sdk4.services.StorageDomainService sdService = sdsService.storageDomainService ( sd.id ( ) ) ; for ( ; ; ) { java.lang.Thread.sleep ( ( 5 * 1000 ) ) ; sd = sdService.get ( ) . send ( ) . storageDomain ( ) ; java.lang.String state = sd.status ( ) . state ( ) ; if ( "active" . equals ( state ) ) { break ; } } connection.close ( ) ; }

Target:
public static void main ( java.lang.String [ ] args ) throws java.lang.Exception { org.ovirt.engine.sdk4.Connection connection = org.ovirt.engine.sdk4.ConnectionBuilder.connection ( ) . url ( "https://engine40.example.com/ovirt-engine/api" ) . user ( "admin@internal" ) . password ( "redhat123" ) . trustStoreFile ( "truststore.jks" ) . build ( ) ; org.ovirt.engine.sdk4.services.StorageDomainsService sdsService = connection.systemService ( ) . storageDomainsService ( ) ; org.ovirt.engine.sdk4.types.StorageDomain sd = sdsService.list ( ) . search ( "name=myiso" ) . send ( ) . storageDomains ( ) . get ( 0 ) ; org.ovirt.engine.sdk4.services.DataCentersService dcsService = connection.systemService ( ) . dataCentersService ( ) ; org.ovirt.engine.sdk4.types.DataCenter dc = dcsService.list ( ) . search ( "name=mydc" ) . send ( ) . dataCenters ( ) . get ( 0 ) ; org.ovirt.engine.sdk4.services.DataCenterService dcService = dcsService.dataCenterService ( dc.id ( ) ) ; org.ovirt.engine.sdk4.services.AttachedStorageDomainsService attachedSdsService = dcService.storageDomainsService ( ) ; attachedSdsService.add ( ) . storageDomain ( org.ovirt.engine.sdk4.builders.Builders.storageDomain ( ) . id ( sd.id ( ) ) ) . send ( ) ; org.ovirt.engine.sdk4.services.AttachedStorageDomainService attachedSdService = attachedSdsService.storageDomainService ( sd.id ( ) ) ; for ( ; ; ) { java.lang.Thread.sleep ( ( 5 * 1000 ) ) ; sd = attachedSdService.get ( ) . send ( ) . storageDomain ( ) ; if ( ( sd.status ( ) ) == ( org.ovirt.engine.sdk4.types.StorageDomainStatus.ACTIVE ) ) { break ; } } connection.close ( ) ; }