use of com.cloud.agent.api.StartupStorageCommand 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.StartupStorageCommand in project cloudstack by apache.
the class StorageCapacityListener method processConnect.
@Override
public void processConnect(Host server, StartupCommand startup, boolean forRebalance) throws ConnectionException {
if (!(startup instanceof StartupStorageCommand)) {
return;
}
StartupStorageCommand ssCmd = (StartupStorageCommand) startup;
if (ssCmd.getResourceType() == Storage.StorageResourceType.STORAGE_HOST) {
BigDecimal overProvFactor = BigDecimal.valueOf(CapacityManager.StorageOverprovisioningFactor.value());
CapacityVO capacity = new CapacityVO(server.getId(), server.getDataCenterId(), server.getPodId(), server.getClusterId(), 0L, (overProvFactor.multiply(new BigDecimal(server.getTotalSize()))).longValue(), Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED);
_capacityDao.persist(capacity);
}
}
use of com.cloud.agent.api.StartupStorageCommand 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.StartupStorageCommand in project cloudstack by apache.
the class LibvirtComputingResource method initialize.
@Override
public StartupCommand[] initialize() {
final List<Object> info = getHostInfo();
_totalMemory = (Long) info.get(2);
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, RouterPrivateIpStrategy.HostLocal);
cmd.setCpuSockets((Integer) info.get(5));
fillNetworkInformation(cmd);
_privateIp = cmd.getPrivateIpAddress();
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setPool(_pool);
cmd.setCluster(_clusterId);
cmd.setGatewayIpAddress(_localGateway);
cmd.setIqn(getIqn());
StartupStorageCommand sscmd = null;
try {
final KVMStoragePool localStoragePool = _storagePoolMgr.createStoragePool(_localStorageUUID, "localhost", -1, _localStoragePath, "", StoragePoolType.Filesystem);
final com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo(localStoragePool.getUuid(), cmd.getPrivateIpAddress(), _localStoragePath, _localStoragePath, StoragePoolType.Filesystem, localStoragePool.getCapacity(), localStoragePool.getAvailable());
sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);
sscmd.setGuid(pi.getUuid());
sscmd.setDataCenter(_dcId);
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
} catch (final CloudRuntimeException e) {
s_logger.debug("Unable to initialize local storage pool: " + e);
}
if (sscmd != null) {
return new StartupCommand[] { cmd, sscmd };
} else {
return new StartupCommand[] { cmd };
}
}
use of com.cloud.agent.api.StartupStorageCommand in project cloudstack by apache.
the class HypervDirectConnectResourceTest method testJson.
// @Test
public final void testJson() {
StartupStorageCommand sscmd = null;
com.cloud.agent.api.StoragePoolInfo pi = new com.cloud.agent.api.StoragePoolInfo("test123", "192.168.0.1", "c:\\", "c:\\", StoragePoolType.Filesystem, 100L, 50L);
sscmd = new StartupStorageCommand();
sscmd.setPoolInfo(pi);
sscmd.setGuid(pi.getUuid());
sscmd.setDataCenter("foo");
sscmd.setResourceType(Storage.StorageResourceType.STORAGE_POOL);
s_logger.debug("StartupStorageCommand fromJson is " + s_gson.toJson(sscmd));
}
Aggregations