StoragePoolForMigrationResponse -> StoragePoolResponse
The additional response type is basically the same as
StoragePoolResponse. Only additional state reported is whether the
storage pool is suitable for migration. Since this is fetched from
hypervisor capabilities there is no need for a new response type.
Tested with the simulator and I can see the response format correctly.
mysql> select * from hypervisor_capabilities where id=18\G
*************************** 1. row ***************************
id: 18
uuid: 98b88e6e-ccf1-11e2-bd2a-af89de8bd27e
hypervisor_type: Simulator
hypervisor_version: NULL
max_guests_limit: 100
security_group_enabled: 1
max_data_volumes_limit: 100
max_hosts_per_cluster: 100
storage_motion_supported: 1
vm_snapshot_enabled: 1
1 row in set (0.00 sec)
CloudMonkey output as below:
> find storagepoolsformigration id=0a644f79-53dd-4eb6-a871-64679a47cfc6
count = 1
storagepool:
name = PS0
id = 7c07ec9b-a3c6-3466-ab5a-f5669ead0b22
clusterid = 71fb5c34-4852-46e6-bb8f-c9da4e8f827c
clustername = C0
created = 2013-06-04T14:06:55+0530
disksizeallocated = 0
disksizetotal = 1099511627776
disksizeused = 0
ipaddress = 10.147.28.6
jobstatus = 0
path = /export/home/sandbox/primary0
podid = 560d9600-35dd-4a50-addd-81d5618536e9
podname = POD0
scope = CLUSTER
state = Up
suitableformigration = True
type = NetworkFilesystem
zoneid = 3108f711-0db6-4dad-a0d0-2fd7d413e5ef
zonename = Sandbox-simulator
Signed-off-by: Prasanna Santhanam <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0401774a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0401774a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0401774a
Branch: refs/heads/master
Commit: 0401774a09483354f5b8532a30943351755da93f
Parents: d58c0c4
Author: Prasanna Santhanam <[email protected]>
Authored: Tue Jun 4 13:51:20 2013 +0530
Committer: Prasanna Santhanam <[email protected]>
Committed: Tue Jun 4 14:26:40 2013 +0530
----------------------------------------------------------------------
.../apache/cloudstack/api/ResponseGenerator.java | 162 +++++-----
.../storage/FindStoragePoolsForMigrationCmd.java | 25 +-
.../response/StoragePoolForMigrationResponse.java | 259 ---------------
.../api/response/StoragePoolResponse.java | 19 +-
server/src/com/cloud/api/ApiDBUtils.java | 9 +-
server/src/com/cloud/api/ApiResponseHelper.java | 5 +-
.../com/cloud/api/query/ViewResponseHelper.java | 64 ++--
.../cloud/api/query/dao/StoragePoolJoinDao.java | 12 +-
.../api/query/dao/StoragePoolJoinDaoImpl.java | 7 +-
9 files changed, 148 insertions(+), 414 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 7da4010..096bf26 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -16,11 +16,81 @@
// under the License.
package org.apache.cloudstack.api;
-import java.text.DecimalFormat;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Map;
-
+import com.cloud.async.AsyncJob;
+import com.cloud.capacity.Capacity;
+import com.cloud.configuration.Configuration;
+import com.cloud.configuration.ResourceCount;
+import com.cloud.configuration.ResourceLimit;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
+import com.cloud.dc.StorageNetworkIpRange;
+import com.cloud.dc.Vlan;
+import com.cloud.domain.Domain;
+import com.cloud.event.Event;
+import com.cloud.host.Host;
+import com.cloud.hypervisor.HypervisorCapabilities;
+import com.cloud.network.GuestVlan;
+import com.cloud.network.IpAddress;
+import com.cloud.network.Network;
+import com.cloud.network.Network.Service;
+import com.cloud.network.Networks.IsolationType;
+import com.cloud.network.PhysicalNetwork;
+import com.cloud.network.PhysicalNetworkServiceProvider;
+import com.cloud.network.PhysicalNetworkTrafficType;
+import com.cloud.network.RemoteAccessVpn;
+import com.cloud.network.Site2SiteCustomerGateway;
+import com.cloud.network.Site2SiteVpnConnection;
+import com.cloud.network.Site2SiteVpnGateway;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.network.VpnUser;
+import com.cloud.network.as.AutoScalePolicy;
+import com.cloud.network.as.AutoScaleVmGroup;
+import com.cloud.network.as.AutoScaleVmProfile;
+import com.cloud.network.as.Condition;
+import com.cloud.network.as.Counter;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.HealthCheckPolicy;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.PortForwardingRule;
+import com.cloud.network.rules.StaticNatRule;
+import com.cloud.network.rules.StickinessPolicy;
+import com.cloud.network.security.SecurityGroup;
+import com.cloud.network.security.SecurityRule;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcOffering;
+import com.cloud.offering.DiskOffering;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.org.Cluster;
+import com.cloud.projects.Project;
+import com.cloud.projects.ProjectAccount;
+import com.cloud.projects.ProjectInvitation;
+import com.cloud.region.ha.GlobalLoadBalancerRule;
+import com.cloud.server.ResourceTag;
+import com.cloud.storage.GuestOS;
+import com.cloud.storage.S3;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.Swift;
+import com.cloud.storage.Volume;
+import com.cloud.storage.snapshot.SnapshotPolicy;
+import com.cloud.storage.snapshot.SnapshotSchedule;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.user.UserAccount;
+import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.Ip;
+import com.cloud.vm.InstanceGroup;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.snapshot.VMSnapshot;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
@@ -92,7 +162,6 @@ import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
@@ -118,81 +187,10 @@ import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.usage.Usage;
-import com.cloud.async.AsyncJob;
-import com.cloud.capacity.Capacity;
-import com.cloud.configuration.Configuration;
-import com.cloud.configuration.ResourceCount;
-import com.cloud.configuration.ResourceLimit;
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.Pod;
-import com.cloud.dc.StorageNetworkIpRange;
-import com.cloud.dc.Vlan;
-import com.cloud.domain.Domain;
-import com.cloud.event.Event;
-import com.cloud.host.Host;
-import com.cloud.hypervisor.HypervisorCapabilities;
-import com.cloud.network.GuestVlan;
-import com.cloud.network.IpAddress;
-import com.cloud.network.Network;
-import com.cloud.network.Network.Service;
-import com.cloud.network.Networks.IsolationType;
-import com.cloud.network.PhysicalNetwork;
-import com.cloud.network.PhysicalNetworkServiceProvider;
-import com.cloud.network.PhysicalNetworkTrafficType;
-import com.cloud.network.RemoteAccessVpn;
-import com.cloud.network.Site2SiteCustomerGateway;
-import com.cloud.network.Site2SiteVpnConnection;
-import com.cloud.network.Site2SiteVpnGateway;
-import com.cloud.network.VirtualRouterProvider;
-import com.cloud.network.VpnUser;
-import com.cloud.network.as.AutoScalePolicy;
-import com.cloud.network.as.AutoScaleVmGroup;
-import com.cloud.network.as.AutoScaleVmProfile;
-import com.cloud.network.as.Condition;
-import com.cloud.network.as.Counter;
-import com.cloud.network.router.VirtualRouter;
-import com.cloud.network.rules.FirewallRule;
-import com.cloud.network.rules.HealthCheckPolicy;
-import com.cloud.network.rules.LoadBalancer;
-import com.cloud.network.rules.PortForwardingRule;
-import com.cloud.network.rules.StaticNatRule;
-import com.cloud.network.rules.StickinessPolicy;
-import com.cloud.network.security.SecurityGroup;
-import com.cloud.network.security.SecurityRule;
-import com.cloud.network.vpc.NetworkACL;
-import com.cloud.network.vpc.NetworkACLItem;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcOffering;
-import com.cloud.offering.DiskOffering;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offering.ServiceOffering;
-import com.cloud.org.Cluster;
-import com.cloud.projects.Project;
-import com.cloud.projects.ProjectAccount;
-import com.cloud.projects.ProjectInvitation;
-import com.cloud.region.ha.GlobalLoadBalancerRule;
-import com.cloud.server.ResourceTag;
-import com.cloud.storage.GuestOS;
-import com.cloud.storage.S3;
-import com.cloud.storage.Snapshot;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.Swift;
-import com.cloud.storage.Volume;
-import com.cloud.storage.snapshot.SnapshotPolicy;
-import com.cloud.storage.snapshot.SnapshotSchedule;
-import com.cloud.template.VirtualMachineTemplate;
-import com.cloud.user.Account;
-import com.cloud.user.User;
-import com.cloud.user.UserAccount;
-import com.cloud.uservm.UserVm;
-import com.cloud.utils.net.Ip;
-import com.cloud.vm.InstanceGroup;
-import com.cloud.vm.Nic;
-import com.cloud.vm.NicSecondaryIp;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.snapshot.VMSnapshot;
+import java.text.DecimalFormat;
+import java.util.EnumSet;
+import java.util.List;
+import java.util.Map;
public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
@@ -260,7 +258,7 @@ public interface ResponseGenerator {
StoragePoolResponse createStoragePoolResponse(StoragePool pool);
- StoragePoolForMigrationResponse
createStoragePoolForMigrationResponse(StoragePool pool);
+ StoragePoolResponse createStoragePoolForMigrationResponse(StoragePool
pool);
ClusterResponse createClusterResponse(Cluster cluster, Boolean
showCapacities);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
----------------------------------------------------------------------
diff --git
a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
index 37d007c..ed6ca04 100644
---
a/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
+++
b/api/src/org/apache/cloudstack/api/command/admin/storage/FindStoragePoolsForMigrationCmd.java
@@ -16,24 +16,23 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.cloud.async.AsyncJob;
+import com.cloud.storage.StoragePool;
+import com.cloud.utils.Pair;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.storage.StoragePool;
-import com.cloud.utils.Pair;
+import org.apache.log4j.Logger;
+
+import java.util.ArrayList;
+import java.util.List;
@APICommand(name = "findStoragePoolsForMigration", description="Lists storage
pools available for migration of a volume.",
- responseObject=StoragePoolForMigrationResponse.class)
+ responseObject=StoragePoolResponse.class)
public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
public static final Logger s_logger =
Logger.getLogger(FindStoragePoolsForMigrationCmd.class.getName());
@@ -72,13 +71,13 @@ public class FindStoragePoolsForMigrationCmd extends
BaseListCmd {
public void execute() {
Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools =
_mgr.listStoragePoolsForMigrationOfVolume(getId());
- ListResponse<StoragePoolForMigrationResponse> response = new
ListResponse<StoragePoolForMigrationResponse>();
- List<StoragePoolForMigrationResponse> poolResponses = new
ArrayList<StoragePoolForMigrationResponse>();
+ ListResponse<StoragePoolResponse> response = new
ListResponse<StoragePoolResponse>();
+ List<StoragePoolResponse> poolResponses = new
ArrayList<StoragePoolResponse>();
List<? extends StoragePool> allPools = pools.first();
List<? extends StoragePool> suitablePoolList = pools.second();
for (StoragePool pool : allPools) {
- StoragePoolForMigrationResponse poolResponse =
_responseGenerator.createStoragePoolForMigrationResponse(pool);
+ StoragePoolResponse poolResponse =
_responseGenerator.createStoragePoolForMigrationResponse(pool);
Boolean suitableForMigration = false;
for (StoragePool suitablePool : suitablePoolList) {
if (suitablePool.getId() == pool.getId()) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/api/src/org/apache/cloudstack/api/response/StoragePoolForMigrationResponse.java
----------------------------------------------------------------------
diff --git
a/api/src/org/apache/cloudstack/api/response/StoragePoolForMigrationResponse.java
b/api/src/org/apache/cloudstack/api/response/StoragePoolForMigrationResponse.java
deleted file mode 100644
index 2cfc8d0..0000000
---
a/api/src/org/apache/cloudstack/api/response/StoragePoolForMigrationResponse.java
+++ /dev/null
@@ -1,259 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements. See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership. The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License. You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.api.response;
-
-import java.util.Date;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.EntityReference;
-
-import com.cloud.serializer.Param;
-import com.cloud.storage.StoragePool;
-import com.cloud.storage.StoragePoolStatus;
-import com.google.gson.annotations.SerializedName;
-
-@EntityReference(value=StoragePool.class)
-public class StoragePoolForMigrationResponse extends BaseResponse {
- @SerializedName("id") @Param(description="the ID of the storage pool")
- private String id;
-
- @SerializedName("zoneid") @Param(description="the Zone ID of the storage
pool")
- private String zoneId;
-
- @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name
of the storage pool")
- private String zoneName;
-
- @SerializedName("podid") @Param(description="the Pod ID of the storage
pool")
- private String podId;
-
- @SerializedName("podname") @Param(description="the Pod name of the storage
pool")
- private String podName;
-
- @SerializedName("name") @Param(description="the name of the storage pool")
- private String name;
-
- @SerializedName("ipaddress") @Param(description="the IP address of the
storage pool")
- private String ipAddress;
-
- @SerializedName("path") @Param(description="the storage pool path")
- private String path;
-
- @SerializedName("created") @Param(description="the date and time the
storage pool was created")
- private Date created;
-
- @SerializedName("type") @Param(description="the storage pool type")
- private String type;
-
- @SerializedName("clusterid") @Param(description="the ID of the cluster for
the storage pool")
- private String clusterId;
-
- @SerializedName("clustername") @Param(description="the name of the cluster
for the storage pool")
- private String clusterName;
-
- @SerializedName("disksizetotal") @Param(description="the total disk size
of the storage pool")
- private Long diskSizeTotal;
-
- @SerializedName("disksizeallocated") @Param(description="the host's
currently allocated disk size")
- private Long diskSizeAllocated;
-
- @SerializedName("disksizeused") @Param(description="the host's currently
used disk size")
- private Long diskSizeUsed;
-
- @SerializedName("tags") @Param(description="the tags for the storage pool")
- private String tags;
-
- @SerializedName(ApiConstants.STATE) @Param(description="the state of the
storage pool")
- private StoragePoolStatus state;
-
- @SerializedName(ApiConstants.SCOPE) @Param(description="the scope of the
storage pool")
- private String scope;
-
- @SerializedName(ApiConstants.HYPERVISOR) @Param(description="the
hypervisor type of the storage pool")
- private String hypervisor;
-
- @SerializedName("suitableformigration") @Param(description="true if this
pool is suitable to migrate a volume," +
- " false otherwise")
- private Boolean suitableForMigration;
-
- /**
- * @return the scope
- */
- public String getScope() {
- return scope;
- }
-
- /**
- * @param scope the scope to set
- */
- public void setScope(String scope) {
- this.scope = scope;
- }
-
- public String getHypervisor() {
- return hypervisor;
- }
-
- public void setHypervisor(String hypervisor) {
- this.hypervisor = hypervisor;
- }
-
- @Override
- public String getObjectId() {
- return this.getId();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getZoneId() {
- return zoneId;
- }
-
- public void setZoneId(String zoneId) {
- this.zoneId = zoneId;
- }
-
- public String getZoneName() {
- return zoneName;
- }
-
- public void setZoneName(String zoneName) {
- this.zoneName = zoneName;
- }
-
- public String getPodId() {
- return podId;
- }
-
- public void setPodId(String podId) {
- this.podId = podId;
- }
-
- public String getPodName() {
- return podName;
- }
-
- public void setPodName(String podName) {
- this.podName = podName;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getIpAddress() {
- return ipAddress;
- }
-
- public void setIpAddress(String ipAddress) {
- this.ipAddress = ipAddress;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getClusterId() {
- return clusterId;
- }
-
- public void setClusterId(String clusterId) {
- this.clusterId = clusterId;
- }
-
- public String getClusterName() {
- return clusterName;
- }
-
- public void setClusterName(String clusterName) {
- this.clusterName = clusterName;
- }
-
- public Long getDiskSizeTotal() {
- return diskSizeTotal;
- }
-
- public void setDiskSizeTotal(Long diskSizeTotal) {
- this.diskSizeTotal = diskSizeTotal;
- }
-
- public Long getDiskSizeAllocated() {
- return diskSizeAllocated;
- }
-
- public void setDiskSizeAllocated(Long diskSizeAllocated) {
- this.diskSizeAllocated = diskSizeAllocated;
- }
-
- public Long getDiskSizeUsed() {
- return diskSizeUsed;
- }
-
- public void setDiskSizeUsed(Long diskSizeUsed) {
- this.diskSizeUsed = diskSizeUsed;
- }
-
- public String getTags() {
- return tags;
- }
-
- public void setTags(String tags) {
- this.tags = tags;
- }
-
- public StoragePoolStatus getState() {
- return state;
- }
-
- public void setState(StoragePoolStatus state) {
- this.state = state;
- }
-
- public void setSuitableForMigration(Boolean suitableForMigration) {
- this.suitableForMigration = suitableForMigration;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
----------------------------------------------------------------------
diff --git
a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
index 57a5ea1..965407d 100644
--- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java
@@ -16,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.response;
-import java.util.Date;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseResponse;
-import org.apache.cloudstack.api.EntityReference;
-
import com.cloud.serializer.Param;
import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolStatus;
import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import java.util.Date;
@EntityReference(value=StoragePool.class)
public class StoragePoolResponse extends BaseResponse {
@@ -89,6 +88,10 @@ public class StoragePoolResponse extends BaseResponse {
@SerializedName(ApiConstants.HYPERVISOR) @Param(description="the
hypervisor type of the storage pool")
private String hypervisor;
+ @SerializedName("suitableformigration") @Param(description="true if this
pool is suitable to migrate a volume," +
+ " false otherwise")
+ private Boolean suitableForMigration;
+
/**
* @return the scope
*/
@@ -259,4 +262,8 @@ public class StoragePoolResponse extends BaseResponse {
public void setState(StoragePoolStatus state) {
this.state = state;
}
+
+ public void setSuitableForMigration(Boolean suitableForMigration) {
+ this.suitableForMigration = suitableForMigration;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java
b/server/src/com/cloud/api/ApiDBUtils.java
index 1afedac..e5fa2e1 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -59,7 +59,6 @@ import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
@@ -171,8 +170,6 @@ import
com.cloud.network.as.dao.AutoScaleVmGroupPolicyMapDao;
import com.cloud.network.as.dao.AutoScaleVmProfileDao;
import com.cloud.network.as.dao.ConditionDao;
import com.cloud.network.as.dao.CounterDao;
-import com.cloud.network.dao.AccountGuestVlanMapDao;
-import com.cloud.network.dao.AccountGuestVlanMapVO;
import com.cloud.network.dao.FirewallRulesCidrsDao;
import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.dao.IPAddressDao;
@@ -197,7 +194,6 @@ import com.cloud.network.dao.Site2SiteVpnGatewayDao;
import com.cloud.network.dao.Site2SiteVpnGatewayVO;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRuleVO;
-import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupManager;
import com.cloud.network.security.SecurityGroupVO;
@@ -211,7 +207,6 @@ import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.projects.ProjectService;
-import com.cloud.region.ha.GlobalLoadBalancingRulesService;
import com.cloud.resource.ResourceManager;
import com.cloud.server.Criteria;
import com.cloud.server.ManagementServer;
@@ -1587,11 +1582,11 @@ public class ApiDBUtils {
return _poolJoinDao.setStoragePoolResponse(vrData, vr);
}
- public static StoragePoolForMigrationResponse
newStoragePoolForMigrationResponse(StoragePoolJoinVO vr) {
+ public static StoragePoolResponse
newStoragePoolForMigrationResponse(StoragePoolJoinVO vr) {
return _poolJoinDao.newStoragePoolForMigrationResponse(vr);
}
- public static StoragePoolForMigrationResponse
fillStoragePoolForMigrationDetails(StoragePoolForMigrationResponse
+ public static StoragePoolResponse
fillStoragePoolForMigrationDetails(StoragePoolResponse
vrData, StoragePoolJoinVO vr){
return _poolJoinDao.setStoragePoolForMigrationResponse(vrData, vr);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java
b/server/src/com/cloud/api/ApiResponseHelper.java
index 029b14c..55929cf 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -116,7 +116,6 @@ import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
@@ -947,9 +946,9 @@ public class ApiResponseHelper implements ResponseGenerator
{
}
@Override
- public StoragePoolForMigrationResponse
createStoragePoolForMigrationResponse(StoragePool pool) {
+ public StoragePoolResponse
createStoragePoolForMigrationResponse(StoragePool pool) {
List<StoragePoolJoinVO> viewPools =
ApiDBUtils.newStoragePoolView(pool);
- List<StoragePoolForMigrationResponse> listPools =
ViewResponseHelper.createStoragePoolForMigrationResponse(
+ List<StoragePoolResponse> listPools =
ViewResponseHelper.createStoragePoolForMigrationResponse(
viewPools.toArray(new StoragePoolJoinVO[viewPools.size()]));
assert listPools != null && listPools.size() == 1 : "There should be
one storage pool returned";
return listPools.get(0);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/server/src/com/cloud/api/query/ViewResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/ViewResponseHelper.java
b/server/src/com/cloud/api/query/ViewResponseHelper.java
index 827ae7b..a61da69 100644
--- a/server/src/com/cloud/api/query/ViewResponseHelper.java
+++ b/server/src/com/cloud/api/query/ViewResponseHelper.java
@@ -16,11 +16,28 @@
// under the License.
package com.cloud.api.query;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Hashtable;
-import java.util.List;
-
+import com.cloud.api.ApiDBUtils;
+import com.cloud.api.query.vo.AccountJoinVO;
+import com.cloud.api.query.vo.AffinityGroupJoinVO;
+import com.cloud.api.query.vo.AsyncJobJoinVO;
+import com.cloud.api.query.vo.DataCenterJoinVO;
+import com.cloud.api.query.vo.DiskOfferingJoinVO;
+import com.cloud.api.query.vo.DomainRouterJoinVO;
+import com.cloud.api.query.vo.EventJoinVO;
+import com.cloud.api.query.vo.HostJoinVO;
+import com.cloud.api.query.vo.InstanceGroupJoinVO;
+import com.cloud.api.query.vo.ProjectAccountJoinVO;
+import com.cloud.api.query.vo.ProjectInvitationJoinVO;
+import com.cloud.api.query.vo.ProjectJoinVO;
+import com.cloud.api.query.vo.ResourceTagJoinVO;
+import com.cloud.api.query.vo.SecurityGroupJoinVO;
+import com.cloud.api.query.vo.ServiceOfferingJoinVO;
+import com.cloud.api.query.vo.StoragePoolJoinVO;
+import com.cloud.api.query.vo.UserAccountJoinVO;
+import com.cloud.api.query.vo.UserVmJoinVO;
+import com.cloud.api.query.vo.VolumeJoinVO;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
@@ -29,8 +46,8 @@ import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.EventResponse;
-import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.HostForMigrationResponse;
+import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
@@ -39,35 +56,16 @@ import
org.apache.cloudstack.api.response.ResourceTagResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import com.cloud.api.ApiDBUtils;
-import com.cloud.api.query.vo.AccountJoinVO;
-import com.cloud.api.query.vo.AffinityGroupJoinVO;
-import com.cloud.api.query.vo.AsyncJobJoinVO;
-import com.cloud.api.query.vo.DataCenterJoinVO;
-import com.cloud.api.query.vo.DiskOfferingJoinVO;
-import com.cloud.api.query.vo.DomainRouterJoinVO;
-import com.cloud.api.query.vo.EventJoinVO;
-import com.cloud.api.query.vo.HostJoinVO;
-import com.cloud.api.query.vo.InstanceGroupJoinVO;
-import com.cloud.api.query.vo.ProjectAccountJoinVO;
-import com.cloud.api.query.vo.ProjectInvitationJoinVO;
-import com.cloud.api.query.vo.ProjectJoinVO;
-import com.cloud.api.query.vo.ResourceTagJoinVO;
-import com.cloud.api.query.vo.SecurityGroupJoinVO;
-import com.cloud.api.query.vo.ServiceOfferingJoinVO;
-import com.cloud.api.query.vo.StoragePoolJoinVO;
-import com.cloud.api.query.vo.UserAccountJoinVO;
-import com.cloud.api.query.vo.UserVmJoinVO;
-import com.cloud.api.query.vo.VolumeJoinVO;
-import com.cloud.user.Account;
-import com.cloud.user.UserContext;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.Hashtable;
+import java.util.List;
/**
* Helper class to generate response from DB view VO objects.
@@ -285,11 +283,11 @@ public class ViewResponseHelper {
return new ArrayList<StoragePoolResponse>(vrDataList.values());
}
- public static List<StoragePoolForMigrationResponse>
createStoragePoolForMigrationResponse(StoragePoolJoinVO... pools) {
- Hashtable<Long, StoragePoolForMigrationResponse> vrDataList = new
Hashtable<Long, StoragePoolForMigrationResponse>();
+ public static List<StoragePoolResponse>
createStoragePoolForMigrationResponse(StoragePoolJoinVO... pools) {
+ Hashtable<Long, StoragePoolResponse> vrDataList = new Hashtable<Long,
StoragePoolResponse>();
// Initialise the vrdatalist with the input data
for (StoragePoolJoinVO vr : pools) {
- StoragePoolForMigrationResponse vrData =
vrDataList.get(vr.getId());
+ StoragePoolResponse vrData = vrDataList.get(vr.getId());
if ( vrData == null ) {
// first time encountering this vm
vrData = ApiDBUtils.newStoragePoolForMigrationResponse(vr);
@@ -299,7 +297,7 @@ public class ViewResponseHelper {
}
vrDataList.put(vr.getId(), vrData);
}
- return new
ArrayList<StoragePoolForMigrationResponse>(vrDataList.values());
+ return new ArrayList<StoragePoolResponse>(vrDataList.values());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java
b/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java
index b7e467f..e438b06 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDao.java
@@ -16,14 +16,12 @@
// under the License.
package com.cloud.api.query.dao;
-import java.util.List;
-
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
-import org.apache.cloudstack.api.response.StoragePoolResponse;
-
import com.cloud.api.query.vo.StoragePoolJoinVO;
import com.cloud.storage.StoragePool;
import com.cloud.utils.db.GenericDao;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
+
+import java.util.List;
public interface StoragePoolJoinDao extends GenericDao<StoragePoolJoinVO,
Long> {
@@ -31,9 +29,9 @@ public interface StoragePoolJoinDao extends
GenericDao<StoragePoolJoinVO, Long>
StoragePoolResponse setStoragePoolResponse(StoragePoolResponse response,
StoragePoolJoinVO host);
- StoragePoolForMigrationResponse
newStoragePoolForMigrationResponse(StoragePoolJoinVO host);
+ StoragePoolResponse newStoragePoolForMigrationResponse(StoragePoolJoinVO
host);
- StoragePoolForMigrationResponse
setStoragePoolForMigrationResponse(StoragePoolForMigrationResponse response,
+ StoragePoolResponse setStoragePoolForMigrationResponse(StoragePoolResponse
response,
StoragePoolJoinVO host);
List<StoragePoolJoinVO> newStoragePoolView(StoragePool group);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0401774a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
index e276978..a6355ad 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
@@ -22,7 +22,6 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
-import org.apache.cloudstack.api.response.StoragePoolForMigrationResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -130,8 +129,8 @@ public class StoragePoolJoinDaoImpl extends
GenericDaoBase<StoragePoolJoinVO, Lo
}
@Override
- public StoragePoolForMigrationResponse
newStoragePoolForMigrationResponse(StoragePoolJoinVO pool) {
- StoragePoolForMigrationResponse poolResponse = new
StoragePoolForMigrationResponse();
+ public StoragePoolResponse
newStoragePoolForMigrationResponse(StoragePoolJoinVO pool) {
+ StoragePoolResponse poolResponse = new StoragePoolResponse();
poolResponse.setId(pool.getUuid());
poolResponse.setName(pool.getName());
poolResponse.setState(pool.getStatus());
@@ -175,7 +174,7 @@ public class StoragePoolJoinDaoImpl extends
GenericDaoBase<StoragePoolJoinVO, Lo
}
@Override
- public StoragePoolForMigrationResponse
setStoragePoolForMigrationResponse(StoragePoolForMigrationResponse response,
+ public StoragePoolResponse
setStoragePoolForMigrationResponse(StoragePoolResponse response,
StoragePoolJoinVO sp) {
String tag = sp.getTag();
if (tag != null) {