本文整理了Java中org.ovirt.engine.core.common.businessentities.Quota.getQuotaStorages
方法的一些代码示例,展示了Quota.getQuotaStorages
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.getQuotaStorages
方法的具体详情如下:
包路径:org.ovirt.engine.core.common.businessentities.Quota
类名称:Quota
方法名:getQuotaStorages
暂无
代码示例来源:origin: oVirt/ovirt-engine
/**
* @return If the storage quota is empty, returns true.
*/
public boolean isEmptyStorageQuota() {
return globalQuotaStorage == null && (getQuotaStorages() == null || getQuotaStorages().isEmpty());
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
protected void updateEntityForRemove(Quota entity, Guid id) {
// since we're mocking remove using update, we'll throw 404 if the object isn't found
boolean throw404 = false;
// global storage (has same id as quota)
if (entity.getId().equals(id)) {
if (entity.getGlobalQuotaStorage() == null) {
throw404 = true;
} else {
entity.setGlobalQuotaStorage(null);
}
// specific storage (has same id as storage domain)
} else {
if (entity.getQuotaStorages() != null) {
for (int i = 0; i < entity.getQuotaStorages().size(); i++) {
if (entity.getQuotaStorages().get(i).getStorageId().equals(id)) {
entity.getQuotaStorages().remove(i);
return;
}
}
throw404 = true;
}
}
if (throw404) {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
}
}
代码示例来源:origin: oVirt/ovirt-engine
private void saveStorageSpecificQuotas(Quota quota) {
// Add quota specific storage domains limitations.
for (QuotaStorage quotaStorage : quota.getQuotaStorages()) {
getCallsHandler().executeModification("InsertQuotaLimitation",
getQuotaStorageParameterMap(quota.getId(), quotaStorage));
}
}
代码示例来源:origin: oVirt/ovirt-engine
@Override
public QuotaStorageLimits list() {
Quota quota = getQuota();
QuotaStorageLimits limits = new QuotaStorageLimits();
if (quota.getGlobalQuotaStorage() != null) {
addLimit(quotaId.toString(), limits, quota);
} else if (quota.getQuotaStorages() != null) {
for (QuotaStorage quotaStorage : quota.getQuotaStorages()) {
addLimit(quotaStorage.getStorageId().toString(), limits, quota);
}
}
return limits;
}
代码示例来源:origin: oVirt/ovirt-engine
quota.setGlobalQuotaStorage(quotaStorage);
} else {
if (quota.getQuotaStorages() == null) {
quota.setQuotaStorages(new ArrayList<>());
quota.getQuotaStorages().add(quotaStorage);
代码示例来源:origin: oVirt/ovirt-engine
@Mapping(from = QuotaStorageLimit.class, to = org.ovirt.engine.core.common.businessentities.Quota.class)
public static org.ovirt.engine.core.common.businessentities.Quota map(QuotaStorageLimit model,
org.ovirt.engine.core.common.businessentities.Quota template) {
org.ovirt.engine.core.common.businessentities.Quota entity =
template != null ? template : new org.ovirt.engine.core.common.businessentities.Quota();
QuotaStorage quotaStorage = new QuotaStorage();
if (model.isSetLimit()) {
quotaStorage.setStorageSizeGB(model.getLimit());
}
// specific SD
if(model.isSetStorageDomain() && model.getStorageDomain().isSetId()) {
quotaStorage.setStorageId(GuidUtils.asGuid(model.getStorageDomain().getId()));
entity.getQuotaStorages().add(quotaStorage);
} else { // global
entity.setGlobalQuotaStorage(quotaStorage);
}
return entity;
}
代码示例来源:origin: oVirt/ovirt-engine
@Mapping(from = org.ovirt.engine.core.common.businessentities.Quota.class, to = QuotaStorageLimit.class)
public static QuotaStorageLimit map(org.ovirt.engine.core.common.businessentities.Quota entity,
QuotaStorageLimit template) {
QuotaStorageLimit model = template != null ? template : new QuotaStorageLimit();
Guid guid = GuidUtils.asGuid(model.getId());
// global
if (guid.equals(entity.getId())) {
map(model, entity.getGlobalQuotaStorage(), null, entity.getStoragePoolId().toString(), entity.getId()
.toString());
} else { // specific
if (entity.getQuotaStorages() != null) {
for (QuotaStorage quotaStorage : entity.getQuotaStorages()) {
if (quotaStorage.getStorageId() != null && quotaStorage.getStorageId().equals(guid)) {
map(model, quotaStorage, quotaStorage.getStorageId().toString(), entity.getStoragePoolId()
.toString(), entity.getId().toString());
}
}
}
}
return model;
}
代码示例来源:origin: oVirt/ovirt-engine
quota.setGlobalQuotaStorage(new QuotaStorage());
quota.getGlobalQuotaStorage().setStorageSizeGB(iter.getStorageSizeGB());
quota.getQuotaStorages().clear();
代码示例来源:origin: oVirt/ovirt-engine
quotaStorage.setQuotaId(quota.getId());
boolean containStorage = false;
for (QuotaStorage iter : quota.getQuotaStorages()) {
if (quotaStorage.getStorageId().equals(iter.getStorageId())) {
quotaStorage.setQuotaStorageId(iter.getQuotaStorageId());
内容来源于网络,如有侵权,请联系作者删除!