public VolumeTO(Volume volume, StoragePool pool) { this.id = volume.getId(); this.name = volume.getName(); this.path = volume.getPath(); this.size = volume.getSize(); this.type = volume.getVolumeType(); this.storagePoolType = pool.getPoolType(); this.storagePoolUuid = pool.getUuid(); this.mountPoint = volume.getFolder(); this.chainInfo = volume.getChainInfo(); this.chainSize = volume.getVmSnapshotChainSize(); if (volume.getDeviceId() != null) this.deviceId = volume.getDeviceId(); }
@Override public void updateDisplay(Volume volume, Boolean displayVolume) { // 1. Resource limit changes updateResourceCount(volume, displayVolume); // 2. generate usage event if not in destroyed state saveUsageEvent(volume, displayVolume); // 3. Set the flag if (displayVolume != null && displayVolume != volume.isDisplayVolume()) { // FIXME - Confused - typecast for now. ((VolumeVO)volume).setDisplayVolume(displayVolume); _volsDao.update(volume.getId(), (VolumeVO)volume); } }
@Override public boolean equals(Object obj) { if (obj instanceof VMTemplateHostVO) { VMTemplateHostVO other = (VMTemplateHostVO)obj; return (this.templateId == other.getTemplateId() && this.hostId == other.getHostId()); } return false; }
public StorageFilerTO(StoragePool pool) { this.id = pool.getId(); this.host = pool.getHostAddress(); this.port = pool.getPort(); this.path = pool.getPath(); this.type = pool.getPoolType(); this.uuid = pool.getUuid(); this.userInfo = pool.getUserInfo(); }
@Override public long getUsedIops(StoragePool storagePool) { long usedIops = 0; List<VolumeVO> volumes = volumeDao.findByPoolId(storagePool.getId(), null); if (volumes != null) { for (VolumeVO volume : volumes) { if (!Volume.State.Creating.equals(volume.getState())) { usedIops += volume.getMinIops() != null ? volume.getMinIops() : 0; } } } return usedIops; }
/** * Sets the volume path as the iScsi name in case of a configured iScsi. */ protected void setVolumePath(VolumeVO volume) { volume.setPath(volume.get_iScsiName()); }
private boolean isPrivateTemplate(VMTemplateVO template){ // if public OR featured OR system template if(template.isPublicTemplate() || template.isFeatured() || template.getTemplateType() == TemplateType.SYSTEM) return false; else return true; }
@Override public boolean equals(Object obj) { if (obj instanceof UploadVO) { UploadVO other = (UploadVO)obj; return (this.typeId == other.getTypeId() && this.dataStoreId == other.getDataStoreId() && this.type == other.getType()); } return false; }
@Override public boolean equals(Object obj) { if (obj instanceof VMTemplateStoragePoolVO) { VMTemplateStoragePoolVO other = (VMTemplateStoragePoolVO)obj; return (this.templateId == other.getTemplateId() && this.poolId == other.getPoolId()); } return false; }
public static VMTemplateVO createPreHostIso(Long id, String uniqueName, String name, ImageFormat format, boolean isPublic, boolean featured, TemplateType type, String url, Date created, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType) { VMTemplateVO template = new VMTemplateVO(id, uniqueName, name, format, isPublic, featured, type, url, created, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType); return template; }
@Override public String getUrl() { if (url != null) { return url; } return imageVO.getUrl(); }
@Override public boolean isDirectDownload() { if (this.imageVO == null) { return false; } return this.imageVO.isDirectDownload(); }
@Override public boolean registerHostListener(String providerName, HypervisorHostListener listener) { return storageMgr.registerHostListener(providerName, listener); } }