Examples of VirtualMachineTemplate


Examples of com.cloud.template.VirtualMachineTemplate

        ReservationContext ctx = start.second();
        ItWorkVO work = start.third();

        VMInstanceVO startedVm = null;
        ServiceOfferingVO offering = _offeringDao.findById(vm.getId(), vm.getServiceOfferingId());
        VirtualMachineTemplate template = _entityMgr.findByIdIncludingRemoved(VirtualMachineTemplate.class, vm.getTemplateId());

        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Trying to deploy VM, vm has dcId: " + vm.getDataCenterId() + " and podId: " + vm.getPodIdToDeployIn());
        }
        DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vm.getPodIdToDeployIn(), null, null, null, null, ctx);
        if (planToDeploy != null && planToDeploy.getDataCenterId() != 0) {
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("advanceStart: DeploymentPlan is provided, using dcId:" + planToDeploy.getDataCenterId() + ", podId: " + planToDeploy.getPodId() + ", clusterId: " +
                        planToDeploy.getClusterId() + ", hostId: " + planToDeploy.getHostId() + ", poolId: " + planToDeploy.getPoolId());
            }
            plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(),
                    planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId(), ctx);
        }

        HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());

        boolean canRetry = true;
        ExcludeList avoids = null;
        try {
            Journal journal = start.second().getJournal();

            if (planToDeploy != null) {
                avoids = planToDeploy.getAvoids();
            }
            if (avoids == null) {
                avoids = new ExcludeList();
            }
            if (s_logger.isDebugEnabled()) {
                s_logger.debug("Deploy avoids pods: " + avoids.getPodsToAvoid() + ", clusters: " + avoids.getClustersToAvoid() + ", hosts: " + avoids.getHostsToAvoid());
            }

            boolean planChangedByVolume = false;
            boolean reuseVolume = true;
            DataCenterDeployment originalPlan = plan;

            int retry = StartRetry.value();
            while (retry-- != 0) { // It's != so that it can match -1.

                if (reuseVolume) {
                    // edit plan if this vm's ROOT volume is in READY state already
                    List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
                    for (VolumeVO vol : vols) {
                        // make sure if the templateId is unchanged. If it is changed,
                        // let planner
                        // reassign pool for the volume even if it ready.
                        Long volTemplateId = vol.getTemplateId();
                        if (volTemplateId != null && volTemplateId.longValue() != template.getId()) {
                            if (s_logger.isDebugEnabled()) {
                                s_logger.debug(vol + " of " + vm + " is READY, but template ids don't match, let the planner reassign a new pool");
                            }
                            continue;
                        }
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

    }

    @Override
    public void createAsync(DataStore dataStore, DataObject data, AsyncCompletionCallback<CreateCmdResult> callback) {
        Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
        VirtualMachineTemplate tmpl = _templateDao.findById(data.getId());
        DataStore cacheStore = cacheManager.getCacheStorage(dataStore.getScope());
        DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(data.getTO()), maxTemplateSizeInBytes);
        dcmd.setCacheStore(cacheStore.getTO());
        dcmd.setProxy(getHttpProxy());
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

                throw new InvalidParameterValueException("Unable to find zone ID " + zoneId);
            }

            Account owner = _accountService.getActiveAccountById(getEntityOwnerId());

            VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);
            if (template == null) {
                throw new InvalidParameterValueException("Invalid template ID " + templateId);
            }

            ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

            ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
            if (serviceOffering == null) {
                throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
            }

            VirtualMachineTemplate template = _templateService.getTemplate(templateId);
            // Make sure a valid template ID was specified
            if (template == null) {
                throw new InvalidParameterValueException("Unable to use template " + templateId);
            }
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

        return ViewResponseHelper.createTemplateResponse(tvo.toArray(new TemplateJoinVO[tvo.size()]));
    }

    @Override
    public List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly) {
        VirtualMachineTemplate template = findTemplateById(templateId);
        return createTemplateResponses(template, zoneId, readyOnly);
    }
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

    }

    @Override
    public TemplatePermissionsResponse createTemplatePermissionsResponse(List<String> accountNames, Long id, boolean isAdmin) {
        Long templateOwnerDomain = null;
        VirtualMachineTemplate template = ApiDBUtils.findTemplateById(id);
        Account templateOwner = ApiDBUtils.findAccountById(template.getAccountId());
        if (isAdmin) {
            // FIXME: we have just template id and need to get template owner
            // from that
            if (templateOwner != null) {
                templateOwnerDomain = templateOwner.getDomainId();
            }
        }

        TemplatePermissionsResponse response = new TemplatePermissionsResponse();
        response.setId(template.getUuid());
        response.setPublicTemplate(template.isPublicTemplate());
        if (isAdmin && (templateOwnerDomain != null)) {
            Domain domain = ApiDBUtils.findDomainById(templateOwnerDomain);
            if (domain != null) {
                response.setDomainId(domain.getUuid());
            }
View Full Code Here

Examples of com.cloud.template.VirtualMachineTemplate

        }

        Long maxTemplateSizeInBytes = getMaxTemplateSizeInBytes();
        if (vmTemplateStore != null) {
            start();
            VirtualMachineTemplate tmpl = this._templateDao.findById(template.getId());
            DownloadCommand dcmd = new DownloadCommand((TemplateObjectTO)(template.getTO()), maxTemplateSizeInBytes);
            dcmd.setProxy(getHttpProxy());
            if (downloadJobExists) {
                dcmd = new DownloadProgressCommand(dcmd, vmTemplateStore.getJobId(), RequestType.GET_OR_RESTART);
            }
View Full Code Here

Examples of org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate

      // Get the region where the template is available
      Datacenter datacenter = regionMap.get().get(Integer.valueOf(template.getImage().getLocation().getId()));

      // Load the template
      VirtualMachineTemplate virtualMachineTemplate = enterprise.getTemplateInRepository(datacenter,
            Integer.valueOf(template.getImage().getId()));

      // Get the zone where the template will be deployed
      VirtualDatacenter vdc = cloudService.getVirtualDatacenter(Integer.valueOf(template.getHardware().getLocation()
            .getId()));
View Full Code Here

Examples of org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate

      // Get the region where the template is available
      Datacenter datacenter = regionMap.get().get(Integer.valueOf(template.getImage().getLocation().getId()));

      // Load the template
      VirtualMachineTemplate virtualMachineTemplate = enterprise.getTemplateInRepository(datacenter,
            Integer.valueOf(template.getImage().getId()));

      Integer overrideCores = options.getOverrideCores();
      Integer overrideRam = options.getOverrideRam();
View Full Code Here

Examples of org.jclouds.abiquo.domain.cloud.VirtualMachineTemplate

      dto.setDescription("Template description");
      dto.setHdRequired(50L * 1024 * 1024 * 1024); // 50 GB
      dto.setCpuRequired(5);
      dto.setRamRequired(2048);
      dto.addLink(new RESTLink("edit", "http://foo/bar"));
      VirtualMachineTemplate template = wrap(context, VirtualMachineTemplate.class, dto);

      VirtualDatacenterDto vdcDto = new VirtualDatacenterDto();
      vdcDto.setId(6);
      vdcDto.setHypervisorType(HypervisorType.VMX_04);
      VirtualDatacenter vdc = wrap(context, VirtualDatacenter.class, vdcDto);

      Hardware hardware = function.apply(new VirtualMachineTemplateInVirtualDatacenter(template, vdc));

      verify(vdcToLocation);

      assertEquals(hardware.getProviderId(), template.getId().toString());
      assertEquals(hardware.getId(), template.getId() + "/" + vdc.getId());
      assertEquals(hardware.getName(), template.getName());
      assertEquals(hardware.getUri(), URI.create("http://foo/bar"));

      assertEquals(hardware.getRam(), template.getRamRequired().intValue());
      assertEquals(hardware.getProcessors().size(), 1);
      assertEquals(hardware.getProcessors().get(0).getCores(), (double) template.getCpuRequired());
      assertEquals(hardware.getProcessors().get(0).getSpeed(),
            VirtualMachineTemplateInVirtualDatacenterToHardware.DEFAULT_CORE_SPEED);

      assertEquals(hardware.getVolumes().size(), 1);
      assertEquals(hardware.getVolumes().get(0).getSize(), 50F);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.