+ ds.getFreeSpace() + " to datacenter");
}
}
// translate cluster and hosts
AbstractCluster abstractCluster = new AbstractCluster(cluster.getName());
try {
// add hosts
for (VcHost host : cluster.getHosts()) {
if (host.isConnected() && !host.isUnavailbleForManagement()
&& host.getDatastores() != null && host.getDatastores().size() > 0) {
AbstractHost abstractHost = new AbstractHost(host.getName());
for (VcDatastore datastore : host.getDatastores()) {
AbstractDatastore ds =
this.dc.findAbstractDatastore(datastore.getName());
if (ds != null) {
abstractHost.addDatastore(ds);
logger.info("added datastore " + ds.getName() + " to host "
+ host.getName());
}
}
abstractCluster.addHost(abstractHost);
logger.info("added host " + host.getName() + " to container");
}
}
// add datastores
for (VcDatastore datastore : cluster.getAllDatastores()) {
AbstractDatastore ds =
this.dc.findAbstractDatastore(datastore.getName());
if (ds != null) {
abstractCluster.addDatastore(ds);
logger.info("added datastore " + ds.getName() + " with space "
+ ds.getFreeSpace() + " to cluster " + cluster.getName());
}
}