Package com.cloud.storage

Examples of com.cloud.storage.TemplateProfile


        if (template.getFormat() == ImageFormat.ISO) {
            throw new InvalidParameterValueException("Please specify a valid template.");
        }

        return new TemplateProfile(userId, template, zoneId);
    }
View Full Code Here


        VMTemplateVO template = _tmpltDao.findById(templateId.longValue());
        if (template == null) {
            throw new InvalidParameterValueException("unable to find template with id " + templateId);
        }
        return new TemplateProfile(userId, template, zoneId);
    }
View Full Code Here

        if (template.getFormat() != ImageFormat.ISO) {
            throw new InvalidParameterValueException("Please specify a valid iso.");
        }

        return new TemplateProfile(userId, template, zoneId);
    }
View Full Code Here

        return TemplateAdapterType.BareMetal.getName();
    }

  @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.BaremetalPxe, 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.BaremetalPxe, 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

    @Override
    @ActionEvent(eventType = EventTypes.EVENT_ISO_CREATE, eventDescription = "creating iso")
    public VirtualMachineTemplate registerIso(RegisterIsoCmd cmd) throws ResourceAllocationException {
        TemplateAdapter adapter = getAdapter(HypervisorType.None);
        TemplateProfile profile = adapter.prepare(cmd);
        VMTemplateVO template = adapter.create(profile);

        if (template != null) {
            return template;
        } else {
View Full Code Here

                throw new PermissionDeniedException("Parameter isrouting can only be specified by a Root Admin, permission denied");
            }
        }

        TemplateAdapter adapter = getAdapter(HypervisorType.getType(cmd.getHypervisor()));
        TemplateProfile profile = adapter.prepare(cmd);
        VMTemplateVO template = adapter.create(profile);

        if (template != null) {
            return template;
        } else {
View Full Code Here

        if (template == null || template.getRemoved() != null) {
            throw new InvalidParameterValueException("Please specify a valid template.");
        }

        TemplateAdapter adapter = getAdapter(template.getHypervisorType());
        return adapter.delete(new TemplateProfile(userId, template, zoneId));
    }
View Full Code Here

        template.setState(VirtualMachineTemplate.State.Inactive);
        _tmpltDao.update(template.getId(), template);

        TemplateAdapter adapter = getAdapter(template.getHypervisorType());
        TemplateProfile profile = adapter.prepareDelete(cmd);
        return adapter.delete(profile);
    }
View Full Code Here

        template.setState(VirtualMachineTemplate.State.Inactive);
        _tmpltDao.update(template.getId(), template);

        TemplateAdapter adapter = getAdapter(template.getHypervisorType());
        TemplateProfile profile = adapter.prepareDelete(cmd);
        boolean result = adapter.delete(profile);
        if (result) {
            return true;
        } else {
            throw new CloudRuntimeException("Failed to delete ISO");
View Full Code Here

        return TemplateAdapterType.BareMetal.getName();
    }

    @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.BaremetalPxe, 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.BaremetalPxe, 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

TOP

Related Classes of com.cloud.storage.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.