Package com.cloud.storage

Examples of com.cloud.storage.VMTemplateZoneVO


            for (DataCenterVO zone : zones) {
                dcs.add(zone.getId());
            }
        }
        for (Long id : dcs) {
            VMTemplateZoneVO tmpltZoneVO = _vmTemplateZoneDao.findByZoneTemplate(id, templateId);
            if (tmpltZoneVO == null) {
                tmpltZoneVO = new VMTemplateZoneVO(id, templateId, new Date());
                _vmTemplateZoneDao.persist(tmpltZoneVO);
            } else {
                tmpltZoneVO.setLastUpdated(new Date());
                _vmTemplateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
            }
        }
    }
View Full Code Here


    }

    // update template_zone_ref for cross-zone template for newly added zone
    @Override
    public void associateCrosszoneTemplatesToZone(long dcId) {
        VMTemplateZoneVO tmpltZone;

        List<VMTemplateVO> allTemplates = _templateDao.listAll();
        for (VMTemplateVO vt : allTemplates) {
            if (vt.isCrossZones()) {
                tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
                if (tmpltZone == null) {
                    VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
                    _vmTemplateZoneDao.persist(vmTemplateZone);
                }
            }
        }
    }
View Full Code Here

                UsageEventVO usageEvent = new UsageEventVO(eventType, account.getId(), dc.getId(), templateId, null);
                _usageEventDao.persist(usageEvent);
            }
        }

        VMTemplateZoneVO templateZone = _tmpltZoneDao.findByZoneTemplate(profile.getZoneId(), templateId);

        if (templateZone != null) {
            _tmpltZoneDao.remove(templateZone.getId());
        }

        s_logger.debug("Successfully marked template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName);

        // If there are no more non-destroyed template host entries for this template, delete it
View Full Code Here

            associateTemplatesToZone(h.getId(), h.getDataCenterId());
        }
    }

    private void associateTemplatesToZone(long hostId, long dcId) {
        VMTemplateZoneVO tmpltZone;

        List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
        for (VMTemplateVO vt : allTemplates) {
            if (vt.isCrossZones()) {
                tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
                if (tmpltZone == null) {
                    VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
                    _vmTemplateZoneDao.persist(vmTemplateZone);
                }
            }
        }
    }
View Full Code Here

            }
            if (tmplt.getDetails() != null) {
                _templateDetailsDao.persist(tmplt.getId(), tmplt.getDetails());
            }
        }
        VMTemplateZoneVO tmpltZoneVO = _templateZoneDao.findByZoneTemplate(zoneId, tmplt.getId());
        if (tmpltZoneVO == null) {
            tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
            _templateZoneDao.persist(tmpltZoneVO);
        } else {
            tmpltZoneVO.setRemoved(null);
            tmpltZoneVO.setLastUpdated(new Date());
            _templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
        }
        txn.commit();

        return tmplt.getId();
    }
View Full Code Here

                    privateTemplate = null;
                    s_logger.debug("Failed to create template" + result.getResult());
                    throw new CloudRuntimeException("Failed to create template" + result.getResult());
                }

                VMTemplateZoneVO templateZone = new VMTemplateZoneVO(zoneId, templateId, new Date());
                this._tmpltZoneDao.persist(templateZone);

                privateTemplate = this._tmpltDao.findById(templateId);
                if (snapshotId != null) {
                    //getting the prent volume
View Full Code Here

    }
   
  }
 
    private void associateTemplatesToZone(long hostId, long dcId){
      VMTemplateZoneVO tmpltZone;

      List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
      for (VMTemplateVO vt: allTemplates){
        if (vt.isCrossZones()) {
          tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
          if (tmpltZone == null) {
            VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());
            _vmTemplateZoneDao.persist(vmTemplateZone);
          }
        }
      }
    }
View Full Code Here

        }
        VMTemplateSwiftVO tmpltSwiftRef = _vmTmpltSwiftlDao.findOneByTemplateId(tmpltId);
        if (tmpltSwiftRef != null) {
            List<DataCenterVO> dcs = _dcDao.listAll();
            for (DataCenterVO dc : dcs) {
                VMTemplateZoneVO tmpltZoneVO = new VMTemplateZoneVO(dc.getId(), tmpltId, new Date());
                try {
                    _vmTmpltZoneDao.persist(tmpltZoneVO);
                } catch (Exception e) {
                }
            }
View Full Code Here

        }
        for (VMTemplateSwiftVO tmpltSwiftRef : tmpltSwiftRefs) {
            Long tmpltId = tmpltSwiftRef.getTemplateId();
            if (!tmpltIds.contains(tmpltId)) {
                tmpltIds.add(tmpltId);
                VMTemplateZoneVO tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmpltId, new Date());
                try {
                    _vmTmpltZoneDao.persist(tmpltZoneVO);
                } catch (Exception e) {
                }
            }
View Full Code Here

      }
      if(tmplt.getDetails() != null) {
        _templateDetailsDao.persist(tmplt.getId(), tmplt.getDetails());
      }
    }
    VMTemplateZoneVO tmpltZoneVO = _templateZoneDao.findByZoneTemplate(zoneId, tmplt.getId());
    if (tmpltZoneVO == null ) {
        tmpltZoneVO = new VMTemplateZoneVO(zoneId, tmplt.getId(), new Date());
        _templateZoneDao.persist(tmpltZoneVO);
    } else {
        tmpltZoneVO.setRemoved(null);
        tmpltZoneVO.setLastUpdated(new Date());
        _templateZoneDao.update(tmpltZoneVO.getId(), tmpltZoneVO);
    }
    txn.commit();
   
    return tmplt.getId();
  }
View Full Code Here

TOP

Related Classes of com.cloud.storage.VMTemplateZoneVO

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.