diff --git a/api/src/com/cloud/api/response/AsyncJobResponse.java b/api/src/com/cloud/api/response/AsyncJobResponse.java index bd397da1963..4afdfba1665 100644 --- a/api/src/com/cloud/api/response/AsyncJobResponse.java +++ b/api/src/com/cloud/api/response/AsyncJobResponse.java @@ -26,11 +26,6 @@ import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class AsyncJobResponse extends BaseResponse { -/* - @SerializedName(ApiConstants.JOB_ID) @Param(description="async job ID") - private IdentityProxy id = new IdentityProxy("async_job"); -*/ - @SerializedName("accountid") @Param(description="the account that executed the async command") private IdentityProxy accountId = new IdentityProxy("account"); diff --git a/api/src/com/cloud/api/response/CapacityResponse.java b/api/src/com/cloud/api/response/CapacityResponse.java index 6071e1fc549..9c3332d8830 100755 --- a/api/src/com/cloud/api/response/CapacityResponse.java +++ b/api/src/com/cloud/api/response/CapacityResponse.java @@ -18,6 +18,7 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -26,19 +27,19 @@ public class CapacityResponse extends BaseResponse { private Short capacityType; @SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("zonename") @Param(description="the Zone name") private String zoneName; @SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName("podname") @Param(description="the Pod name") private String podName; @SerializedName(ApiConstants.CLUSTER_ID) @Param(description="the Cluster ID") - private Long clusterId; + private IdentityProxy clusterId = new IdentityProxy("cluster"); @SerializedName("clustername") @Param(description="the Cluster name") private String clusterName; @@ -61,11 +62,11 @@ public class CapacityResponse extends BaseResponse { } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getZoneName() { @@ -77,11 +78,11 @@ public class CapacityResponse extends BaseResponse { } public Long getPodId() { - return podId; + return podId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public String getPodName() { @@ -93,11 +94,11 @@ public class CapacityResponse extends BaseResponse { } public Long getClusterId() { - return clusterId; + return clusterId.getValue(); } public void setClusterId(Long clusterId) { - this.clusterId = clusterId; + this.clusterId.setValue(clusterId); } public String getClusterName() { diff --git a/api/src/com/cloud/api/response/CreateCmdResponse.java b/api/src/com/cloud/api/response/CreateCmdResponse.java index 82e0c23071e..fbc4d898eb0 100644 --- a/api/src/com/cloud/api/response/CreateCmdResponse.java +++ b/api/src/com/cloud/api/response/CreateCmdResponse.java @@ -23,24 +23,9 @@ import com.cloud.api.IdentityProxy; import com.google.gson.annotations.SerializedName; public class CreateCmdResponse extends BaseResponse { -/* - @SerializedName(ApiConstants.JOB_ID) - private Long jobId; -*/ - @SerializedName(ApiConstants.ID) private IdentityProxy id = new IdentityProxy(); -/* - public Long getJobId() { - return super.getJobId(); - } - - public void setJobId(Long jobId) { - super.setJobId(jobId); - } -*/ - public Long getId() { return id.getValue(); } diff --git a/api/src/com/cloud/api/response/DomainRouterResponse.java b/api/src/com/cloud/api/response/DomainRouterResponse.java index 916e24bb574..4a5734f8435 100644 --- a/api/src/com/cloud/api/response/DomainRouterResponse.java +++ b/api/src/com/cloud/api/response/DomainRouterResponse.java @@ -70,7 +70,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti private String linkLocalNetmask; @SerializedName(ApiConstants.LINK_LOCAL_NETWORK_ID) @Param(description="the ID of the corresponding link local network") - private Long linkLocalNetworkId; + private IdentityProxy linkLocalNetworkId = new IdentityProxy("networks"); @SerializedName(ApiConstants.PUBLIC_IP) @Param(description="the public IP address for the router") private String publicIp; @@ -263,7 +263,7 @@ public class DomainRouterResponse extends BaseResponse implements ControlledEnti } public void setLinkLocalNetworkId(Long linkLocalNetworkId) { - this.linkLocalNetworkId = linkLocalNetworkId; + this.linkLocalNetworkId.setValue(linkLocalNetworkId); } public void setServiceOfferingId(Long serviceOfferingId) { diff --git a/api/src/com/cloud/api/response/EgressRuleResponse.java b/api/src/com/cloud/api/response/EgressRuleResponse.java index ca3b9fba49d..94ec20b7159 100644 --- a/api/src/com/cloud/api/response/EgressRuleResponse.java +++ b/api/src/com/cloud/api/response/EgressRuleResponse.java @@ -18,12 +18,13 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class EgressRuleResponse extends BaseResponse { @SerializedName("ruleid") @Param(description="the id of the ingress rule") - private Long ruleId; + private IdentityProxy ruleId = new IdentityProxy("security_egress_rule"); @SerializedName("protocol") @Param(description="the protocol of the ingress rule") private String protocol; @@ -50,11 +51,11 @@ public class EgressRuleResponse extends BaseResponse { private String cidr; public Long getRuleId() { - return ruleId; + return ruleId.getValue(); } public void setRuleId(Long ruleId) { - this.ruleId = ruleId; + this.ruleId.setValue(ruleId); } public String getProtocol() { diff --git a/api/src/com/cloud/api/response/HostResponse.java b/api/src/com/cloud/api/response/HostResponse.java index ed6c88cceaa..9c3d2d403f6 100755 --- a/api/src/com/cloud/api/response/HostResponse.java +++ b/api/src/com/cloud/api/response/HostResponse.java @@ -139,14 +139,6 @@ public class HostResponse extends BaseResponse { @SerializedName("events") @Param(description="events available for the host") private String events; -/* - @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the host") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - - @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") - private Integer jobStatus; -*/ @SerializedName("hosttags") @Param(description="comma-separated list of tags for the host") private String hostTags; @@ -168,28 +160,6 @@ public class HostResponse extends BaseResponse { return getId(); } -/* - @Override - public Long getJobId() { - return super.getJobId(); - } - - @Override - public void setJobId(Long jobId) { - super.setJobId(jobId); - } - - @Override - public Integer getJobStatus() { - return jobStatus; - } - - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -*/ - public Long getId() { return id.getValue(); } diff --git a/api/src/com/cloud/api/response/IpForwardingRuleResponse.java b/api/src/com/cloud/api/response/IpForwardingRuleResponse.java index 3ee037da7b9..b4d7444ad7e 100644 --- a/api/src/com/cloud/api/response/IpForwardingRuleResponse.java +++ b/api/src/com/cloud/api/response/IpForwardingRuleResponse.java @@ -18,18 +18,19 @@ package com.cloud.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class IpForwardingRuleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule") - private Long id; + private IdentityProxy id = new IdentityProxy("firewall_rules"); @SerializedName(ApiConstants.PROTOCOL) @Param(description="the protocol of the port forwarding rule") private String protocol; @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) @Param(description="the VM ID for the port forwarding rule") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName("virtualmachinename") @Param(description="the VM name for the port forwarding rule") private String virtualMachineName; @@ -53,11 +54,11 @@ public class IpForwardingRuleResponse extends BaseResponse { private String state; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getProtocol() { @@ -69,11 +70,11 @@ public class IpForwardingRuleResponse extends BaseResponse { } public Long getVirtualMachineId() { - return virtualMachineId; + return virtualMachineId.getValue(); } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public String getVirtualMachineName() { diff --git a/api/src/com/cloud/api/response/IsoVmResponse.java b/api/src/com/cloud/api/response/IsoVmResponse.java index 2eecad01561..1da14f9fdd7 100755 --- a/api/src/com/cloud/api/response/IsoVmResponse.java +++ b/api/src/com/cloud/api/response/IsoVmResponse.java @@ -17,12 +17,13 @@ */ package com.cloud.api.response; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class IsoVmResponse extends BaseResponse { @SerializedName("id") @Param(description="the ISO ID") - private long id; + private IdentityProxy id = new IdentityProxy("vm_template"); @SerializedName("name") @Param(description="the ISO name") private String name; @@ -37,13 +38,13 @@ public class IsoVmResponse extends BaseResponse { private Boolean featured; @SerializedName("ostypeid") @Param(description="the ID of the OS type for this template.") - private Long osTypeId; + private IdentityProxy osTypeId = new IdentityProxy("guest_os"); @SerializedName("ostypename") @Param(description="the name of the OS type for this template.") private String osTypeName; @SerializedName("virtualmachineid") @Param(description="id of the virtual machine") - private Long virtualMachineId; + private IdentityProxy virtualMachineId = new IdentityProxy("vm_instance"); @SerializedName("vmname") @Param(description="name of the virtual machine") private String virtualMachineName; @@ -56,11 +57,11 @@ public class IsoVmResponse extends BaseResponse { public Long getOsTypeId() { - return osTypeId; + return osTypeId.getValue(); } public void setOsTypeId(Long osTypeId) { - this.osTypeId = osTypeId; + this.osTypeId.setValue(osTypeId); } public String getOsTypeName() { @@ -71,12 +72,12 @@ public class IsoVmResponse extends BaseResponse { this.osTypeName = osTypeName; } - public long getId() { - return id; + public Long getId() { + return id.getValue(); } - public void setId(long id) { - this.id = id; + public void setId(Long id) { + this.id.setValue(id); } public String getName() { @@ -112,11 +113,11 @@ public class IsoVmResponse extends BaseResponse { } public Long getVirtualMachineId() { - return virtualMachineId; + return virtualMachineId.getValue(); } public void setVirtualMachineId(Long virtualMachineId) { - this.virtualMachineId = virtualMachineId; + this.virtualMachineId.setValue(virtualMachineId); } public String getVirtualMachineName() { diff --git a/api/src/com/cloud/api/response/NicResponse.java b/api/src/com/cloud/api/response/NicResponse.java index 9e73aaa60fb..974c8232fa5 100755 --- a/api/src/com/cloud/api/response/NicResponse.java +++ b/api/src/com/cloud/api/response/NicResponse.java @@ -17,16 +17,17 @@ */ package com.cloud.api.response; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class NicResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the nic") - private Long id; + private IdentityProxy id = new IdentityProxy("nics"); @SerializedName("networkid") @Param(description="the ID of the corresponding network") - private Long networkid; + private IdentityProxy networkid = new IdentityProxy("networks"); @SerializedName("netmask") @Param(description="the netmask of the nic") private String netmask; @@ -56,19 +57,19 @@ public class NicResponse extends BaseResponse { private String macAddress; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getNetworkid() { - return networkid; + return networkid.getValue(); } public void setNetworkid(Long networkid) { - this.networkid = networkid; + this.networkid.setValue(networkid); } public String getNetmask() { diff --git a/api/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java b/api/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java deleted file mode 100644 index 8b9f009efd0..00000000000 --- a/api/src/com/cloud/api/response/PortForwardingServiceRuleResponse.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (C) 2010 Cloud.com, Inc. All rights reserved. - * - * This software is licensed under the GNU General Public License v3 or later. - * - * It is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ -package com.cloud.api.response; - -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; - -public class PortForwardingServiceRuleResponse extends BaseResponse { - @SerializedName("id") @Param(description="the ID of the port forwarding service rule") - private long ruleId; - - @SerializedName("publicport") @Param(description="the public port of the port forwarding service rule") - private String publicPort; - - @SerializedName("privateport") @Param(description="the private port of the port forwarding service rule") - private String privatePort; - - @SerializedName("protocol") @Param(description="the protocol (TCP/UDP) of the port forwarding service rule") - private String protocol; - - @SerializedName("portforwardingserviceid") @Param(description="the id of port forwarding service where the rule belongs to") - private Long portForwardingServiceId; - - @SerializedName("jobid") @Param(description="the job ID associated with the port forwarding rule. This is only displayed if the rule listed is part of a currently running asynchronous job.") - private Long jobId; - - @SerializedName("jobstatus") @Param(description="the job status associated with the port forwarding rule. This is only displayed if the rule listed is part of a currently running asynchronous job.") - private Integer jobStatus; - - public Long getPortForwardingServiceId() { - return portForwardingServiceId; - } - - public void setPortForwardingServiceId(Long portForwardingServiceId) { - this.portForwardingServiceId = portForwardingServiceId; - } - - public long getRuleId() { - return ruleId; - } - - public void setRuleId(long ruleId) { - this.ruleId = ruleId; - } - - public String getPublicPort() { - return publicPort; - } - - public void setPublicPort(String publicPort) { - this.publicPort = publicPort; - } - - public String getPrivatePort() { - return privatePort; - } - - public void setPrivatePort(String privatePort) { - this.privatePort = privatePort; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - - public Long getJobId() { - return jobId; - } - - public void setJobId(Long jobId) { - this.jobId = jobId; - } - - public Integer getJobStatus() { - return jobStatus; - } - - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -} diff --git a/api/src/com/cloud/api/response/ProjectAccountResponse.java b/api/src/com/cloud/api/response/ProjectAccountResponse.java index f3708851f84..48a1e899d79 100644 --- a/api/src/com/cloud/api/response/ProjectAccountResponse.java +++ b/api/src/com/cloud/api/response/ProjectAccountResponse.java @@ -20,19 +20,20 @@ package com.cloud.api.response; import java.util.List; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") public class ProjectAccountResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.PROJECT_ID) @Param(description="project id") - private Long projectId; + private IdentityProxy projectId = new IdentityProxy("projects"); @SerializedName(ApiConstants.PROJECT) @Param(description="project name") private String projectName; @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the id of the account") - private Long id; + private IdentityProxy id = new IdentityProxy("account"); @SerializedName(ApiConstants.ACCOUNT) @Param(description="the name of the account") private String accountName; @@ -44,7 +45,7 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledEn private String role; @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="id of the Domain the account belongs too") - private Long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName(ApiConstants.DOMAIN) @Param(description="name of the Domain the account belongs too") private String domainName; @@ -53,7 +54,7 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledEn private List users; public void setProjectId(Long projectId) { - this.projectId = projectId; + this.projectId.setValue(projectId); } public void setProjectName(String projectName) { @@ -61,7 +62,7 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledEn } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public void setAccountName(String accountName) { @@ -73,7 +74,7 @@ public class ProjectAccountResponse extends BaseResponse implements ControlledEn } public void setDomainId(Long domainId) { - this.domainId = domainId; + this.domainId.setValue(domainId); } public void setDomainName(String domainName) { diff --git a/api/src/com/cloud/api/response/SecurityGroupResponse.java b/api/src/com/cloud/api/response/SecurityGroupResponse.java index 02d17d2c9c3..99a7f44d042 100644 --- a/api/src/com/cloud/api/response/SecurityGroupResponse.java +++ b/api/src/com/cloud/api/response/SecurityGroupResponse.java @@ -50,14 +50,6 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the security group") private String domainName; -/* - @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - @SerializedName(ApiConstants.JOB_STATUS) @Param(description="shows the current pending asynchronous job status") - private Integer jobStatus; -*/ - @SerializedName("ingressrule") @Param(description="the list of ingress rules associated with the security group", responseObject = IngressRuleResponse.class) private List ingressRules; @@ -105,28 +97,6 @@ public class SecurityGroupResponse extends BaseResponse implements ControlledEnt return getId(); } -/* - @Override - public Long getJobId() { - return super.getJobId(); - } - - @Override - public void setJobId(Long jobId) { - super.setJobId(jobId); - } - - @Override - public Integer getJobStatus() { - return jobStatus; - } - - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -*/ - @Override public int hashCode() { final int prime = 31; diff --git a/api/src/com/cloud/api/response/SnapshotResponse.java b/api/src/com/cloud/api/response/SnapshotResponse.java index 373e05781ef..c38b426913f 100644 --- a/api/src/com/cloud/api/response/SnapshotResponse.java +++ b/api/src/com/cloud/api/response/SnapshotResponse.java @@ -73,15 +73,6 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @Param(description = "name of the snapshot") private String name; -/* - @SerializedName(ApiConstants.JOB_ID) - @Param(description = "the job ID associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - @SerializedName(ApiConstants.JOB_STATUS) - @Param(description = "the job status associated with the snapshot. This is only displayed if the snapshot listed is part of a currently running asynchronous job.") - private Integer jobStatus; -*/ @SerializedName(ApiConstants.INTERVAL_TYPE) @Param(description = "valid types are hourly, daily, weekly, monthy, template, and none.") private String intervalType; @@ -147,28 +138,6 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe this.name = name; } -/* - @Override - public Long getJobId() { - return super.getJobId(); - } - - @Override - public void setJobId(Long jobId) { - super.setJobId(jobId); - } - - @Override - public Integer getJobStatus() { - return jobStatus; - } - - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -*/ - public void setIntervalType(String intervalType) { this.intervalType = intervalType; } diff --git a/api/src/com/cloud/api/response/SnapshotScheduleResponse.java b/api/src/com/cloud/api/response/SnapshotScheduleResponse.java index d8434f6c79c..15679cde62c 100644 --- a/api/src/com/cloud/api/response/SnapshotScheduleResponse.java +++ b/api/src/com/cloud/api/response/SnapshotScheduleResponse.java @@ -19,44 +19,45 @@ package com.cloud.api.response; import java.util.Date; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class SnapshotScheduleResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the snapshot schedule") - private Long id; + private IdentityProxy id = new IdentityProxy("snapshot_schedule"); @SerializedName("volumeid") @Param(description="the volume ID the snapshot schedule applied for") - private Long volumeId; + private IdentityProxy volumeId = new IdentityProxy("volumes"); @SerializedName("snapshotpolicyid") @Param(description="the snapshot policy ID used by the snapshot schedule") - private Long snapshotPolicyId; + private IdentityProxy snapshotPolicyId = new IdentityProxy("snapshot_policy"); @SerializedName("scheduled") @Param(description="time the snapshot is scheduled to be taken") private Date scheduled; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getVolumeId() { - return volumeId; + return volumeId.getValue(); } public void setVolumeId(Long volumeId) { - this.volumeId = volumeId; + this.volumeId.setValue(volumeId); } public Long getSnapshotPolicyId() { - return snapshotPolicyId; + return snapshotPolicyId.getValue(); } public void setSnapshotPolicyId(Long snapshotPolicyId) { - this.snapshotPolicyId = snapshotPolicyId; + this.snapshotPolicyId.setValue(snapshotPolicyId); } public Date getScheduled() { diff --git a/api/src/com/cloud/api/response/StoragePoolResponse.java b/api/src/com/cloud/api/response/StoragePoolResponse.java index 6eb4935687a..13d9570a999 100755 --- a/api/src/com/cloud/api/response/StoragePoolResponse.java +++ b/api/src/com/cloud/api/response/StoragePoolResponse.java @@ -77,41 +77,11 @@ public class StoragePoolResponse extends BaseResponse { @SerializedName(ApiConstants.STATE) @Param(description="the state of the storage pool") private StoragePoolStatus state; -/* - @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the storage pool") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - - @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") - private Integer jobStatus; -*/ @Override public Long getObjectId() { return getId(); } -/* - @Override - public Long getJobId() { - return super.getJobId(); - } - - @Override - public void setJobId(Long jobId) { - super.setJobId(jobId); - } - - @Override - public Integer getJobStatus() { - return jobStatus; - } - - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -*/ - public Long getId() { return id.getValue(); } diff --git a/api/src/com/cloud/api/response/SwiftResponse.java b/api/src/com/cloud/api/response/SwiftResponse.java index ba7f3c8ff4d..214ffdc4c49 100755 --- a/api/src/com/cloud/api/response/SwiftResponse.java +++ b/api/src/com/cloud/api/response/SwiftResponse.java @@ -20,13 +20,14 @@ package com.cloud.api.response; import java.util.Date; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class SwiftResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description = "the ID of swift") - private Long id; + private IdentityProxy id = new IdentityProxy("swift"); @SerializedName(ApiConstants.URL) @Param(description = "url for swift") @@ -38,11 +39,11 @@ public class SwiftResponse extends BaseResponse { @Override public Long getObjectId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public String getUrl() { diff --git a/api/src/com/cloud/api/response/UpgradeVmResponse.java b/api/src/com/cloud/api/response/UpgradeVmResponse.java index fd0f7f82705..df4ac27e270 100644 --- a/api/src/com/cloud/api/response/UpgradeVmResponse.java +++ b/api/src/com/cloud/api/response/UpgradeVmResponse.java @@ -19,12 +19,13 @@ package com.cloud.api.response; import java.util.Date; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class UpgradeVmResponse extends BaseResponse { @SerializedName("id") - private long id; + private IdentityProxy id = new IdentityProxy("vm_instance"); public String getName() { return name; @@ -66,12 +67,12 @@ public class UpgradeVmResponse extends BaseResponse { this.account = account; } - public long getDomainId() { - return domainId; + public Long getDomainId() { + return domainId.getValue(); } - public void setDomainId(long domainId) { - this.domainId = domainId; + public void setDomainId(Long domainId) { + this.domainId.setValue(domainId); } public String getDomain() { @@ -90,12 +91,12 @@ public class UpgradeVmResponse extends BaseResponse { this.haEnable = haEnable; } - public long getZoneId() { - return zoneId; + public Long getZoneId() { + return zoneId.getValue(); } - public void setZoneId(long zoneId) { - this.zoneId = zoneId; + public void setZoneId(Long zoneId) { + this.zoneId.setValue(zoneId); } public String getDisplayName() { @@ -114,12 +115,12 @@ public class UpgradeVmResponse extends BaseResponse { this.zoneName = zoneName; } - public long getHostId() { - return hostId; + public Long getHostId() { + return hostId.getValue(); } - public void setHostId(long hostId) { - this.hostId = hostId; + public void setHostId(Long hostId) { + this.hostId.setValue(hostId); } public String getHostName() { @@ -130,12 +131,12 @@ public class UpgradeVmResponse extends BaseResponse { this.hostName = hostName; } - public long getTemplateId() { - return templateId; + public Long getTemplateId() { + return templateId.getValue(); } - public void setTemplateId(long templateId) { - this.templateId = templateId; + public void setTemplateId(Long templateId) { + this.templateId.setValue(templateId); } public String getTemplateName() { @@ -162,12 +163,12 @@ public class UpgradeVmResponse extends BaseResponse { this.passwordEnabled = passwordEnabled; } - public long getServiceOfferingId() { - return serviceOfferingId; + public Long getServiceOfferingId() { + return serviceOfferingId.getValue(); } - public void setServiceOfferingId(long serviceOfferingId) { - this.serviceOfferingId = serviceOfferingId; + public void setServiceOfferingId(Long serviceOfferingId) { + this.serviceOfferingId.setValue(serviceOfferingId); } public String getServiceOfferingName() { @@ -218,8 +219,8 @@ public class UpgradeVmResponse extends BaseResponse { this.networkKbsWrite = networkKbsWrite; } - public long isId() { - return id; + public Long isId() { + return id.getValue(); } @SerializedName("name") @Param(description="the ID of the virtual machine") @@ -238,7 +239,7 @@ public class UpgradeVmResponse extends BaseResponse { private String account; @SerializedName("domainid") @Param(description="the ID of the domain in which the virtual machine exists") - private long domainId; + private IdentityProxy domainId = new IdentityProxy("domain"); @SerializedName("domain") @Param(description="the name of the domain in which the virtual machine exists") private String domain; @@ -247,7 +248,7 @@ public class UpgradeVmResponse extends BaseResponse { private boolean haEnable; @SerializedName("zoneid") @Param(description="the ID of the availablility zone for the virtual machine") - private long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName("displayname") @Param(description="user generated name. The name of the virtual machine is returned if no displayname exists.") private String displayName; @@ -256,13 +257,13 @@ public class UpgradeVmResponse extends BaseResponse { private String zoneName; @SerializedName("hostid") @Param(description="the ID of the host for the virtual machine") - private long hostId; + private IdentityProxy hostId = new IdentityProxy("host"); @SerializedName("hostname") @Param(description="the name of the host for the virtual machine") private String hostName; @SerializedName("templateid") @Param(description="the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") - private long templateId; + private IdentityProxy templateId = new IdentityProxy("vm_template"); @SerializedName("templatename") @Param(description="the name of the template for the virtual machine") private String templateName; @@ -274,7 +275,7 @@ public class UpgradeVmResponse extends BaseResponse { private boolean passwordEnabled; @SerializedName("serviceofferingid") @Param(description="the ID of the service offering of the virtual machine") - private long serviceOfferingId; + private IdentityProxy serviceOfferingId = new IdentityProxy("disk_offering"); @SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine") private String serviceOfferingName; diff --git a/api/src/com/cloud/api/response/UserVmResponse.java b/api/src/com/cloud/api/response/UserVmResponse.java index 66c355fbf47..b91807f70b7 100755 --- a/api/src/com/cloud/api/response/UserVmResponse.java +++ b/api/src/com/cloud/api/response/UserVmResponse.java @@ -144,14 +144,6 @@ public class UserVmResponse extends BaseResponse implements ControlledEntityResp @SerializedName(ApiConstants.PASSWORD) @Param(description="the password (if exists) of the virtual machine") private String password; -/* - @SerializedName(ApiConstants.JOB_ID) @Param(description="shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the virtual machine") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - - @SerializedName("jobstatus") @Param(description="shows the current pending asynchronous job status") - private Integer jobStatus; -*/ @SerializedName("nic") @Param(description="the list of nics associated with vm", responseObject = NicResponse.class) private List nics; diff --git a/api/src/com/cloud/api/response/VolumeResponse.java b/api/src/com/cloud/api/response/VolumeResponse.java index af19e346a89..666a9c99028 100755 --- a/api/src/com/cloud/api/response/VolumeResponse.java +++ b/api/src/com/cloud/api/response/VolumeResponse.java @@ -30,16 +30,6 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp @Param(description = "ID of the disk volume") private IdentityProxy id = new IdentityProxy("volumes"); -/* - @SerializedName(ApiConstants.JOB_ID) - @Param(description = "shows the current pending asynchronous job ID. This tag is not returned if no current pending jobs are acting on the volume") - private IdentityProxy jobId = new IdentityProxy("async_job"); - - @SerializedName(ApiConstants.JOB_STATUS) - @Param(description = "shows the current pending asynchronous job status") - private Integer jobStatus; -*/ - @SerializedName(ApiConstants.NAME) @Param(description = "name of the disk volume") private String name; @@ -163,27 +153,6 @@ public class VolumeResponse extends BaseResponse implements ControlledEntityResp return getId(); } -/* - @Override - public Long getJobId() { - return super.getJobId(); - } - - @Override - public void setJobId(Long jobId) { - super.setJobId(jobId); - } - - @Override - public Integer getJobStatus() { - return jobStatus; - } - - @Override - public void setJobStatus(Integer jobStatus) { - this.jobStatus = jobStatus; - } -*/ public Boolean getDestroyed() { return destroyed; } diff --git a/core/src/com/cloud/network/security/EgressRuleVO.java b/core/src/com/cloud/network/security/EgressRuleVO.java index 01d7791ecb1..ef329b2f96b 100644 --- a/core/src/com/cloud/network/security/EgressRuleVO.java +++ b/core/src/com/cloud/network/security/EgressRuleVO.java @@ -18,6 +18,8 @@ package com.cloud.network.security; +import java.util.UUID; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -27,12 +29,13 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.async.AsyncInstanceCreateStatus; import com.google.gson.annotations.Expose; @Entity @Table(name = ("security_egress_rule")) -public class EgressRuleVO implements EgressRule { +public class EgressRuleVO implements EgressRule, Identity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") @@ -61,6 +64,9 @@ public class EgressRuleVO implements EgressRule { @Enumerated(value = EnumType.STRING) private AsyncInstanceCreateStatus createStatus; + @Column(name = "uuid") + private String uuid = UUID.randomUUID().toString(); + public EgressRuleVO() { } @@ -123,4 +129,13 @@ public class EgressRuleVO implements EgressRule { public String getAllowedDestinationIpCidr() { return allowedDestinationIpCidr; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/core/src/com/cloud/storage/SnapshotScheduleVO.java b/core/src/com/cloud/storage/SnapshotScheduleVO.java index 0fdedceade1..038876b509d 100644 --- a/core/src/com/cloud/storage/SnapshotScheduleVO.java +++ b/core/src/com/cloud/storage/SnapshotScheduleVO.java @@ -19,6 +19,7 @@ package com.cloud.storage; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,11 +30,12 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import com.cloud.api.Identity; import com.cloud.storage.snapshot.SnapshotSchedule; @Entity @Table(name="snapshot_schedule") -public class SnapshotScheduleVO implements SnapshotSchedule { +public class SnapshotScheduleVO implements SnapshotSchedule, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -56,7 +58,10 @@ public class SnapshotScheduleVO implements SnapshotSchedule { @Column(name="snapshot_id") Long snapshotId; - + + @Column(name="uuid") + String uuid = UUID.randomUUID().toString(); + public SnapshotScheduleVO() { } public SnapshotScheduleVO(long volumeId, long policyId, Date scheduledTimestamp) { @@ -108,5 +113,14 @@ public class SnapshotScheduleVO implements SnapshotSchedule { public void setSnapshotId(Long snapshotId) { this.snapshotId = snapshotId; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; } -} \ No newline at end of file +} diff --git a/core/src/com/cloud/storage/SwiftVO.java b/core/src/com/cloud/storage/SwiftVO.java index d309068e2cf..be277baffaf 100644 --- a/core/src/com/cloud/storage/SwiftVO.java +++ b/core/src/com/cloud/storage/SwiftVO.java @@ -19,6 +19,7 @@ package com.cloud.storage; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -28,11 +29,12 @@ import javax.persistence.Id; import javax.persistence.Table; import com.cloud.agent.api.to.SwiftTO; +import com.cloud.api.Identity; import com.cloud.utils.db.GenericDao; @Entity @Table(name="swift") -public class SwiftVO implements Swift { +public class SwiftVO implements Swift, Identity { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @@ -51,6 +53,9 @@ public class SwiftVO implements Swift { @Column(name="key") String key; + @Column(name="uuid") + String uuid = UUID.randomUUID().toString(); + @Column(name = GenericDao.CREATED_COLUMN) private Date created; @@ -92,4 +97,13 @@ public class SwiftVO implements Swift { public SwiftTO toSwiftTO() { return new SwiftTO(getId(), getUrl(), getAccount(), getUserName(), getKey()); } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/server/src/com/cloud/api/response/ApiResponseSerializer.java b/server/src/com/cloud/api/response/ApiResponseSerializer.java index 67188fab457..4e1e896161b 100644 --- a/server/src/com/cloud/api/response/ApiResponseSerializer.java +++ b/server/src/com/cloud/api/response/ApiResponseSerializer.java @@ -34,10 +34,13 @@ import com.cloud.api.ApiDBUtils; import com.cloud.api.ApiResponseGsonHelper; import com.cloud.api.ApiServer; import com.cloud.api.BaseCmd; +import com.cloud.api.IdentityProxy; import com.cloud.api.ResponseObject; import com.cloud.api.ResponseObjectTypeAdapter; import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.identity.dao.IdentityDao; +import com.cloud.identity.dao.IdentityDaoImpl; import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.encoding.URLEncoder; import com.cloud.utils.exception.CloudRuntimeException; @@ -204,6 +207,14 @@ public class ApiResponseSerializer { } else if (fieldValue instanceof Date) { sb.append("<" + serializedName.value() + ">" + BaseCmd.getDateString((Date) fieldValue) + ""); + } else if (fieldValue instanceof IdentityProxy) { + IdentityProxy idProxy = (IdentityProxy)fieldValue; + String id = (idProxy.getValue() != null ? String.valueOf(idProxy.getValue()) : ""); + if(!id.isEmpty()) { + IdentityDao identityDao = new IdentityDaoImpl(); + id = identityDao.getIdentityUuid(idProxy.getTableName(), id); + } + sb.append("<" + serializedName.value() + ">" + id + ""); } else { String resultString = escapeSpecialXmlChars(fieldValue.toString()); if (!(obj instanceof ExceptionResponse)) { diff --git a/server/src/com/cloud/baremetal/DhcpServerResponse.java b/server/src/com/cloud/baremetal/DhcpServerResponse.java index caf80c2028d..0dec6e79641 100644 --- a/server/src/com/cloud/baremetal/DhcpServerResponse.java +++ b/server/src/com/cloud/baremetal/DhcpServerResponse.java @@ -20,19 +20,20 @@ package com.cloud.baremetal; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class DhcpServerResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the Dhcp server") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } } diff --git a/server/src/com/cloud/baremetal/PxeServerResponse.java b/server/src/com/cloud/baremetal/PxeServerResponse.java index 045aa7395d5..65c4dbe97ed 100644 --- a/server/src/com/cloud/baremetal/PxeServerResponse.java +++ b/server/src/com/cloud/baremetal/PxeServerResponse.java @@ -20,19 +20,20 @@ package com.cloud.baremetal; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class PxeServerResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the PXE server") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } } diff --git a/server/src/com/cloud/identity/dao/IdentityDaoImpl.java b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java index 2d99c60b6cf..66620f9628b 100644 --- a/server/src/com/cloud/identity/dao/IdentityDaoImpl.java +++ b/server/src/com/cloud/identity/dao/IdentityDaoImpl.java @@ -74,6 +74,8 @@ public class IdentityDaoImpl extends GenericDaoBase implements ResultSet rs = pstmt.executeQuery(); if(rs.next()) { return rs.getLong(1); + } else { + throw new InvalidParameterValueException("Object " + tableName + "(uuid: " + identityString + ") does not exist."); } } catch (SQLException e) { s_logger.error("Unexpected exception ", e); @@ -123,6 +125,6 @@ public class IdentityDaoImpl extends GenericDaoBase implements txn.close(); } - throw new InvalidParameterValueException("Object(uuid: " + identityString + ") does not exist"); + return identityString; } } diff --git a/server/src/com/cloud/server/api/response/BaremetalTemplateResponse.java b/server/src/com/cloud/server/api/response/BaremetalTemplateResponse.java index 1729ab030b9..51f8f7dd1ee 100644 --- a/server/src/com/cloud/server/api/response/BaremetalTemplateResponse.java +++ b/server/src/com/cloud/server/api/response/BaremetalTemplateResponse.java @@ -1,18 +1,19 @@ package com.cloud.server.api.response; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class BaremetalTemplateResponse extends BaseResponse { @SerializedName("id") @Param(description="the template ID") - private long id; + private IdentityProxy id = new IdentityProxy("vm_template"); - public long getId() { - return id; + public Long getId() { + return id.getValue(); } - public void setId(long id) { - this.id = id; + public void setId(Long id) { + this.id.setValue(id); } } diff --git a/server/src/com/cloud/server/api/response/NwDevicePxeServerResponse.java b/server/src/com/cloud/server/api/response/NwDevicePxeServerResponse.java index 24e02486f67..90e4dc04101 100644 --- a/server/src/com/cloud/server/api/response/NwDevicePxeServerResponse.java +++ b/server/src/com/cloud/server/api/response/NwDevicePxeServerResponse.java @@ -1,16 +1,17 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; public class NwDevicePxeServerResponse extends NetworkDeviceResponse { @SerializedName(ApiConstants.ZONE_ID) @Param(description="Zone where to add PXE server") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.POD_ID) @Param(description="Pod where to add PXE server") - private Long podId; + private IdentityProxy podId = new IdentityProxy("host_pod_ref"); @SerializedName(ApiConstants.URL) @Param(description="Ip of PXE server") private String url; @@ -19,17 +20,17 @@ public class NwDevicePxeServerResponse extends NetworkDeviceResponse { private String type; public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setPodId(Long podId) { - this.podId = podId; + this.podId.setValue(podId); } public Long getPodId() { - return podId; + return podId.getValue(); } public void setUrl(String url) { diff --git a/server/src/com/cloud/server/api/response/TrafficMonitorResponse.java b/server/src/com/cloud/server/api/response/TrafficMonitorResponse.java index f979a5385a1..e1bd53302bc 100644 --- a/server/src/com/cloud/server/api/response/TrafficMonitorResponse.java +++ b/server/src/com/cloud/server/api/response/TrafficMonitorResponse.java @@ -20,6 +20,7 @@ package com.cloud.server.api.response; import com.cloud.api.ApiConstants; +import com.cloud.api.IdentityProxy; import com.cloud.api.response.BaseResponse; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -27,10 +28,10 @@ import com.google.gson.annotations.SerializedName; public class TrafficMonitorResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the external firewall") - private Long id; + private IdentityProxy id = new IdentityProxy("host"); @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of the external firewall") - private Long zoneId; + private IdentityProxy zoneId = new IdentityProxy("data_center"); @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the management IP address of the external firewall") private String ipAddress; @@ -42,19 +43,19 @@ public class TrafficMonitorResponse extends BaseResponse { private String timeout; public Long getId() { - return id; + return id.getValue(); } public void setId(Long id) { - this.id = id; + this.id.setValue(id); } public Long getZoneId() { - return zoneId; + return zoneId.getValue(); } public void setZoneId(Long zoneId) { - this.zoneId = zoneId; + this.zoneId.setValue(zoneId); } public String getIpAddress() { diff --git a/server/src/com/cloud/vm/NicVO.java b/server/src/com/cloud/vm/NicVO.java index ff6a2dcd979..01e526487cc 100644 --- a/server/src/com/cloud/vm/NicVO.java +++ b/server/src/com/cloud/vm/NicVO.java @@ -19,6 +19,7 @@ package com.cloud.vm; import java.net.URI; import java.util.Date; +import java.util.UUID; import javax.persistence.Column; import javax.persistence.Entity; @@ -29,13 +30,14 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import com.cloud.api.Identity; import com.cloud.network.Networks.AddressFormat; import com.cloud.network.Networks.Mode; import com.cloud.utils.db.GenericDao; @Entity @Table(name = "nics") -public class NicVO implements Nic { +public class NicVO implements Nic, Identity { protected NicVO() { } @@ -110,6 +112,9 @@ public class NicVO implements Nic { @Column(name = GenericDao.CREATED_COLUMN) Date created; + + @Column(name = "uuid") + String uuid = UUID.randomUUID().toString(); public NicVO(String reserver, Long instanceId, long configurationId, VirtualMachine.Type vmType) { this.reserver = reserver; @@ -310,4 +315,13 @@ public class NicVO implements Nic { public VirtualMachine.Type getVmType() { return vmType; } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } } diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index d0456f5e046..636f896b500 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -219,6 +219,7 @@ CREATE TABLE `cloud`.`account_network_ref` ( CREATE TABLE `cloud`.`nics` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', + `uuid` varchar(40), `instance_id` bigint unsigned COMMENT 'vm instance id', `mac_address` varchar(17) COMMENT 'mac address', `ip4_address` char(40) COMMENT 'ip4 address', @@ -243,6 +244,7 @@ CREATE TABLE `cloud`.`nics` ( PRIMARY KEY (`id`), CONSTRAINT `fk_nics__instance_id` FOREIGN KEY `fk_nics__instance_id`(`instance_id`) REFERENCES `vm_instance`(`id`) ON DELETE CASCADE, CONSTRAINT `fk_nics__networks_id` FOREIGN KEY `fk_nics__networks_id`(`network_id`) REFERENCES `networks`(`id`), + CONSTRAINT `uc_nics__uuid` UNIQUE (`uuid`), INDEX `i_nics__removed`(`removed`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1472,12 +1474,14 @@ CREATE TABLE `cloud`.`snapshot_policy` ( CREATE TABLE `cloud`.`snapshot_schedule` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `volume_id` bigint unsigned NOT NULL COMMENT 'The volume for which this snapshot is being taken', `policy_id` bigint unsigned NOT NULL COMMENT 'One of the policyIds for which this snapshot was taken', `scheduled_timestamp` datetime NOT NULL COMMENT 'Time at which the snapshot was scheduled for execution', `async_job_id` bigint unsigned COMMENT 'If this schedule is being executed, it is the id of the create aysnc_job. Before that it is null', `snapshot_id` bigint unsigned COMMENT 'If this schedule is being executed, then the corresponding snapshot has this id. Before that it is null', UNIQUE (volume_id, policy_id), + CONSTRAINT `uc_snapshot_schedule__uuid` UNIQUE (`uuid`), PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -1519,6 +1523,7 @@ CREATE TABLE `cloud`.`security_ingress_rule` ( CREATE TABLE `cloud`.`security_egress_rule` ( `id` bigint unsigned NOT NULL auto_increment, + `uuid` varchar(40), `security_group_id` bigint unsigned NOT NULL, `start_port` varchar(10) default NULL, `end_port` varchar(10) default NULL, @@ -1526,7 +1531,8 @@ CREATE TABLE `cloud`.`security_egress_rule` ( `allowed_network_id` bigint unsigned, `allowed_ip_cidr` varchar(44), `create_status` varchar(32) COMMENT 'rule creation status', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_security_egress_rule__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`security_group_vm_map` ( @@ -1725,12 +1731,14 @@ CREATE TABLE `cloud`.`keystore` ( CREATE TABLE `cloud`.`swift` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `uuid` varchar(40), `url` varchar(255) NOT NULL, `account` varchar(255) NOT NULL COMMENT ' account in swift', `username` varchar(255) NOT NULL COMMENT ' username in swift', `key` varchar(255) NOT NULL COMMENT 'token for this user', `created` datetime COMMENT 'date the swift first signed on', - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + CONSTRAINT `uc_swift__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/setup/db/db/schema-2213to30.sql b/setup/db/db/schema-2213to30.sql index 1f9afdce4ab..7cb06e94fca 100755 --- a/setup/db/db/schema-2213to30.sql +++ b/setup/db/db/schema-2213to30.sql @@ -169,6 +169,9 @@ ALTER TABLE `cloud`.`snapshots` ADD CONSTRAINT `uc_snapshots__uuid` UNIQUE (`uui ALTER TABLE `cloud`.`snapshot_policy` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`snapshot_policy` ADD CONSTRAINT `uc_snapshot_policy__uuid` UNIQUE (`uuid`); +ALTER TABLE `cloud`.`snapshot_schedule` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`snapshot_schedule` ADD CONSTRAINT `uc_snapshot_schedule__uuid` UNIQUE (`uuid`); + ALTER TABLE `cloud`.`volumes` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`volumes` ADD CONSTRAINT `uc_volumes__uuid` UNIQUE (`uuid`); @@ -187,6 +190,9 @@ ALTER TABLE `cloud`.`cluster` ADD CONSTRAINT `uc_cluster__uuid` UNIQUE (`uuid`); ALTER TABLE `cloud`.`security_ingress_rule` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`security_ingress_rule` ADD CONSTRAINT `uc_security_ingress_rule__uuid` UNIQUE (`uuid`); +ALTER TABLE `cloud`.`security_egress_rule` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`security_egress_rule` ADD CONSTRAINT `uc_security_egress_rule__uuid` UNIQUE (`uuid`); + ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`network_offerings` ADD CONSTRAINT `uc_network_offerings__uuid` UNIQUE (`uuid`); @@ -208,3 +214,6 @@ ALTER TABLE `cloud`.`guest_os` ADD CONSTRAINT `uc_guest_os__uuid` UNIQUE (`uuid` ALTER TABLE `cloud`.`guest_os_category` ADD COLUMN `uuid` varchar(40); ALTER TABLE `cloud`.`guest_os_category` ADD CONSTRAINT `uc_guest_os_category__uuid` UNIQUE (`uuid`); +ALTER TABLE `cloud`.`nics` ADD COLUMN `uuid` varchar(40); +ALTER TABLE `cloud`.`nics` ADD CONSTRAINT `uc_nics__uuid` UNIQUE (`uuid`); +