use of com.cloud.agent.api.StoragePoolInfo in project CloudStack-archive by CloudStack-extras.
the class DummyResource method initialize.
@Override
public StartupCommand[] initialize() {
Map<String, VmState> changes = null;
final List<Object> info = getHostInfo();
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes);
fillNetworkInformation(cmd);
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setCluster(getConfiguredProperty("cluster", "1"));
StoragePoolInfo pi = initializeLocalStorage();
StartupStorageCommand sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);
sscmd.setGuid(pi.getUuid());
sscmd.setDataCenter((String) _params.get("zone"));
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
return new StartupCommand[] { cmd, sscmd };
}
use of com.cloud.agent.api.StoragePoolInfo in project CloudStack-archive by CloudStack-extras.
the class MockStorageManagerImpl method getLocalStorage.
@Override
public StoragePoolInfo getLocalStorage(String hostGuid) {
MockHost host = _mockHostDao.findByGuid(hostGuid);
MockStoragePoolVO storagePool = _mockStoragePoolDao.findByHost(hostGuid);
if (storagePool == null) {
String uuid = UUID.randomUUID().toString();
storagePool = new MockStoragePoolVO();
storagePool.setUuid(uuid);
storagePool.setMountPoint("/mnt/" + uuid + File.separator);
storagePool.setCapacity(DEFAULT_HOST_STORAGE_SIZE);
storagePool.setHostGuid(hostGuid);
storagePool.setStorageType(StoragePoolType.Filesystem);
storagePool = _mockStoragePoolDao.persist(storagePool);
}
return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(), storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0);
}
use of com.cloud.agent.api.StoragePoolInfo in project cloudstack by apache.
the class DummyResource method initialize.
@Override
public StartupCommand[] initialize() {
final List<Object> info = getHostInfo();
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer) info.get(0), (Long) info.get(1), (Long) info.get(2), (Long) info.get(4), (String) info.get(3), HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal);
fillNetworkInformation(cmd);
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setCluster(getConfiguredProperty("cluster", "1"));
StoragePoolInfo pi = initializeLocalStorage();
StartupStorageCommand sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);
sscmd.setGuid(pi.getUuid());
sscmd.setDataCenter((String) _params.get("zone"));
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
return new StartupCommand[] { cmd, sscmd };
}
use of com.cloud.agent.api.StoragePoolInfo in project cloudstack by apache.
the class AgentRoutingResource method initializeLocalSR.
private StartupStorageCommand initializeLocalSR() {
Map<String, TemplateProp> tInfo = new HashMap<String, TemplateProp>();
StoragePoolInfo poolInfo = _simMgr.getLocalStorage(hostGuid);
StartupStorageCommand cmd = new StartupStorageCommand(poolInfo.getHostPath(), poolInfo.getPoolType(), poolInfo.getCapacityBytes(), tInfo);
cmd.setPoolInfo(poolInfo);
cmd.setGuid(agentHost.getGuid());
cmd.setResourceType(StorageResourceType.STORAGE_POOL);
return cmd;
}
use of com.cloud.agent.api.StoragePoolInfo in project cloudstack by apache.
the class VmwareResource method initializeLocalStorage.
private List<StartupStorageCommand> initializeLocalStorage() {
List<StartupStorageCommand> storageCmds = new ArrayList<StartupStorageCommand>();
VmwareContext context = getServiceContext();
try {
VmwareHypervisorHost hyperHost = getHyperHost(context);
if (hyperHost instanceof HostMO) {
HostMO hostMo = (HostMO) hyperHost;
List<Pair<ManagedObjectReference, String>> dsList = hostMo.getLocalDatastoreOnHost();
for (Pair<ManagedObjectReference, String> dsPair : dsList) {
DatastoreMO dsMo = new DatastoreMO(context, dsPair.first());
String poolUuid = dsMo.getCustomFieldValue(CustomFieldConstants.CLOUD_UUID);
if (poolUuid == null || poolUuid.isEmpty()) {
poolUuid = UUID.randomUUID().toString();
dsMo.setCustomFieldValue(CustomFieldConstants.CLOUD_UUID, poolUuid);
}
DatastoreSummary dsSummary = dsMo.getSummary();
String address = hostMo.getHostName();
StoragePoolInfo pInfo = new StoragePoolInfo(poolUuid, address, dsMo.getMor().getValue(), "", StoragePoolType.VMFS, dsSummary.getCapacity(), dsSummary.getFreeSpace());
StartupStorageCommand cmd = new StartupStorageCommand();
cmd.setName(poolUuid);
cmd.setPoolInfo(pInfo);
// give storage host the same UUID as the local storage pool itself
cmd.setGuid(poolUuid);
cmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
cmd.setDataCenter(_dcId);
cmd.setPod(_pod);
cmd.setCluster(_cluster);
s_logger.info("Add local storage startup command: " + _gson.toJson(cmd));
storageCmds.add(cmd);
}
} else {
s_logger.info("Cluster host does not support local storage, skip it");
}
} catch (Exception e) {
String msg = "initializing local storage failed due to : " + VmwareHelper.getExceptionMessage(e);
s_logger.error(msg);
invalidateServiceContext();
throw new CloudRuntimeException(msg);
}
return storageCmds;
}
Aggregations