Search in sources :

Example 1 with Ovm3VmGuestTypes

use of com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmGuestTypes in project cloudstack by apache.

the class Ovm3HypervisorResourceTest method createVm.

public VirtualMachineTO createVm(String vmName) throws Ovm3ResourceException {
    con = support.prepConnectionResults();
    Xen vdata = new Xen(con);
    Xen.Vm vm = vdata.getVmConfig(vmName);
    vdata.listVm(xen.getRepoId(), xen.getVmId());
    // Ovm3VmGuestTypes types = new Ovm3VmGuestTypes();
    Long id = 1L;
    String instanceName = vm.getVmName();
    VirtualMachine.Type type = Type.User;
    // vm.getVmCpus();
    int cpus = 1;
    Integer speed = 0;
    long minRam = vm.getVmMemory();
    long maxRam = vm.getVmMemory();
    BootloaderType bootloader = BootloaderType.PyGrub;
    String os = "Oracle Enterprise Linux 6.0 (64-bit)";
    boolean enableHA = true;
    boolean limitCpuUse = false;
    String vncPassword = "gobbeldygoo";
    VirtualMachineTO vmspec = new VirtualMachineTO(id, instanceName, type, cpus, speed, minRam, maxRam, bootloader, os, enableHA, limitCpuUse, vncPassword);
    vmspec.setBootArgs("");
    addDisksToSpec(vmspec, vm.getVmDisks());
    addNicsToSpec(vmspec, vm.getVmVifs());
    return vmspec;
}
Also used : Xen(com.cloud.hypervisor.ovm3.objects.Xen) Type(com.cloud.vm.VirtualMachine.Type) BootloaderType(com.cloud.template.VirtualMachineTemplate.BootloaderType) VirtualMachineTO(com.cloud.agent.api.to.VirtualMachineTO) VirtualMachine(com.cloud.vm.VirtualMachine)

Example 2 with Ovm3VmGuestTypes

use of com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmGuestTypes in project cloudstack by apache.

the class Ovm3HypervisorResource method configure.

/**
 * Base configuration of the plugins components.
 */
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
    LOGGER.debug("configure " + name + " with params: " + params);
    /* check if we're primary or not and if we can connect */
    try {
        configuration = new Ovm3Configuration(params);
        if (!configuration.getIsTest()) {
            c = new Connection(configuration.getAgentIp(), configuration.getAgentOvsAgentPort(), configuration.getAgentOvsAgentUser(), configuration.getAgentOvsAgentPassword());
            c.setHostName(configuration.getAgentHostname());
        }
        hypervisorsupport = new Ovm3HypervisorSupport(c, configuration);
        if (!configuration.getIsTest()) {
            hypervisorsupport.setupServer(configuration.getAgentSshKeyFileName());
        }
        hypervisorsupport.primaryCheck();
    } catch (Exception e) {
        throw new CloudRuntimeException("Base checks failed for " + configuration.getAgentHostname(), e);
    }
    hypervisornetwork = new Ovm3HypervisorNetwork(c, configuration);
    hypervisornetwork.configureNetworking();
    virtualroutingresource = new Ovm3VirtualRoutingResource(c);
    storagepool = new Ovm3StoragePool(c, configuration);
    storagepool.prepareForPool();
    storageprocessor = new Ovm3StorageProcessor(c, configuration, storagepool);
    vmsupport = new Ovm3VmSupport(c, configuration, hypervisorsupport, storageprocessor, storagepool, hypervisornetwork);
    vrResource = new VirtualRoutingResource(virtualroutingresource);
    if (!vrResource.configure(name, params)) {
        throw new ConfigurationException("Unable to configure VirtualRoutingResource");
    }
    guesttypes = new Ovm3VmGuestTypes();
    storageHandler = new StorageSubsystemCommandHandlerBase(storageprocessor);
    virtualroutingsupport = new Ovm3VirtualRoutingSupport(c, configuration, virtualroutingresource);
    setConfigParams(params);
    return true;
}
Also used : Connection(com.cloud.hypervisor.ovm3.objects.Connection) Ovm3HypervisorSupport(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorSupport) Ovm3VirtualRoutingSupport(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VirtualRoutingSupport) VirtualRoutingResource(com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource) StorageSubsystemCommandHandlerBase(com.cloud.storage.resource.StorageSubsystemCommandHandlerBase) ConfigurationException(javax.naming.ConfigurationException) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Ovm3ResourceException(com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException) Ovm3VmSupport(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmSupport) ConfigurationException(javax.naming.ConfigurationException) Ovm3VmGuestTypes(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmGuestTypes) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) Ovm3StoragePool(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3StoragePool) Ovm3HypervisorNetwork(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorNetwork) Ovm3Configuration(com.cloud.hypervisor.ovm3.resources.helpers.Ovm3Configuration)

Aggregations

VirtualMachineTO (com.cloud.agent.api.to.VirtualMachineTO)1 VirtualRoutingResource (com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource)1 Connection (com.cloud.hypervisor.ovm3.objects.Connection)1 Ovm3ResourceException (com.cloud.hypervisor.ovm3.objects.Ovm3ResourceException)1 Xen (com.cloud.hypervisor.ovm3.objects.Xen)1 Ovm3Configuration (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3Configuration)1 Ovm3HypervisorNetwork (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorNetwork)1 Ovm3HypervisorSupport (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3HypervisorSupport)1 Ovm3StoragePool (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3StoragePool)1 Ovm3VirtualRoutingSupport (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VirtualRoutingSupport)1 Ovm3VmGuestTypes (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmGuestTypes)1 Ovm3VmSupport (com.cloud.hypervisor.ovm3.resources.helpers.Ovm3VmSupport)1 StorageSubsystemCommandHandlerBase (com.cloud.storage.resource.StorageSubsystemCommandHandlerBase)1 BootloaderType (com.cloud.template.VirtualMachineTemplate.BootloaderType)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 VirtualMachine (com.cloud.vm.VirtualMachine)1 Type (com.cloud.vm.VirtualMachine.Type)1 ConfigurationException (javax.naming.ConfigurationException)1