use of org.ovirt.engine.api.v3.types.V3Hosts in project ovirt-engine by oVirt.
the class V3DnsOutAdapter method adapt.
@Override
public V3DNS adapt(Dns from) {
V3DNS to = new V3DNS();
if (from.isSetSearchDomains()) {
to.setSearchDomains(new V3Hosts());
to.getSearchDomains().getHosts().addAll(adaptOut(from.getSearchDomains().getHosts()));
}
if (from.isSetServers()) {
to.setServers(new V3Hosts());
to.getServers().getHosts().addAll(adaptOut(from.getServers().getHosts()));
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Hosts in project ovirt-engine by oVirt.
the class V3HostsInAdapter method adapt.
@Override
public Hosts adapt(V3Hosts from) {
Hosts to = new Hosts();
if (from.isSetActions()) {
to.setActions(adaptIn(from.getActions()));
}
if (from.isSetActive()) {
to.setActive(from.getActive());
}
if (from.isSetSize()) {
to.setSize(from.getSize());
}
if (from.isSetTotal()) {
to.setTotal(from.getTotal());
}
to.getHosts().addAll(adaptIn(from.getHosts()));
return to;
}
use of org.ovirt.engine.api.v3.types.V3Hosts in project ovirt-engine by oVirt.
the class V3ApiSummaryOutAdapter method adapt.
@Override
public V3ApiSummary adapt(ApiSummary from) {
V3ApiSummary to = new V3ApiSummary();
if (from.isSetHosts()) {
ApiSummaryItem fromHosts = from.getHosts();
V3Hosts toHosts = new V3Hosts();
if (fromHosts.isSetTotal()) {
toHosts.setTotal(fromHosts.getTotal().longValue());
}
if (fromHosts.isSetActive()) {
toHosts.setActive(fromHosts.getActive().longValue());
}
to.setHosts(toHosts);
}
if (from.isSetStorageDomains()) {
ApiSummaryItem fromSds = from.getStorageDomains();
V3StorageDomains toSds = new V3StorageDomains();
if (fromSds.isSetTotal()) {
toSds.setTotal(fromSds.getTotal().longValue());
}
if (fromSds.isSetActive()) {
toSds.setActive(fromSds.getActive().longValue());
}
to.setStorageDomains(toSds);
}
if (from.isSetUsers()) {
ApiSummaryItem fromUsers = from.getUsers();
V3Users toUsers = new V3Users();
if (fromUsers.isSetTotal()) {
toUsers.setTotal(fromUsers.getTotal().longValue());
}
if (fromUsers.isSetActive()) {
toUsers.setActive(fromUsers.getActive().longValue());
}
to.setUsers(toUsers);
}
if (from.isSetVms()) {
ApiSummaryItem fromVms = from.getVms();
V3VMs toVms = new V3VMs();
if (fromVms.isSetTotal()) {
toVms.setTotal(fromVms.getTotal().longValue());
}
if (fromVms.isSetActive()) {
toVms.setActive(fromVms.getActive().longValue());
}
to.setVMs(toVms);
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Hosts in project ovirt-engine by oVirt.
the class V3VmPlacementPolicyOutAdapter method adapt.
@Override
public V3VmPlacementPolicy adapt(VmPlacementPolicy from) {
V3VmPlacementPolicy to = new V3VmPlacementPolicy();
if (from.isSetAffinity()) {
to.setAffinity(from.getAffinity().value());
}
if (from.isSetHosts()) {
to.setHosts(new V3Hosts());
to.getHosts().getHosts().addAll(adaptOut(from.getHosts().getHosts()));
// V3 allowed specifying only one host, using the "host" element instead of "hosts":
List<Host> hosts = from.getHosts().getHosts();
if (hosts.size() == 1) {
V3Host host = adaptOut(hosts.get(0));
to.setHost(host);
}
}
return to;
}
use of org.ovirt.engine.api.v3.types.V3Hosts in project ovirt-engine by oVirt.
the class V3HostsServer method list.
@GET
public V3Hosts list(@Context HttpHeaders headers, @Context UriInfo ui) {
V3Hosts hosts = adaptList(getDelegate()::list);
// In V3 the collection of hosts used to have the statistics inline, but only when the 'statistics' detail
// was explicitly provided:
Set<String> details = DetailHelper.getDetails(headers, ui);
if (details.contains("statistics")) {
hosts.getHosts().forEach(V3HostHelper::addStatistics);
}
return hosts;
}
Aggregations