You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ek...@apache.org on 2015/06/29 10:43:45 UTC
[07/15] git commit: updated refs/heads/master to 527d6ee
Add supported hypervisors to a list
- By doing so the check is simple and will require less effort when adding other hypervisors.
Signed-off-by: wilderrodrigues <wr...@schubergphilis.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6f12984
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6f12984
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6f12984
Branch: refs/heads/master
Commit: b6f12984c586bebb900f2164bd7622a39747c2b1
Parents: ba19d47
Author: wilderrodrigues <wr...@schubergphilis.com>
Authored: Thu Jun 25 09:47:40 2015 +0200
Committer: wilderrodrigues <wr...@schubergphilis.com>
Committed: Mon Jun 29 09:59:10 2015 +0200
----------------------------------------------------------------------
server/src/com/cloud/server/ManagementServerImpl.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6f12984/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 8774f70..acf301f 100644
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -578,6 +578,7 @@ import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.host.dao.HostDetailsDao;
import com.cloud.host.dao.HostTagsDao;
+import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.hypervisor.HypervisorCapabilitiesVO;
@@ -762,8 +763,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
private ImageStoreDao _imgStoreDao;
@Inject
private ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
-
-
@Inject
private ProjectManager _projectMgr;
@Inject
@@ -801,6 +800,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
protected List<DeploymentPlanner> _planners;
+ private final List<HypervisorType> supportedHypervisors = new ArrayList<Hypervisor.HypervisorType>();
+
public List<DeploymentPlanner> getPlanners() {
return _planners;
}
@@ -879,6 +880,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
_availableIdsMap.put(id, true);
}
+ supportedHypervisors.add(HypervisorType.KVM);
+ supportedHypervisors.add(HypervisorType.XenServer);
+
return true;
}
@@ -3778,7 +3782,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
final ClusterVO cluster = ApiDBUtils.findClusterById(command.getClusterId());
- if (cluster == null || cluster.getHypervisorType() != HypervisorType.XenServer || cluster.getHypervisorType() != HypervisorType.KVM) {
+ if (cluster == null || !supportedHypervisors.contains(cluster.getHypervisorType())) {
throw new InvalidParameterValueException("This operation is not supported for this hypervisor type");
}
return updateHostsInCluster(command);
@@ -3793,10 +3797,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
final HostVO host = _hostDao.findById(cmd.getHostId());
- if (host.getHypervisorType() != HypervisorType.XenServer || host.getHypervisorType() != HypervisorType.KVM) {
+ if (!supportedHypervisors.contains(host.getHypervisorType())) {
throw new InvalidParameterValueException("This operation is not supported for this hypervisor type");
}
-
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(final TransactionStatus status) {
@@ -3816,7 +3819,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
}
});
-
return true;
}