mirror of https://github.com/apache/cloudstack.git
remove domain id usage
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
9c117f2781
commit
7721126076
|
|
@ -59,8 +59,6 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
|
||||||
|
|
||||||
boolean isUseLocalStorage();
|
boolean isUseLocalStorage();
|
||||||
|
|
||||||
Long getDomainId();
|
|
||||||
|
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
boolean isSystemUse();
|
boolean isSystemUse();
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,6 @@ public interface ServiceOffering extends DiskOffering, InfrastructureEntity, Int
|
||||||
@Override
|
@Override
|
||||||
boolean isUseLocalStorage();
|
boolean isUseLocalStorage();
|
||||||
|
|
||||||
@Override
|
|
||||||
Long getDomainId();
|
Long getDomainId();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
package org.apache.cloudstack.api.response;
|
package org.apache.cloudstack.api.response;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
import org.apache.cloudstack.api.ApiConstants;
|
||||||
import org.apache.cloudstack.api.BaseResponse;
|
import org.apache.cloudstack.api.BaseResponse;
|
||||||
|
|
@ -35,13 +33,21 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||||
@Param(description = "the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
@Param(description = "the domain ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
||||||
private String domainId;
|
private String domainId;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.DOMAIN)
|
@SerializedName(ApiConstants.DOMAIN)
|
||||||
@Param(description = "the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
@Param(description = "the domain name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.")
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ZONE_ID)
|
||||||
|
@Param(description = "the zone ID(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0")
|
||||||
|
private String zoneId;
|
||||||
|
|
||||||
|
@SerializedName(ApiConstants.ZONE)
|
||||||
|
@Param(description = "the zone name(s) this disk offering belongs to. Ignore this information as it is not currently applicable.", since = "4.13.0")
|
||||||
|
private String zone;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.NAME)
|
@SerializedName(ApiConstants.NAME)
|
||||||
@Param(description = "the name of the disk offering")
|
@Param(description = "the name of the disk offering")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
@ -145,10 +151,6 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||||
@Param(description = "whether to display the offering to the end user or not.")
|
@Param(description = "whether to display the offering to the end user or not.")
|
||||||
private Boolean displayOffering;
|
private Boolean displayOffering;
|
||||||
|
|
||||||
@SerializedName(ApiConstants.DETAILS)
|
|
||||||
@Param(description = "the details of the disk offering", since = "4.13.0")
|
|
||||||
private Map<String, Object> details = new HashMap<>();
|
|
||||||
|
|
||||||
public Boolean getDisplayOffering() {
|
public Boolean getDisplayOffering() {
|
||||||
return displayOffering;
|
return displayOffering;
|
||||||
}
|
}
|
||||||
|
|
@ -182,6 +184,22 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||||
this.domain = domain;
|
this.domain = domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getZoneId() {
|
||||||
|
return zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoneId(String zoneId) {
|
||||||
|
this.zoneId = zoneId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZone() {
|
||||||
|
return zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZone(String zone) {
|
||||||
|
this.zone = zone;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
@ -333,16 +351,4 @@ public class DiskOfferingResponse extends BaseResponse {
|
||||||
public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) {
|
public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) {
|
||||||
this.iopsWriteRateMaxLength = iopsWriteRateMaxLength;
|
this.iopsWriteRateMaxLength = iopsWriteRateMaxLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getDetails() {
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void putDetail(String key, Object value) {
|
|
||||||
this.details.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDetails(Map<String, Object> details) {
|
|
||||||
this.details = details;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@ import com.cloud.vm.VirtualMachine;
|
||||||
@DiscriminatorValue(value = "Service")
|
@DiscriminatorValue(value = "Service")
|
||||||
@PrimaryKeyJoinColumn(name = "id")
|
@PrimaryKeyJoinColumn(name = "id")
|
||||||
public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
|
public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
|
||||||
|
@Column(name = "domain_id")
|
||||||
|
Long domainId;
|
||||||
|
|
||||||
@Column(name = "cpu")
|
@Column(name = "cpu")
|
||||||
private Integer cpu;
|
private Integer cpu;
|
||||||
|
|
||||||
|
|
@ -106,7 +109,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
|
|
||||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
|
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
|
||||||
boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vmType, Long domainId) {
|
boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vmType, Long domainId) {
|
||||||
super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
|
super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true);
|
||||||
|
this.domainId = domainId;
|
||||||
this.cpu = cpu;
|
this.cpu = cpu;
|
||||||
this.ramSize = ramSize;
|
this.ramSize = ramSize;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
|
@ -177,9 +181,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
offering.isSystemUse(),
|
offering.isSystemUse(),
|
||||||
true,
|
true,
|
||||||
offering.isCustomizedIops()== null ? false:offering.isCustomizedIops(),
|
offering.isCustomizedIops()== null ? false:offering.isCustomizedIops(),
|
||||||
offering.getDomainId(),
|
|
||||||
offering.getMinIops(),
|
offering.getMinIops(),
|
||||||
offering.getMaxIops());
|
offering.getMaxIops());
|
||||||
|
domainId = offering.getDomainId();
|
||||||
cpu = offering.getCpu();
|
cpu = offering.getCpu();
|
||||||
ramSize = offering.getRamSize();
|
ramSize = offering.getRamSize();
|
||||||
speed = offering.getSpeed();
|
speed = offering.getSpeed();
|
||||||
|
|
@ -192,6 +196,11 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
vmType = offering.getSystemVmType();
|
vmType = offering.getSystemVmType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOfferHA() {
|
public boolean isOfferHA() {
|
||||||
return offerHA;
|
return offerHA;
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,6 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
@Column(name = "id")
|
@Column(name = "id")
|
||||||
long id;
|
long id;
|
||||||
|
|
||||||
// TODO: remove me
|
|
||||||
@Column(name = "domain_id")
|
|
||||||
Long domainId = null;
|
|
||||||
|
|
||||||
@Column(name = "unique_name")
|
@Column(name = "unique_name")
|
||||||
private String uniqueName;
|
private String uniqueName;
|
||||||
|
|
||||||
|
|
@ -164,9 +160,8 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
uuid = UUID.randomUUID().toString();
|
uuid = UUID.randomUUID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskOfferingVO(Long domainId, String name, String displayText, Storage.ProvisioningType provisioningType, long diskSize, String tags, boolean isCustomized, Boolean isCustomizedIops,
|
public DiskOfferingVO(String name, String displayText, Storage.ProvisioningType provisioningType, long diskSize, String tags, boolean isCustomized, Boolean isCustomizedIops,
|
||||||
Long minIops, Long maxIops, DiskCacheMode cacheMode) {
|
Long minIops, Long maxIops, DiskCacheMode cacheMode) {
|
||||||
this.domainId = domainId;
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.displayText = displayText;
|
this.displayText = displayText;
|
||||||
this.provisioningType = provisioningType;
|
this.provisioningType = provisioningType;
|
||||||
|
|
@ -201,28 +196,8 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
state = State.Active;
|
state = State.Active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DiskOfferingVO(Long domainId, String name, String displayText, Storage.ProvisioningType provisioningType, long diskSize, String tags, boolean isCustomized, Boolean isCustomizedIops,
|
|
||||||
Long minIops, Long maxIops) {
|
|
||||||
this.domainId = domainId;
|
|
||||||
this.name = name;
|
|
||||||
this.displayText = displayText;
|
|
||||||
this.provisioningType = provisioningType;
|
|
||||||
this.diskSize = diskSize;
|
|
||||||
this.tags = tags;
|
|
||||||
recreatable = false;
|
|
||||||
type = Type.Disk;
|
|
||||||
useLocalStorage = false;
|
|
||||||
customized = isCustomized;
|
|
||||||
uuid = UUID.randomUUID().toString();
|
|
||||||
customizedIops = isCustomizedIops;
|
|
||||||
this.minIops = minIops;
|
|
||||||
this.maxIops = maxIops;
|
|
||||||
state = State.Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiskOfferingVO(String name, String displayText, Storage.ProvisioningType provisioningType, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse,
|
public DiskOfferingVO(String name, String displayText, Storage.ProvisioningType provisioningType, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse,
|
||||||
boolean customized) {
|
boolean customized) {
|
||||||
domainId = null;
|
|
||||||
type = Type.Service;
|
type = Type.Service;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.displayText = displayText;
|
this.displayText = displayText;
|
||||||
|
|
@ -236,26 +211,8 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
state = State.Active;
|
state = State.Active;
|
||||||
}
|
}
|
||||||
|
|
||||||
// domain specific offerings constructor (null domainId implies public
|
|
||||||
// offering)
|
|
||||||
public DiskOfferingVO(String name, String displayText, Storage.ProvisioningType provisioningType, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage, boolean systemUse,
|
|
||||||
boolean customized, Long domainId) {
|
|
||||||
type = Type.Service;
|
|
||||||
this.name = name;
|
|
||||||
this.displayText = displayText;
|
|
||||||
this.provisioningType = provisioningType;
|
|
||||||
this.tags = tags;
|
|
||||||
this.recreatable = recreatable;
|
|
||||||
this.useLocalStorage = useLocalStorage;
|
|
||||||
this.systemUse = systemUse;
|
|
||||||
this.customized = customized;
|
|
||||||
this.domainId = domainId;
|
|
||||||
uuid = UUID.randomUUID().toString();
|
|
||||||
state = State.Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiskOfferingVO(long id, String name, String displayText, Storage.ProvisioningType provisioningType, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage,
|
public DiskOfferingVO(long id, String name, String displayText, Storage.ProvisioningType provisioningType, boolean mirrored, String tags, boolean recreatable, boolean useLocalStorage,
|
||||||
boolean systemUse, boolean customized, boolean customizedIops, Long domainId, Long minIops, Long maxIops) {
|
boolean systemUse, boolean customized, boolean customizedIops, Long minIops, Long maxIops) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
type = Type.Service;
|
type = Type.Service;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
@ -267,7 +224,6 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
this.systemUse = systemUse;
|
this.systemUse = systemUse;
|
||||||
this.customized = customized;
|
this.customized = customized;
|
||||||
this.customizedIops = customizedIops;
|
this.customizedIops = customizedIops;
|
||||||
this.domainId = domainId;
|
|
||||||
uuid = UUID.randomUUID().toString();
|
uuid = UUID.randomUUID().toString();
|
||||||
state = State.Active;
|
state = State.Active;
|
||||||
this.minIops = minIops;
|
this.minIops = minIops;
|
||||||
|
|
@ -347,11 +303,6 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
return useLocalStorage;
|
return useLocalStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getDomainId() {
|
|
||||||
return domainId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
|
|
@ -362,10 +313,6 @@ public class DiskOfferingVO implements DiskOffering {
|
||||||
return recreatable;
|
return recreatable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDomainId(Long domainId) {
|
|
||||||
this.domainId = domainId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ import com.cloud.vm.VirtualMachine;
|
||||||
@DiscriminatorValue(value = "Service")
|
@DiscriminatorValue(value = "Service")
|
||||||
@PrimaryKeyJoinColumn(name = "id")
|
@PrimaryKeyJoinColumn(name = "id")
|
||||||
public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
|
public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering {
|
||||||
|
@Column(name = "domain_id")
|
||||||
|
Long domainId;
|
||||||
|
|
||||||
@Column(name = "cpu")
|
@Column(name = "cpu")
|
||||||
private Integer cpu;
|
private Integer cpu;
|
||||||
|
|
||||||
|
|
@ -103,7 +106,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
|
public ServiceOfferingVO(String name, Integer cpu, Integer ramSize, Integer speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse,
|
||||||
boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse,
|
boolean volatileVm, String displayText, ProvisioningType provisioningType, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse,
|
||||||
VirtualMachine.Type vmType, Long domainId) {
|
VirtualMachine.Type vmType, Long domainId) {
|
||||||
super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
|
super(name, displayText, provisioningType, false, tags, recreatable, useLocalStorage, systemUse, true);
|
||||||
|
this.domainId = domainId;
|
||||||
this.cpu = cpu;
|
this.cpu = cpu;
|
||||||
this.ramSize = ramSize;
|
this.ramSize = ramSize;
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
|
|
@ -133,8 +137,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
|
|
||||||
public ServiceOfferingVO(ServiceOfferingVO offering) {
|
public ServiceOfferingVO(ServiceOfferingVO offering) {
|
||||||
super(offering.getId(), offering.getName(), offering.getDisplayText(), offering.getProvisioningType(), false, offering.getTags(), offering.isRecreatable(),
|
super(offering.getId(), offering.getName(), offering.getDisplayText(), offering.getProvisioningType(), false, offering.getTags(), offering.isRecreatable(),
|
||||||
offering.isUseLocalStorage(), offering.isSystemUse(), true, offering.isCustomizedIops() == null ? false : offering.isCustomizedIops(), offering.getDomainId(),
|
offering.isUseLocalStorage(), offering.isSystemUse(), true, offering.isCustomizedIops() == null ? false : offering.isCustomizedIops(),
|
||||||
offering.getMinIops(), offering.getMaxIops());
|
offering.getMinIops(), offering.getMaxIops());
|
||||||
|
domainId = offering.getDomainId();
|
||||||
cpu = offering.getCpu();
|
cpu = offering.getCpu();
|
||||||
ramSize = offering.getRamSize();
|
ramSize = offering.getRamSize();
|
||||||
speed = offering.getSpeed();
|
speed = offering.getSpeed();
|
||||||
|
|
@ -226,6 +231,11 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||||
return multicastRateMbps;
|
return multicastRateMbps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getDomainId() {
|
||||||
|
return domainId;
|
||||||
|
}
|
||||||
|
|
||||||
public void setHostTag(String hostTag) {
|
public void setHostTag(String hostTag) {
|
||||||
this.hostTag = hostTag;
|
this.hostTag = hostTag;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1915,7 +1915,7 @@ public class ApiDBUtils {
|
||||||
public static DiskOfferingResponse newDiskOfferingResponse(DiskOfferingJoinVO offering) {
|
public static DiskOfferingResponse newDiskOfferingResponse(DiskOfferingJoinVO offering) {
|
||||||
DiskOfferingResponse diskOfferingResponse = s_diskOfferingJoinDao.newDiskOfferingResponse(offering);
|
DiskOfferingResponse diskOfferingResponse = s_diskOfferingJoinDao.newDiskOfferingResponse(offering);
|
||||||
if (diskOfferingResponse != null) {
|
if (diskOfferingResponse != null) {
|
||||||
Map<String, String> details = s_diskOfferingDetailsDao.listDetailsKeyPairs(offering.getId(), true);
|
Map<String, String> details = s_diskOfferingDetailsDao.listDetailsKeyPairs(offering.getId());
|
||||||
if (MapUtils.isNotEmpty(details)) {
|
if (MapUtils.isNotEmpty(details)) {
|
||||||
// Domains
|
// Domains
|
||||||
String[] domainIds = details.getOrDefault(ApiConstants.DOMAIN_ID_LIST, "").split(",");
|
String[] domainIds = details.getOrDefault(ApiConstants.DOMAIN_ID_LIST, "").split(",");
|
||||||
|
|
@ -1923,14 +1923,16 @@ public class ApiDBUtils {
|
||||||
for (DomainVO domain : s_domainDao.list(domainIds)) {
|
for (DomainVO domain : s_domainDao.list(domainIds)) {
|
||||||
domains.put(domain.getName(), domain.getUuid());
|
domains.put(domain.getName(), domain.getUuid());
|
||||||
}
|
}
|
||||||
diskOfferingResponse.putDetail(ApiConstants.DOMAIN, domains);
|
diskOfferingResponse.setDomain(String.join(", ", domains.keySet()));
|
||||||
|
diskOfferingResponse.setDomainId(String.join(", ", domains.values()));
|
||||||
// Zones
|
// Zones
|
||||||
String[] zoneIds = details.getOrDefault(ApiConstants.ZONE_ID_LIST, "").split(",");
|
String[] zoneIds = details.getOrDefault(ApiConstants.ZONE_ID_LIST, "").split(",");
|
||||||
final Map<String, String> zones = new HashMap<>();
|
final Map<String, String> zones = new HashMap<>();
|
||||||
for (DataCenterVO zone : s_zoneDao.list(zoneIds)) {
|
for (DataCenterVO zone : s_zoneDao.list(zoneIds)) {
|
||||||
zones.put(zone.getName(), zone.getUuid());
|
zones.put(zone.getName(), zone.getUuid());
|
||||||
}
|
}
|
||||||
diskOfferingResponse.putDetail(ApiConstants.ZONE, zones);
|
diskOfferingResponse.setZone(String.join(", ", zones.keySet()));
|
||||||
|
diskOfferingResponse.setZoneId(String.join(", ", zones.values()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return diskOfferingResponse;
|
return diskOfferingResponse;
|
||||||
|
|
|
||||||
|
|
@ -63,8 +63,6 @@ public class DiskOfferingJoinDaoImpl extends GenericDaoBase<DiskOfferingJoinVO,
|
||||||
diskOfferingResponse.setMinIops(offering.getMinIops());
|
diskOfferingResponse.setMinIops(offering.getMinIops());
|
||||||
diskOfferingResponse.setMaxIops(offering.getMaxIops());
|
diskOfferingResponse.setMaxIops(offering.getMaxIops());
|
||||||
|
|
||||||
diskOfferingResponse.setDomain(offering.getDomainName());
|
|
||||||
diskOfferingResponse.setDomainId(offering.getDomainUuid());
|
|
||||||
diskOfferingResponse.setDisplayOffering(offering.isDisplayOffering());
|
diskOfferingResponse.setDisplayOffering(offering.isDisplayOffering());
|
||||||
|
|
||||||
diskOfferingResponse.setTags(offering.getTags());
|
diskOfferingResponse.setTags(offering.getTags());
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import com.cloud.storage.Storage;
|
|
||||||
import org.apache.cloudstack.api.Identity;
|
import org.apache.cloudstack.api.Identity;
|
||||||
import org.apache.cloudstack.api.InternalIdentity;
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
|
|
||||||
import com.cloud.offering.DiskOffering.Type;
|
import com.cloud.offering.DiskOffering.Type;
|
||||||
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
@ -128,18 +128,6 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
|
||||||
@Column(name = GenericDao.REMOVED_COLUMN)
|
@Column(name = GenericDao.REMOVED_COLUMN)
|
||||||
private Date removed;
|
private Date removed;
|
||||||
|
|
||||||
@Column(name = "domain_id")
|
|
||||||
private long domainId;
|
|
||||||
|
|
||||||
@Column(name = "domain_uuid")
|
|
||||||
private String domainUuid;
|
|
||||||
|
|
||||||
@Column(name = "domain_name")
|
|
||||||
private String domainName = null;
|
|
||||||
|
|
||||||
@Column(name = "domain_path")
|
|
||||||
private String domainPath = null;
|
|
||||||
|
|
||||||
@Column(name = "display_offering")
|
@Column(name = "display_offering")
|
||||||
boolean displayOffering;
|
boolean displayOffering;
|
||||||
|
|
||||||
|
|
@ -224,22 +212,6 @@ public class DiskOfferingJoinVO extends BaseViewVO implements InternalIdentity,
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getDomainId() {
|
|
||||||
return domainId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDomainUuid() {
|
|
||||||
return domainUuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDomainName() {
|
|
||||||
return domainName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDomainPath() {
|
|
||||||
return domainPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSortKey() {
|
public int getSortKey() {
|
||||||
return sortKey;
|
return sortKey;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -225,11 +225,11 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
||||||
createServiceOffering(User.UID_SYSTEM, "Small Instance", 1, 512, 500, "Small Instance", ProvisioningType.THIN, false, false, null);
|
createServiceOffering(User.UID_SYSTEM, "Small Instance", 1, 512, 500, "Small Instance", ProvisioningType.THIN, false, false, null);
|
||||||
createServiceOffering(User.UID_SYSTEM, "Medium Instance", 1, 1024, 1000, "Medium Instance", ProvisioningType.THIN, false, false, null);
|
createServiceOffering(User.UID_SYSTEM, "Medium Instance", 1, 1024, 1000, "Medium Instance", ProvisioningType.THIN, false, false, null);
|
||||||
// Save default disk offerings
|
// Save default disk offerings
|
||||||
createdefaultDiskOffering(null, "Small", "Small Disk, 5 GB", ProvisioningType.THIN, 5, null, false, false);
|
createDefaultDiskOffering("Small", "Small Disk, 5 GB", ProvisioningType.THIN, 5, null, false, false);
|
||||||
createdefaultDiskOffering(null, "Medium", "Medium Disk, 20 GB", ProvisioningType.THIN, 20, null, false, false);
|
createDefaultDiskOffering("Medium", "Medium Disk, 20 GB", ProvisioningType.THIN, 20, null, false, false);
|
||||||
createdefaultDiskOffering(null, "Large", "Large Disk, 100 GB", ProvisioningType.THIN, 100, null, false, false);
|
createDefaultDiskOffering("Large", "Large Disk, 100 GB", ProvisioningType.THIN, 100, null, false, false);
|
||||||
createdefaultDiskOffering(null, "Large", "Large Disk, 100 GB", ProvisioningType.THIN, 100, null, false, false);
|
createDefaultDiskOffering("Large", "Large Disk, 100 GB", ProvisioningType.THIN, 100, null, false, false);
|
||||||
createdefaultDiskOffering(null, "Custom", "Custom Disk", ProvisioningType.THIN, 0, null, true, false);
|
createDefaultDiskOffering("Custom", "Custom Disk", ProvisioningType.THIN, 0, null, true, false);
|
||||||
|
|
||||||
// Save the mount parent to the configuration table
|
// Save the mount parent to the configuration table
|
||||||
String mountParent = getMountParent();
|
String mountParent = getMountParent();
|
||||||
|
|
@ -920,13 +920,13 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
||||||
return pod;
|
return pod;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DiskOfferingVO createdefaultDiskOffering(Long domainId, String name, String description, ProvisioningType provisioningType,
|
private DiskOfferingVO createDefaultDiskOffering(String name, String description, ProvisioningType provisioningType,
|
||||||
int numGibibytes, String tags, boolean isCustomized, boolean isSystemUse) {
|
int numGibibytes, String tags, boolean isCustomized, boolean isSystemUse) {
|
||||||
long diskSize = numGibibytes;
|
long diskSize = numGibibytes;
|
||||||
diskSize = diskSize * 1024 * 1024 * 1024;
|
diskSize = diskSize * 1024 * 1024 * 1024;
|
||||||
tags = cleanupTags(tags);
|
tags = cleanupTags(tags);
|
||||||
|
|
||||||
DiskOfferingVO newDiskOffering = new DiskOfferingVO(domainId, name, description, provisioningType, diskSize, tags, isCustomized, null, null, null);
|
DiskOfferingVO newDiskOffering = new DiskOfferingVO(name, description, provisioningType, diskSize, tags, isCustomized, null, null, null);
|
||||||
newDiskOffering.setUniqueName("Cloud.Com-" + name);
|
newDiskOffering.setUniqueName("Cloud.Com-" + name);
|
||||||
// leaving the above reference to cloud.com in as it is an identifyer and has no real world relevance
|
// leaving the above reference to cloud.com in as it is an identifyer and has no real world relevance
|
||||||
newDiskOffering.setSystemUse(isSystemUse);
|
newDiskOffering.setSystemUse(isSystemUse);
|
||||||
|
|
|
||||||
|
|
@ -983,7 +983,6 @@ public class DatabaseConfig {
|
||||||
@DB
|
@DB
|
||||||
protected void saveDiskOffering() {
|
protected void saveDiskOffering() {
|
||||||
long id = Long.parseLong(_currentObjectParams.get("id"));
|
long id = Long.parseLong(_currentObjectParams.get("id"));
|
||||||
long domainId = Long.parseLong(_currentObjectParams.get("domainId"));
|
|
||||||
String name = _currentObjectParams.get("name");
|
String name = _currentObjectParams.get("name");
|
||||||
String displayText = _currentObjectParams.get("displayText");
|
String displayText = _currentObjectParams.get("displayText");
|
||||||
ProvisioningType provisioningType = ProvisioningType.valueOf(_currentObjectParams.get("provisioningtype"));
|
ProvisioningType provisioningType = ProvisioningType.valueOf(_currentObjectParams.get("provisioningtype"));
|
||||||
|
|
@ -1006,7 +1005,7 @@ public class DatabaseConfig {
|
||||||
newTags.delete(newTags.length() - 1, newTags.length());
|
newTags.delete(newTags.length() - 1, newTags.length());
|
||||||
tags = newTags.toString();
|
tags = newTags.toString();
|
||||||
}
|
}
|
||||||
DiskOfferingVO diskOffering = new DiskOfferingVO(domainId, name, displayText, provisioningType, diskSpace, tags, false, null, null, null);
|
DiskOfferingVO diskOffering = new DiskOfferingVO(name, displayText, provisioningType, diskSpace, tags, false, null, null, null);
|
||||||
diskOffering.setUseLocalStorage(local);
|
diskOffering.setUseLocalStorage(local);
|
||||||
|
|
||||||
Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate"));
|
Long bytesReadRate = Long.parseLong(_currentObjectParams.get("bytesReadRate"));
|
||||||
|
|
|
||||||
|
|
@ -2438,11 +2438,11 @@
|
||||||
tags: {
|
tags: {
|
||||||
label: 'label.storage.tags'
|
label: 'label.storage.tags'
|
||||||
},
|
},
|
||||||
domains: {
|
domain: {
|
||||||
label: 'label.domains'
|
label: 'label.domain'
|
||||||
},
|
},
|
||||||
zones: {
|
zone: {
|
||||||
label: 'label.zones'
|
label: 'label.zone'
|
||||||
},
|
},
|
||||||
storagetype: {
|
storagetype: {
|
||||||
label: 'label.storage.type'
|
label: 'label.storage.type'
|
||||||
|
|
@ -2461,18 +2461,6 @@
|
||||||
data: data
|
data: data
|
||||||
};
|
};
|
||||||
var diskOffering = cloudStack.listDiskOfferings(listDiskOfferingsOptions)[0];
|
var diskOffering = cloudStack.listDiskOfferings(listDiskOfferingsOptions)[0];
|
||||||
if (diskOffering.details) {
|
|
||||||
if (diskOffering.details.domain) {
|
|
||||||
$.extend(diskOffering, {
|
|
||||||
domains: Object.keys(diskOffering.details.domain).join(', ')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (diskOffering.details.zone) {
|
|
||||||
$.extend(diskOffering, {
|
|
||||||
zones: Object.keys(diskOffering.details.zone).join(', ')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args.response.success({
|
args.response.success({
|
||||||
actionFilter: diskOfferingActionfilter,
|
actionFilter: diskOfferingActionfilter,
|
||||||
data: diskOffering
|
data: diskOffering
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue