Package com.cloud.storage

Examples of com.cloud.storage.TemplateProfile


   
    @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


            if(!_accountService.isRootAdmin(account.getType())){
                throw new PermissionDeniedException("Parameter templatetag 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

        if (cmd.getZoneId() == null && _s3Mgr.isS3Enabled()) {
            _s3Mgr.deleteTemplate(cmd.getId(), caller.getAccountId());
        }

      TemplateAdapter adapter = getAdapter(template.getHypervisorType());
      TemplateProfile profile = adapter.prepareDelete(cmd);
      boolean result = adapter.delete(profile);
     
      if (result){
            if (cmd.getZoneId() == null
                    && (_swiftMgr.isSwiftEnabled() || _s3Mgr.isS3Enabled())) {
View Full Code Here

      if (zoneId != null && (_ssvmMgr.findSecondaryStorageHost(zoneId) == null)) {
        throw new InvalidParameterValueException("Failed to find a secondary storage host in the specified zone.");
      }
      TemplateAdapter adapter = getAdapter(template.getHypervisorType());
      TemplateProfile profile = adapter.prepareDelete(cmd);
        boolean result = adapter.delete(profile);
        if (result) {
            if (cmd.getZoneId() == null
                    && (_swiftMgr.isSwiftEnabled() || _s3Mgr.isS3Enabled())) {
                List<VMTemplateZoneVO> templateZones = _tmpltZoneDao
View Full Code Here

            }
        }
       
        Long id = _tmpltDao.getNextInSequence(Long.class, "id");
        UserContext.current().setEventDetails("Id: " +id+ " name: " + name);
    return new TemplateProfile(id, userId, name, displayText, bits, passwordEnabled, requiresHVM, url, isPublic,
        featured, isExtractable, imgfmt, guestOSId, zoneId, hypervisorType, templateOwner.getAccountName(), templateOwner.getDomainId(), templateOwner.getAccountId(), chksum, bootable, templateTag, details, sshkeyEnabled);
  }
View Full Code Here

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

    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

    }
  }
 
  @Override
  public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException {
    TemplateProfile profile = super.prepare(cmd);
    String url = profile.getUrl();
   
    if((!url.toLowerCase().endsWith("iso"))&&(!url.toLowerCase().endsWith("iso.zip"))&&(!url.toLowerCase().endsWith("iso.bz2"))
            &&(!url.toLowerCase().endsWith("iso.gz"))){
          throw new InvalidParameterValueException("Please specify a valid iso");
        }
   
    profile.setUrl(validateUrl(url));
    return profile;
  }
View Full Code Here

    return profile;
  }
 
  @Override
  public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
    TemplateProfile profile = super.prepare(cmd);
    String url = profile.getUrl();
   
    if((!url.toLowerCase().endsWith("vhd"))&&(!url.toLowerCase().endsWith("vhd.zip"))
          &&(!url.toLowerCase().endsWith("vhd.bz2"))&&(!url.toLowerCase().endsWith("vhd.gz"))
          &&(!url.toLowerCase().endsWith("qcow2"))&&(!url.toLowerCase().endsWith("qcow2.zip"))
          &&(!url.toLowerCase().endsWith("qcow2.bz2"))&&(!url.toLowerCase().endsWith("qcow2.gz"))
          &&(!url.toLowerCase().endsWith("ova"))&&(!url.toLowerCase().endsWith("ova.zip"))
          &&(!url.toLowerCase().endsWith("ova.bz2"))&&(!url.toLowerCase().endsWith("ova.gz"))
          &&(!url.toLowerCase().endsWith("img"))&&(!url.toLowerCase().endsWith("raw"))){
          throw new InvalidParameterValueException("Please specify a valid "+ cmd.getFormat().toLowerCase());
      }
   
    if ((cmd.getFormat().equalsIgnoreCase("vhd") && (!url.toLowerCase().endsWith("vhd") && !url.toLowerCase().endsWith("vhd.zip") && !url.toLowerCase().endsWith("vhd.bz2") && !url.toLowerCase().endsWith("vhd.gz") ))
      || (cmd.getFormat().equalsIgnoreCase("qcow2") && (!url.toLowerCase().endsWith("qcow2") && !url.toLowerCase().endsWith("qcow2.zip") && !url.toLowerCase().endsWith("qcow2.bz2") && !url.toLowerCase().endsWith("qcow2.gz") ))
      || (cmd.getFormat().equalsIgnoreCase("ova") && (!url.toLowerCase().endsWith("ova") && !url.toLowerCase().endsWith("ova.zip") && !url.toLowerCase().endsWith("ova.bz2") && !url.toLowerCase().endsWith("ova.gz")))
      || (cmd.getFormat().equalsIgnoreCase("raw") && (!url.toLowerCase().endsWith("img") && !url.toLowerCase().endsWith("raw")))) {
          throw new InvalidParameterValueException("Please specify a valid URL. URL:" + url + " is an invalid for the format " + cmd.getFormat().toLowerCase());
    }
   
    profile.setUrl(validateUrl(url));
    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.