Package com.cloud.template

Examples of com.cloud.template.TemplateProfile


  @Inject HostDao _hostDao;
  @Inject ResourceManager _resourceMgr;
 
  @Override
  public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
    TemplateProfile profile = super.prepare(cmd);
   
    if (profile.getZoneId() == null || profile.getZoneId() == -1) {
      List<DataCenterVO> dcs = _dcDao.listAllIncludingRemoved();
      for (DataCenterVO dc : dcs) {
        List<HostVO> pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.PxeServer, dc.getId());
        if (pxeServers.size() == 0) {
          throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + dc.getName());
        }
      }
    } else {
      List<HostVO> pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.PxeServer, profile.getZoneId());
      if (pxeServers.size() == 0) {
        throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + profile.getZoneId());
      }
    }
   
    return profile;
  }
View Full Code Here


        Long userId = UserContext.current().getCallerUserId();
        userId = (userId == null ? User.UID_SYSTEM : userId);
        AccountVO account = _accountDao.findById(vm.getAccountId());
     
        try {
            TemplateProfile tmplProfile;
            tmplProfile = adapter.prepare(false, userId, cmd.getTemplateName(), cmd.getDisplayText(), cmd.getBits(), false, false, cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(), false,
                    "BareMetal", cmd.getOsTypeId(), pxe.getDataCenterId(), HypervisorType.BareMetal, account.getAccountName(), account.getDomainId(), "0", true, cmd.getDetails());
            if (!_pxeMgr.prepareCreateTemplate(_pxeMgr.getPxeServerType(pxe), pxe.getId(), vm, cmd.getUrl())) {
                throw new Exception("Prepare PXE boot file for host  " + hostId + " failed");
View Full Code Here

TOP

Related Classes of com.cloud.template.TemplateProfile

Copyright © 2018 www.massapicom. 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.