Search in sources :

Example 1 with KVMHostInfo

use of org.apache.cloudstack.utils.linux.KVMHostInfo in project cloudstack by apache.

the class LibvirtComputingResource method initialize.

@Override
public StartupCommand[] initialize() {
    final KVMHostInfo info = new KVMHostInfo(_dom0MinMem, _dom0OvercommitMem);
    String capabilities = String.join(",", info.getCapabilities());
    if (dpdkSupport) {
        capabilities += ",dpdk";
    }
    final StartupRoutingCommand cmd = new StartupRoutingCommand(info.getCpus(), info.getCpuSpeed(), info.getTotalMemory(), info.getReservedMemory(), capabilities, _hypervisorType, RouterPrivateIpStrategy.HostLocal);
    cmd.setCpuSockets(info.getCpuSockets());
    fillNetworkInformation(cmd);
    _privateIp = cmd.getPrivateIpAddress();
    cmd.getHostDetails().putAll(getVersionStrings());
    cmd.getHostDetails().put(KeyStoreUtils.SECURED, String.valueOf(isHostSecured()).toLowerCase());
    cmd.setPool(_pool);
    cmd.setCluster(_clusterId);
    cmd.setGatewayIpAddress(_localGateway);
    cmd.setIqn(getIqn());
    if (cmd.getHostDetails().containsKey("Host.OS")) {
        _hostDistro = cmd.getHostDetails().get("Host.OS");
    }
    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 };
    }
}
Also used : StartupStorageCommand(com.cloud.agent.api.StartupStorageCommand) StartupCommand(com.cloud.agent.api.StartupCommand) KVMHostInfo(org.apache.cloudstack.utils.linux.KVMHostInfo) KVMStoragePool(com.cloud.hypervisor.kvm.storage.KVMStoragePool) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) StartupRoutingCommand(com.cloud.agent.api.StartupRoutingCommand)

Aggregations

StartupCommand (com.cloud.agent.api.StartupCommand)1 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)1 StartupStorageCommand (com.cloud.agent.api.StartupStorageCommand)1 KVMStoragePool (com.cloud.hypervisor.kvm.storage.KVMStoragePool)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 KVMHostInfo (org.apache.cloudstack.utils.linux.KVMHostInfo)1