You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ya...@apache.org on 2013/07/22 07:37:10 UTC
[01/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Updated Branches:
refs/heads/master d423a755f -> d893cb48a
refs/heads/pvlan 2bcf71638 -> ce299da11
Changes for implicitly dedicating a resource. It includes a following:
1. A new implicit planner which extends the functionality provided by FirstFitPlanner.
2. Implicit planner can be used in either strict or preferred mode. In strict mode it tries to deploy a vm of a given account on a host on which vms of the account are already running. If no such host is found it'll search for an empty host to service the request. Otherwise the deploy vm request fails.
3. In preferred mode, if a host which is running vms of the account or an empty host isn't found, the planner then tries to deploy on any other host provided it isn't running implicitly dedicated strict vms of any other account.
4. Updated the createServiceOffering api to configure the details for the planner that the service offering is using.
5. Made db changes to store the service offering details for the planner.
6. Unit tests for testing the implicit planner functionality.
7. Marvin test for validating the functionality.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/adbebc18
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/adbebc18
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/adbebc18
Branch: refs/heads/pvlan
Commit: adbebc1892cf88df8c801291a88bc836c99b8c14
Parents: caf0dd2
Author: Devdeep Singh <de...@gmail.com>
Authored: Fri May 17 11:14:25 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Fri May 17 11:40:31 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/deploy/DeploymentPlanner.java | 7 +
.../org/apache/cloudstack/api/ApiConstants.java | 1 +
.../offering/CreateServiceOfferingCmd.java | 16 +
client/pom.xml | 5 +
client/tomcatconf/applicationContext.xml.in | 6 +-
client/tomcatconf/componentContext.xml.in | 1 +
.../cloud/service/ServiceOfferingDetailsVO.java | 73 +++
.../com/cloud/service/ServiceOfferingVO.java | 27 +
.../cloud/service/dao/ServiceOfferingDao.java | 2 +
.../service/dao/ServiceOfferingDaoImpl.java | 19 +-
.../service/dao/ServiceOfferingDetailsDao.java | 29 +
.../dao/ServiceOfferingDetailsDaoImpl.java | 98 ++++
.../implicit-dedication/pom.xml | 29 +
.../cloud/deploy/ImplicitDedicationPlanner.java | 249 ++++++++
.../implicitplanner/ImplicitPlannerTest.java | 586 +++++++++++++++++++
plugins/pom.xml | 1 +
.../configuration/ConfigurationManager.java | 3 +-
.../configuration/ConfigurationManagerImpl.java | 20 +-
.../cloud/vpc/MockConfigurationManagerImpl.java | 2 +-
.../networkoffering/ChildTestConfiguration.java | 27 +-
setup/db/db/schema-410to420.sql | 11 +-
.../component/test_implicit_planner.py | 232 ++++++++
tools/marvin/marvin/integration/lib/base.py | 4 +
23 files changed, 1430 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/api/src/com/cloud/deploy/DeploymentPlanner.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/deploy/DeploymentPlanner.java b/api/src/com/cloud/deploy/DeploymentPlanner.java
index eb56a59..769da39 100644
--- a/api/src/com/cloud/deploy/DeploymentPlanner.java
+++ b/api/src/com/cloud/deploy/DeploymentPlanner.java
@@ -213,6 +213,13 @@ public interface DeploymentPlanner extends Adapter {
_hostIds.add(hostId);
}
+ public void addHostList(Collection<Long> hostList) {
+ if (_hostIds == null) {
+ _hostIds = new HashSet<Long>();
+ }
+ _hostIds.addAll(hostList);
+ }
+
public boolean shouldAvoid(Host host) {
if (_dcIds != null && _dcIds.contains(host.getDataCenterId())) {
return true;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index 8d7739c..cf093bf 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -312,6 +312,7 @@ public class ApiConstants {
public static final String ACCEPT = "accept";
public static final String SORT_KEY = "sortkey";
public static final String ACCOUNT_DETAILS = "accountdetails";
+ public static final String SERVICE_OFFERING_DETAILS = "serviceofferingdetails";
public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index c155b70..4c54a4e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
+import java.util.Collection;
+import java.util.Map;
+
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -87,6 +90,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "The deployment planner heuristics used to deploy a VM of this offering. If null, value of global config vm.deployment.planner is used")
private String deploymentPlanner;
+ @Parameter(name = ApiConstants.SERVICE_OFFERING_DETAILS, type = CommandType.MAP, description = "details for planner, used to store specific parameters")
+ private Map<String, String> details;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -155,6 +161,16 @@ public class CreateServiceOfferingCmd extends BaseCmd {
return deploymentPlanner;
}
+ public Map<String, String> getDetails() {
+ if (details == null || details.isEmpty()) {
+ return null;
+ }
+
+ Collection<String> paramsCollection = details.values();
+ Map<String, String> params = (Map<String, String>)(paramsCollection.toArray())[0];
+ return params;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 197ba27..0c38ecb 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -133,6 +133,11 @@
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-plugin-planner-implicit-dedication</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-host-allocator-random</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index 1d1eca4..b500fde 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -370,7 +370,7 @@
<bean id="vpnUserDaoImpl" class="com.cloud.network.dao.VpnUserDaoImpl" />
<bean id="applicationLbRuleDaoImpl" class="org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDaoImpl" />
<bean id="networkOfferingDetailsDaoImpl" class="com.cloud.offerings.dao.NetworkOfferingDetailsDaoImpl" />
-
+ <bean id="serviceOfferingDetailsDaoImpl" class="com.cloud.service.dao.ServiceOfferingDetailsDaoImpl"/>
<!--
Checkers
@@ -547,6 +547,10 @@
<property name="name" value="UserConcentratedPodPlanner"/>
</bean>
+ <bean id="ImplicitDedicationPlanner" class="com.cloud.deploy.ImplicitDedicationPlanner">
+ <property name="name" value="ImplicitDedicationPlanner"/>
+ </bean>
+
<bean id="clusterBasedAgentLoadBalancerPlanner" class="com.cloud.cluster.agentlb.ClusterBasedAgentLoadBalancerPlanner">
<property name="name" value="ClusterBasedAgentLoadBalancerPlanner"/>
</bean>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/client/tomcatconf/componentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in
index 8a45e5f..e946f44 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -156,6 +156,7 @@
<ref bean="FirstFitPlanner" />
<ref bean="UserDispersingPlanner" />
<ref bean="UserConcentratedPodPlanner" />
+ <ref bean="ImplicitDedicationPlanner" />
<!--
<ref bean="BareMetalPlanner" />
-->
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java
new file mode 100644
index 0000000..b005c73
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/ServiceOfferingDetailsVO.java
@@ -0,0 +1,73 @@
+// 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 com.cloud.service;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="service_offering_details")
+public class ServiceOfferingDetailsVO implements InternalIdentity {
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="service_offering_id")
+ private long serviceOfferingId;
+
+ @Column(name="name")
+ private String name;
+
+ @Column(name="value")
+ private String value;
+
+ protected ServiceOfferingDetailsVO() {
+ }
+
+ public ServiceOfferingDetailsVO(long serviceOfferingId, String name, String value) {
+ this.serviceOfferingId = serviceOfferingId;
+ this.name = name;
+ this.value = value;
+ }
+
+ public long getServiceOfferingId() {
+ return serviceOfferingId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public long getId() {
+ return id;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
index fd31d30..9a262c5 100755
--- a/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
+++ b/engine/schema/src/com/cloud/service/ServiceOfferingVO.java
@@ -16,6 +16,8 @@
// under the License.
package com.cloud.service;
+import java.util.Map;
+
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@@ -71,6 +73,12 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
@Column(name = "deployment_planner")
private String deploymentPlanner = null;
+ // This is a delayed load value. If the value is null,
+ // then this field has not been loaded yet.
+ // Call service offering dao to load it.
+ @Transient
+ Map<String, String> details;
+
protected ServiceOfferingVO() {
super();
}
@@ -225,4 +233,23 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
return deploymentPlanner;
}
+ public Map<String, String> getDetails() {
+ return details;
+ }
+
+ public String getDetail(String name) {
+ assert (details != null) : "Did you forget to load the details?";
+
+ return details != null ? details.get(name) : null;
+ }
+
+ public void setDetail(String name, String value) {
+ assert (details != null) : "Did you forget to load the details?";
+
+ details.put(name, value);
+ }
+
+ public void setDetails(Map<String, String> details) {
+ this.details = details;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
index 589de7c..7da7208 100644
--- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDao.java
@@ -31,4 +31,6 @@ public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long>
List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId);
List<ServiceOfferingVO> findSystemOffering(Long domainId, Boolean isSystem, String vm_type);
ServiceOfferingVO persistDeafultServiceOffering(ServiceOfferingVO offering);
+ void loadDetails(ServiceOfferingVO serviceOffering);
+ void saveDetails(ServiceOfferingVO serviceOffering);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
index 062103e..14b2abf 100644
--- a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDaoImpl.java
@@ -18,15 +18,16 @@ package com.cloud.service.dao;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import javax.ejb.Local;
+import javax.inject.Inject;
import javax.persistence.EntityExistsException;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.service.ServiceOfferingVO;
-import com.cloud.storage.DiskOfferingVO;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
@@ -37,6 +38,8 @@ import com.cloud.utils.db.SearchCriteria;
public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Long> implements ServiceOfferingDao {
protected static final Logger s_logger = Logger.getLogger(ServiceOfferingDaoImpl.class);
+ @Inject protected ServiceOfferingDetailsDao detailsDao;
+
protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdSearch;
protected final SearchBuilder<ServiceOfferingVO> SystemServiceOffering;
@@ -154,4 +157,18 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
return update(id, offering);
}
+
+ @Override
+ public void loadDetails(ServiceOfferingVO serviceOffering) {
+ Map<String, String> details = detailsDao.findDetails(serviceOffering.getId());
+ serviceOffering.setDetails(details);
+ }
+
+ @Override
+ public void saveDetails(ServiceOfferingVO serviceOffering) {
+ Map<String, String> details = serviceOffering.getDetails();
+ if (details != null) {
+ detailsDao.persist(serviceOffering.getId(), details);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDao.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDao.java
new file mode 100644
index 0000000..3816910
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDao.java
@@ -0,0 +1,29 @@
+// 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 com.cloud.service.dao;
+
+import java.util.Map;
+
+import com.cloud.service.ServiceOfferingDetailsVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface ServiceOfferingDetailsDao extends GenericDao<ServiceOfferingDetailsVO, Long> {
+ Map<String, String> findDetails(long serviceOfferingId);
+ void persist(long serviceOfferingId, Map<String, String> details);
+ ServiceOfferingDetailsVO findDetail(long serviceOfferingId, String name);
+ void deleteDetails(long serviceOfferingId);
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
new file mode 100644
index 0000000..91d736a
--- /dev/null
+++ b/engine/schema/src/com/cloud/service/dao/ServiceOfferingDetailsDaoImpl.java
@@ -0,0 +1,98 @@
+// 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 com.cloud.service.dao;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.service.ServiceOfferingDetailsVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+
+@Component
+@Local(value=ServiceOfferingDetailsDao.class)
+public class ServiceOfferingDetailsDaoImpl extends GenericDaoBase<ServiceOfferingDetailsVO, Long>
+ implements ServiceOfferingDetailsDao {
+ protected final SearchBuilder<ServiceOfferingDetailsVO> ServiceOfferingSearch;
+ protected final SearchBuilder<ServiceOfferingDetailsVO> DetailSearch;
+
+ public ServiceOfferingDetailsDaoImpl() {
+ ServiceOfferingSearch = createSearchBuilder();
+ ServiceOfferingSearch.and("serviceOfferingId", ServiceOfferingSearch.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
+ ServiceOfferingSearch.done();
+
+ DetailSearch = createSearchBuilder();
+ DetailSearch.and("serviceOfferingId", DetailSearch.entity().getServiceOfferingId(), SearchCriteria.Op.EQ);
+ DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ);
+ DetailSearch.done();
+ }
+
+ @Override
+ public ServiceOfferingDetailsVO findDetail(long serviceOfferingId, String name) {
+ SearchCriteria<ServiceOfferingDetailsVO> sc = DetailSearch.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ sc.setParameters("name", name);
+ ServiceOfferingDetailsVO detail = findOneIncludingRemovedBy(sc);
+ return detail;
+ }
+
+ @Override
+ public Map<String, String> findDetails(long serviceOfferingId) {
+ SearchCriteria<ServiceOfferingDetailsVO> sc = ServiceOfferingSearch.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ List<ServiceOfferingDetailsVO> results = search(sc, null);
+ Map<String, String> details = new HashMap<String, String>(results.size());
+ for (ServiceOfferingDetailsVO result : results) {
+ details.put(result.getName(), result.getValue());
+ }
+
+ return details;
+ }
+
+ @Override
+ public void deleteDetails(long serviceOfferingId) {
+ SearchCriteria sc = ServiceOfferingSearch.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ List<ServiceOfferingDetailsVO> results = search(sc, null);
+ for (ServiceOfferingDetailsVO result : results) {
+ remove(result.getId());
+ }
+ }
+
+ @Override
+ public void persist(long serviceOfferingId, Map<String, String> details) {
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+ SearchCriteria<ServiceOfferingDetailsVO> sc = ServiceOfferingSearch.create();
+ sc.setParameters("serviceOfferingId", serviceOfferingId);
+ expunge(sc);
+
+ for (Map.Entry<String, String> detail : details.entrySet()) {
+ String value = detail.getValue();
+ ServiceOfferingDetailsVO vo = new ServiceOfferingDetailsVO(serviceOfferingId, detail.getKey(), value);
+ persist(vo);
+ }
+ txn.commit();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/plugins/deployment-planners/implicit-dedication/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/pom.xml b/plugins/deployment-planners/implicit-dedication/pom.xml
new file mode 100644
index 0000000..1855592
--- /dev/null
+++ b/plugins/deployment-planners/implicit-dedication/pom.xml
@@ -0,0 +1,29 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cloud-plugin-planner-implicit-dedication</artifactId>
+ <name>Apache CloudStack Plugin - Implicit Dedication Planner</name>
+ <parent>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloudstack-plugins</artifactId>
+ <version>4.2.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
new file mode 100644
index 0000000..d47d8f5
--- /dev/null
+++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
@@ -0,0 +1,249 @@
+// 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 com.cloud.deploy;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.configuration.Config;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.host.HostVO;
+import com.cloud.resource.ResourceManager;
+import com.cloud.service.ServiceOfferingVO;
+import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.service.dao.ServiceOfferingDetailsDao;
+import com.cloud.user.Account;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.NumbersUtil;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
+
+@Local(value=DeploymentPlanner.class)
+public class ImplicitDedicationPlanner extends FirstFitPlanner implements DeploymentClusterPlanner {
+
+ private static final Logger s_logger = Logger.getLogger(ImplicitDedicationPlanner.class);
+
+ @Inject
+ private ServiceOfferingDao serviceOfferingDao;
+ @Inject
+ private ServiceOfferingDetailsDao serviceOfferingDetailsDao;
+ @Inject
+ private ResourceManager resourceMgr;
+
+ private int capacityReleaseInterval;
+
+ @Override
+ public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
+ super.configure(name, params);
+ capacityReleaseInterval = NumbersUtil.parseInt(_configDao.getValue(Config.CapacitySkipcountingHours.key()), 3600);
+ return true;
+ }
+
+ @Override
+ public List<Long> orderClusters(VirtualMachineProfile<? extends VirtualMachine> vmProfile,
+ DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException {
+ List<Long> clusterList = super.orderClusters(vmProfile, plan, avoid);
+ Set<Long> hostsToAvoid = avoid.getHostsToAvoid();
+ Account account = vmProfile.getOwner();
+
+ if (clusterList == null || clusterList.isEmpty()) {
+ return clusterList;
+ }
+
+ // Check if strict or preferred mode should be used.
+ boolean preferred = isServiceOfferingUsingPlannerInPreferredMode(vmProfile.getServiceOfferingId());
+
+ // Get the list of all the hosts in the given clusters
+ List<Long> allHosts = new ArrayList<Long>();
+ for (Long cluster : clusterList) {
+ List<HostVO> hostsInCluster = resourceMgr.listAllHostsInCluster(cluster);
+ for (HostVO hostVO : hostsInCluster) {
+ allHosts.add(hostVO.getId());
+ }
+ }
+
+ // Go over all the hosts in the cluster and get a list of
+ // 1. All empty hosts, not running any vms.
+ // 2. Hosts running vms for this account and created by a service offering which uses an
+ // implicit dedication planner.
+ // 3. Hosts running vms created by implicit planner and in strict mode of other accounts.
+ // 4. Hosts running vms from other account or from this account but created by a service offering which uses
+ // any planner besides implicit.
+ Set<Long> emptyHosts = new HashSet<Long>();
+ Set<Long> hostRunningVmsOfAccount = new HashSet<Long>();
+ Set<Long> hostRunningStrictImplicitVmsOfOtherAccounts = new HashSet<Long>();
+ Set<Long> allOtherHosts = new HashSet<Long>();
+ for (Long host : allHosts) {
+ List<UserVmVO> userVms = getVmsOnHost(host);
+ if (userVms == null || userVms.isEmpty()) {
+ emptyHosts.add(host);
+ } else if (checkHostSuitabilityForImplicitDedication(account.getAccountId(), userVms)) {
+ hostRunningVmsOfAccount.add(host);
+ } else if (checkIfAllVmsCreatedInStrictMode(account.getAccountId(), userVms)) {
+ hostRunningStrictImplicitVmsOfOtherAccounts.add(host);
+ } else {
+ allOtherHosts.add(host);
+ }
+ }
+
+ // Hosts running vms of other accounts created by ab implicit planner in strict mode should always be avoided.
+ avoid.addHostList(hostRunningStrictImplicitVmsOfOtherAccounts);
+
+ if (!hostRunningVmsOfAccount.isEmpty() && (hostsToAvoid == null ||
+ !hostsToAvoid.containsAll(hostRunningVmsOfAccount))) {
+ // Check if any of hosts that are running implicit dedicated vms are available (not in avoid list).
+ // If so, we'll try and use these hosts.
+ avoid.addHostList(emptyHosts);
+ avoid.addHostList(allOtherHosts);
+ clusterList = getUpdatedClusterList(clusterList, avoid.getHostsToAvoid());
+ } else if (!emptyHosts.isEmpty() && (hostsToAvoid == null || !hostsToAvoid.containsAll(emptyHosts))) {
+ // If there aren't implicit resources try on empty hosts
+ avoid.addHostList(allOtherHosts);
+ clusterList = getUpdatedClusterList(clusterList, avoid.getHostsToAvoid());
+ } else if (!preferred) {
+ // If in strict mode, there is nothing else to try.
+ clusterList = null;
+ } else {
+ // If in preferred mode, check if hosts are available to try, otherwise return an empty cluster list.
+ if (!allOtherHosts.isEmpty() && (hostsToAvoid == null || !hostsToAvoid.containsAll(allOtherHosts))) {
+ clusterList = getUpdatedClusterList(clusterList, avoid.getHostsToAvoid());
+ } else {
+ clusterList = null;
+ }
+ }
+
+ return clusterList;
+ }
+
+ private List<UserVmVO> getVmsOnHost(long hostId) {
+ List<UserVmVO> vms = _vmDao.listUpByHostId(hostId);
+ List<UserVmVO> vmsByLastHostId = _vmDao.listByLastHostId(hostId);
+ if (vmsByLastHostId.size() > 0) {
+ // check if any VMs are within skip.counting.hours, if yes we have to consider the host.
+ for (UserVmVO stoppedVM : vmsByLastHostId) {
+ long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - stoppedVM.getUpdateTime()
+ .getTime()) / 1000;
+ if (secondsSinceLastUpdate < capacityReleaseInterval) {
+ vms.add(stoppedVM);
+ }
+ }
+ }
+
+ return vms;
+ }
+
+ private boolean checkHostSuitabilityForImplicitDedication(Long accountId, List<UserVmVO> allVmsOnHost) {
+ boolean suitable = true;
+ for (UserVmVO vm : allVmsOnHost) {
+ if (vm.getAccountId() != accountId) {
+ s_logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it is " +
+ "running instances of another account");
+ suitable = false;
+ break;
+ } else {
+ if (!isImplicitPlannerUsedByOffering(vm.getServiceOfferingId())) {
+ s_logger.info("Host " + vm.getHostId() + " found to be unsuitable for implicit dedication as it " +
+ "is running instances of this account which haven't been created using implicit dedication.");
+ suitable = false;
+ break;
+ }
+ }
+ }
+ return suitable;
+ }
+
+ private boolean checkIfAllVmsCreatedInStrictMode(Long accountId, List<UserVmVO> allVmsOnHost) {
+ boolean createdByImplicitStrict = true;
+ for (UserVmVO vm : allVmsOnHost) {
+ if (!isImplicitPlannerUsedByOffering(vm.getServiceOfferingId())) {
+ s_logger.info("Host " + vm.getHostId() + " found to be running a vm created by a planner other" +
+ " than implicit.");
+ createdByImplicitStrict = false;
+ break;
+ } else if (isServiceOfferingUsingPlannerInPreferredMode(vm.getServiceOfferingId())) {
+ s_logger.info("Host " + vm.getHostId() + " found to be running a vm created by an implicit planner" +
+ " in preferred mode.");
+ createdByImplicitStrict = false;
+ break;
+ }
+ }
+ return createdByImplicitStrict;
+ }
+
+ private boolean isImplicitPlannerUsedByOffering(long offeringId) {
+ boolean implicitPlannerUsed = false;
+ ServiceOfferingVO offering = serviceOfferingDao.findByIdIncludingRemoved(offeringId);
+ if (offering == null) {
+ s_logger.error("Couldn't retrieve the offering by the given id : " + offeringId);
+ } else {
+ String plannerName = offering.getDeploymentPlanner();
+ if (plannerName == null) {
+ plannerName = _globalDeploymentPlanner;
+ }
+
+ if (plannerName != null && this.getName().equals(plannerName)) {
+ implicitPlannerUsed = true;
+ }
+ }
+
+ return implicitPlannerUsed;
+ }
+
+ private boolean isServiceOfferingUsingPlannerInPreferredMode(long serviceOfferingId) {
+ boolean preferred = false;
+ Map<String, String> details = serviceOfferingDetailsDao.findDetails(serviceOfferingId);
+ if (details != null && !details.isEmpty()) {
+ String preferredAttribute = details.get("ImplicitDedicationMode");
+ if (preferredAttribute != null && preferredAttribute.equals("Preferred")) {
+ preferred = true;
+ }
+ }
+ return preferred;
+ }
+
+ private List<Long> getUpdatedClusterList(List<Long> clusterList, Set<Long> hostsSet) {
+ List<Long> updatedClusterList = new ArrayList<Long>();
+ for (Long cluster : clusterList) {
+ List<HostVO> hosts = resourceMgr.listAllHostsInCluster(cluster);
+ Set<Long> hostsInClusterSet = new HashSet<Long>();
+ for (HostVO host : hosts) {
+ hostsInClusterSet.add(host.getId());
+ }
+
+ if (!hostsSet.containsAll(hostsInClusterSet)) {
+ updatedClusterList.add(cluster);
+ }
+ }
+
+ return updatedClusterList;
+ }
+
+ @Override
+ public PlannerResourceUsage getResourceUsage() {
+ return PlannerResourceUsage.Dedicated;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
new file mode 100644
index 0000000..4450760
--- /dev/null
+++ b/plugins/deployment-planners/implicit-dedication/test/org/apache/cloudstack/implicitplanner/ImplicitPlannerTest.java
@@ -0,0 +1,586 @@
+// 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.implicitplanner;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.test.utils.SpringUtils;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.core.type.classreading.MetadataReader;
+import org.springframework.core.type.classreading.MetadataReaderFactory;
+import org.springframework.core.type.filter.TypeFilter;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.support.AnnotationConfigContextLoader;
+
+import com.cloud.capacity.CapacityManager;
+import com.cloud.capacity.CapacityVO;
+import com.cloud.capacity.dao.CapacityDao;
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.deploy.DataCenterDeployment;
+import com.cloud.deploy.DeploymentPlanner.ExcludeList;
+import com.cloud.deploy.ImplicitDedicationPlanner;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.host.HostVO;
+import com.cloud.host.dao.HostDao;
+import com.cloud.resource.ResourceManager;
+import com.cloud.service.ServiceOfferingVO;
+import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.service.dao.ServiceOfferingDetailsDao;
+import com.cloud.storage.StorageManager;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.GuestOSCategoryDao;
+import com.cloud.storage.dao.GuestOSDao;
+import com.cloud.storage.dao.StoragePoolHostDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserContext;
+import com.cloud.utils.Pair;
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachineProfileImpl;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
+public class ImplicitPlannerTest {
+
+ @Inject
+ ImplicitDedicationPlanner planner = new ImplicitDedicationPlanner();
+ @Inject
+ HostDao hostDao;
+ @Inject
+ DataCenterDao dcDao;
+ @Inject
+ HostPodDao podDao;
+ @Inject
+ ClusterDao clusterDao;
+ @Inject
+ GuestOSDao guestOSDao;
+ @Inject
+ GuestOSCategoryDao guestOSCategoryDao;
+ @Inject
+ DiskOfferingDao diskOfferingDao;
+ @Inject
+ StoragePoolHostDao poolHostDao;
+ @Inject
+ UserVmDao vmDao;
+ @Inject
+ VMInstanceDao vmInstanceDao;
+ @Inject
+ VolumeDao volsDao;
+ @Inject
+ CapacityManager capacityMgr;
+ @Inject
+ ConfigurationDao configDao;
+ @Inject
+ PrimaryDataStoreDao storagePoolDao;
+ @Inject
+ CapacityDao capacityDao;
+ @Inject
+ AccountManager accountMgr;
+ @Inject
+ StorageManager storageMgr;
+ @Inject
+ DataStoreManager dataStoreMgr;
+ @Inject
+ ClusterDetailsDao clusterDetailsDao;
+ @Inject
+ ServiceOfferingDao serviceOfferingDao;
+ @Inject
+ ServiceOfferingDetailsDao serviceOfferingDetailsDao;
+ @Inject
+ ResourceManager resourceMgr;
+
+ private static long domainId = 5L;
+ long dataCenterId = 1L;
+ long accountId = 200L;
+ long offeringId = 12L;
+ int noOfCpusInOffering = 1;
+ int cpuSpeedInOffering = 500;
+ int ramInOffering = 512;
+ AccountVO acct = new AccountVO(accountId);
+
+ @BeforeClass
+ public static void setUp() throws ConfigurationException {
+ }
+
+ @Before
+ public void testSetUp() {
+ ComponentContext.initComponentsLifeCycle();
+
+ acct.setType(Account.ACCOUNT_TYPE_NORMAL);
+ acct.setAccountName("user1");
+ acct.setDomainId(domainId);
+ acct.setId(accountId);
+
+ UserContext.registerContext(1, acct, null, true);
+ }
+
+ @Test
+ public void checkWhenDcInAvoidList() throws InsufficientServerCapacityException {
+ DataCenterVO mockDc = mock(DataCenterVO.class);
+ ExcludeList avoids = mock(ExcludeList.class);
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ VMInstanceVO vm = mock(VMInstanceVO.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+
+ when(avoids.shouldAvoid(mockDc)).thenReturn(true);
+ when(vmProfile.getVirtualMachine()).thenReturn(vm);
+ when(vm.getDataCenterId()).thenReturn(1L);
+ when(dcDao.findById(1L)).thenReturn(mockDc);
+
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+ assertTrue("Cluster list should be null/empty if the dc is in avoid list",
+ (clusterList == null || clusterList.isEmpty()));
+ }
+
+ @Test
+ public void checkStrictModeWithCurrentAccountVmsPresent() throws InsufficientServerCapacityException {
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+ ExcludeList avoids = new ExcludeList();
+
+ initializeForTest(vmProfile, plan);
+
+ initializeForImplicitPlannerTest(false);
+
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+
+ // Validations.
+ // Check cluster 2 and 3 are not in the cluster list.
+ // Host 6 and 7 should also be in avoid list.
+ assertFalse("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
+ boolean foundNeededCluster = false;
+ for (Long cluster : clusterList) {
+ if (cluster != 1) {
+ fail("Found a cluster that shouldn't have been present, cluster id : " + cluster);
+ }else {
+ foundNeededCluster = true;
+ }
+ }
+ assertTrue("Didn't find cluster 1 in the list. It should have been present", foundNeededCluster);
+
+ Set<Long> hostsInAvoidList = avoids.getHostsToAvoid();
+ assertFalse("Host 5 shouldn't have be in the avoid list, but it is present", hostsInAvoidList.contains(5L));
+ Set<Long> hostsThatShouldBeInAvoidList = new HashSet<Long>();
+ hostsThatShouldBeInAvoidList.add(6L);
+ hostsThatShouldBeInAvoidList.add(7L);
+ assertTrue("Hosts 6 and 7 that should have been present were not found in avoid list" ,
+ hostsInAvoidList.containsAll(hostsThatShouldBeInAvoidList));
+ }
+
+ @Test
+ public void checkStrictModeHostWithCurrentAccountVmsFull() throws InsufficientServerCapacityException {
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+ ExcludeList avoids = new ExcludeList();
+
+ initializeForTest(vmProfile, plan);
+
+ initializeForImplicitPlannerTest(false);
+
+ // Mark the host 5 with current account vms to be in avoid list.
+ avoids.addHost(5L);
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+
+ // Validations.
+ // Check cluster 1 and 3 are not in the cluster list.
+ // Host 5 and 7 should also be in avoid list.
+ assertFalse("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
+ boolean foundNeededCluster = false;
+ for (Long cluster : clusterList) {
+ if (cluster != 2) {
+ fail("Found a cluster that shouldn't have been present, cluster id : " + cluster);
+ }else {
+ foundNeededCluster = true;
+ }
+ }
+ assertTrue("Didn't find cluster 2 in the list. It should have been present", foundNeededCluster);
+
+ Set<Long> hostsInAvoidList = avoids.getHostsToAvoid();
+ assertFalse("Host 6 shouldn't have be in the avoid list, but it is present", hostsInAvoidList.contains(6L));
+ Set<Long> hostsThatShouldBeInAvoidList = new HashSet<Long>();
+ hostsThatShouldBeInAvoidList.add(5L);
+ hostsThatShouldBeInAvoidList.add(7L);
+ assertTrue("Hosts 5 and 7 that should have been present were not found in avoid list" ,
+ hostsInAvoidList.containsAll(hostsThatShouldBeInAvoidList));
+ }
+
+ @Test
+ public void checkStrictModeNoHostsAvailable() throws InsufficientServerCapacityException {
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+ ExcludeList avoids = new ExcludeList();
+
+ initializeForTest(vmProfile, plan);
+
+ initializeForImplicitPlannerTest(false);
+
+ // Mark the host 5 and 6 to be in avoid list.
+ avoids.addHost(5L);
+ avoids.addHost(6L);
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+
+ // Validations.
+ // Check cluster list is empty.
+ assertTrue("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
+ }
+
+ @Test
+ public void checkPreferredModePreferredHostAvailable() throws InsufficientServerCapacityException {
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+ ExcludeList avoids = new ExcludeList();
+
+ initializeForTest(vmProfile, plan);
+
+ initializeForImplicitPlannerTest(true);
+
+ // Mark the host 5 and 6 to be in avoid list.
+ avoids.addHost(5L);
+ avoids.addHost(6L);
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+
+ // Validations.
+ // Check cluster 1 and 2 are not in the cluster list.
+ // Host 5 and 6 should also be in avoid list.
+ assertFalse("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
+ boolean foundNeededCluster = false;
+ for (Long cluster : clusterList) {
+ if (cluster != 3) {
+ fail("Found a cluster that shouldn't have been present, cluster id : " + cluster);
+ } else {
+ foundNeededCluster = true;
+ }
+ }
+ assertTrue("Didn't find cluster 3 in the list. It should have been present", foundNeededCluster);
+
+ Set<Long> hostsInAvoidList = avoids.getHostsToAvoid();
+ assertFalse("Host 7 shouldn't have be in the avoid list, but it is present", hostsInAvoidList.contains(7L));
+ Set<Long> hostsThatShouldBeInAvoidList = new HashSet<Long>();
+ hostsThatShouldBeInAvoidList.add(5L);
+ hostsThatShouldBeInAvoidList.add(6L);
+ assertTrue("Hosts 5 and 6 that should have been present were not found in avoid list" ,
+ hostsInAvoidList.containsAll(hostsThatShouldBeInAvoidList));
+ }
+
+ @Test
+ public void checkPreferredModeNoHostsAvailable() throws InsufficientServerCapacityException {
+ @SuppressWarnings("unchecked")
+ VirtualMachineProfileImpl<VMInstanceVO> vmProfile = mock(VirtualMachineProfileImpl.class);
+ DataCenterDeployment plan = mock(DataCenterDeployment.class);
+ ExcludeList avoids = new ExcludeList();
+
+ initializeForTest(vmProfile, plan);
+
+ initializeForImplicitPlannerTest(false);
+
+ // Mark the host 5, 6 and 7 to be in avoid list.
+ avoids.addHost(5L);
+ avoids.addHost(6L);
+ avoids.addHost(7L);
+ List<Long> clusterList = planner.orderClusters(vmProfile, plan, avoids);
+
+ // Validations.
+ // Check cluster list is empty.
+ assertTrue("Cluster list should not be null/empty", (clusterList == null || clusterList.isEmpty()));
+ }
+
+ private void initializeForTest(VirtualMachineProfileImpl<VMInstanceVO> vmProfile, DataCenterDeployment plan) {
+ DataCenterVO mockDc = mock(DataCenterVO.class);
+ VMInstanceVO vm = mock(VMInstanceVO.class);
+ UserVmVO userVm = mock(UserVmVO.class);
+ ServiceOfferingVO offering = mock(ServiceOfferingVO.class);
+
+ AccountVO account = mock(AccountVO.class);
+ when(account.getId()).thenReturn(accountId);
+ when(account.getAccountId()).thenReturn(accountId);
+ when(vmProfile.getOwner()).thenReturn(account);
+ when(vmProfile.getVirtualMachine()).thenReturn(vm);
+ when(vmProfile.getId()).thenReturn(12L);
+ when(vmDao.findById(12L)).thenReturn(userVm);
+ when(userVm.getAccountId()).thenReturn(accountId);
+
+ when(vm.getDataCenterId()).thenReturn(dataCenterId);
+ when(dcDao.findById(1L)).thenReturn(mockDc);
+ when(plan.getDataCenterId()).thenReturn(dataCenterId);
+ when(plan.getClusterId()).thenReturn(null);
+ when(plan.getPodId()).thenReturn(null);
+ when(configDao.getValue(anyString())).thenReturn("false").thenReturn("CPU");
+
+ // Mock offering details.
+ when(vmProfile.getServiceOffering()).thenReturn(offering);
+ when(offering.getId()).thenReturn(offeringId);
+ when(vmProfile.getServiceOfferingId()).thenReturn(offeringId);
+ when(offering.getCpu()).thenReturn(noOfCpusInOffering);
+ when(offering.getSpeed()).thenReturn(cpuSpeedInOffering);
+ when(offering.getRamSize()).thenReturn(ramInOffering);
+
+ List<Long> clustersWithEnoughCapacity = new ArrayList<Long>();
+ clustersWithEnoughCapacity.add(1L);
+ clustersWithEnoughCapacity.add(2L);
+ clustersWithEnoughCapacity.add(3L);
+ when(capacityDao.listClustersInZoneOrPodByHostCapacities(dataCenterId, noOfCpusInOffering * cpuSpeedInOffering,
+ ramInOffering * 1024L * 1024L, CapacityVO.CAPACITY_TYPE_CPU, true)).thenReturn(clustersWithEnoughCapacity);
+
+ Map<Long, Double> clusterCapacityMap = new HashMap<Long, Double>();
+ clusterCapacityMap.put(1L, 2048D);
+ clusterCapacityMap.put(2L, 2048D);
+ clusterCapacityMap.put(3L, 2048D);
+ Pair<List<Long>, Map<Long, Double>> clustersOrderedByCapacity =
+ new Pair<List<Long>, Map<Long, Double>>(clustersWithEnoughCapacity, clusterCapacityMap);
+ when(capacityDao.orderClustersByAggregateCapacity(dataCenterId, CapacityVO.CAPACITY_TYPE_CPU,
+ true)).thenReturn(clustersOrderedByCapacity);
+
+ List<Long> disabledClusters = new ArrayList<Long>();
+ List<Long> clustersWithDisabledPods = new ArrayList<Long>();
+ when(clusterDao.listDisabledClusters(dataCenterId, null)).thenReturn(disabledClusters);
+ when(clusterDao.listClustersWithDisabledPods(dataCenterId)).thenReturn(clustersWithDisabledPods);
+ }
+
+ private void initializeForImplicitPlannerTest(boolean preferred) {
+ String plannerMode = new String("Strict");
+ if (preferred) {
+ plannerMode = new String("Preferred");
+ }
+
+ Map<String, String> details = new HashMap<String, String>();
+ details.put("ImplicitDedicationMode", plannerMode);
+ when(serviceOfferingDetailsDao.findDetails(offeringId)).thenReturn(details);
+
+ // Initialize hosts in clusters
+ HostVO host1 = mock(HostVO.class);
+ when(host1.getId()).thenReturn(5L);
+ HostVO host2 = mock(HostVO.class);
+ when(host2.getId()).thenReturn(6L);
+ HostVO host3 = mock(HostVO.class);
+ when(host3.getId()).thenReturn(7L);
+ List<HostVO> hostsInCluster1 = new ArrayList<HostVO>();
+ List<HostVO> hostsInCluster2 = new ArrayList<HostVO>();
+ List<HostVO> hostsInCluster3 = new ArrayList<HostVO>();
+ hostsInCluster1.add(host1);
+ hostsInCluster2.add(host2);
+ hostsInCluster3.add(host3);
+ when(resourceMgr.listAllHostsInCluster(1)).thenReturn(hostsInCluster1);
+ when(resourceMgr.listAllHostsInCluster(2)).thenReturn(hostsInCluster2);
+ when(resourceMgr.listAllHostsInCluster(3)).thenReturn(hostsInCluster3);
+
+ // Mock vms on each host.
+ long offeringIdForVmsOfThisAccount = 15L;
+ long offeringIdForVmsOfOtherAccount = 16L;
+ UserVmVO vm1 = mock(UserVmVO.class);
+ when(vm1.getAccountId()).thenReturn(accountId);
+ when(vm1.getServiceOfferingId()).thenReturn(offeringIdForVmsOfThisAccount);
+ UserVmVO vm2 = mock(UserVmVO.class);
+ when(vm2.getAccountId()).thenReturn(accountId);
+ when(vm2.getServiceOfferingId()).thenReturn(offeringIdForVmsOfThisAccount);
+ // Vm from different account
+ UserVmVO vm3 = mock(UserVmVO.class);
+ when(vm3.getAccountId()).thenReturn(201L);
+ when(vm3.getServiceOfferingId()).thenReturn(offeringIdForVmsOfOtherAccount);
+ List<UserVmVO> userVmsForHost1 = new ArrayList<UserVmVO>();
+ List<UserVmVO> userVmsForHost2 = new ArrayList<UserVmVO>();
+ List<UserVmVO> userVmsForHost3 = new ArrayList<UserVmVO>();
+ List<UserVmVO> stoppedVmsForHost = new ArrayList<UserVmVO>();
+ // Host 2 is empty.
+ userVmsForHost1.add(vm1);
+ userVmsForHost1.add(vm2);
+ userVmsForHost3.add(vm3);
+ when(vmDao.listUpByHostId(5L)).thenReturn(userVmsForHost1);
+ when(vmDao.listUpByHostId(6L)).thenReturn(userVmsForHost2);
+ when(vmDao.listUpByHostId(7L)).thenReturn(userVmsForHost3);
+ when(vmDao.listByLastHostId(5L)).thenReturn(stoppedVmsForHost);
+ when(vmDao.listByLastHostId(6L)).thenReturn(stoppedVmsForHost);
+ when(vmDao.listByLastHostId(7L)).thenReturn(stoppedVmsForHost);
+
+ // Mock the offering with which the vm was created.
+ ServiceOfferingVO offeringForVmOfThisAccount = mock(ServiceOfferingVO.class);
+ when(serviceOfferingDao.findByIdIncludingRemoved(offeringIdForVmsOfThisAccount)).thenReturn(offeringForVmOfThisAccount);
+ when(offeringForVmOfThisAccount.getDeploymentPlanner()).thenReturn(planner.getName());
+
+ ServiceOfferingVO offeringForVMOfOtherAccount = mock(ServiceOfferingVO.class);
+ when(serviceOfferingDao.findByIdIncludingRemoved(offeringIdForVmsOfOtherAccount)).thenReturn(offeringForVMOfOtherAccount);
+ when(offeringForVMOfOtherAccount.getDeploymentPlanner()).thenReturn("FirstFitPlanner");
+ }
+
+ @Configuration
+ @ComponentScan(basePackageClasses = { ImplicitDedicationPlanner.class },
+ includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)},
+ useDefaultFilters = false)
+ public static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
+
+ @Bean
+ public HostDao hostDao() {
+ return Mockito.mock(HostDao.class);
+ }
+
+ @Bean
+ public DataCenterDao dcDao() {
+ return Mockito.mock(DataCenterDao.class);
+ }
+
+ @Bean
+ public HostPodDao hostPodDao() {
+ return Mockito.mock(HostPodDao.class);
+ }
+
+ @Bean
+ public ClusterDao clusterDao() {
+ return Mockito.mock(ClusterDao.class);
+ }
+
+ @Bean
+ public GuestOSDao guestOsDao() {
+ return Mockito.mock(GuestOSDao.class);
+ }
+
+ @Bean
+ public GuestOSCategoryDao guestOsCategoryDao() {
+ return Mockito.mock(GuestOSCategoryDao.class);
+ }
+
+ @Bean
+ public DiskOfferingDao diskOfferingDao() {
+ return Mockito.mock(DiskOfferingDao.class);
+ }
+
+ @Bean
+ public StoragePoolHostDao storagePoolHostDao() {
+ return Mockito.mock(StoragePoolHostDao.class);
+ }
+
+ @Bean
+ public UserVmDao userVmDao() {
+ return Mockito.mock(UserVmDao.class);
+ }
+
+ @Bean
+ public VMInstanceDao vmInstanceDao() {
+ return Mockito.mock(VMInstanceDao.class);
+ }
+
+ @Bean
+ public VolumeDao volumeDao() {
+ return Mockito.mock(VolumeDao.class);
+ }
+
+ @Bean
+ public CapacityManager capacityManager() {
+ return Mockito.mock(CapacityManager.class);
+ }
+
+ @Bean
+ public ConfigurationDao configurationDao() {
+ return Mockito.mock(ConfigurationDao.class);
+ }
+
+ @Bean
+ public PrimaryDataStoreDao primaryDataStoreDao() {
+ return Mockito.mock(PrimaryDataStoreDao.class);
+ }
+
+ @Bean
+ public CapacityDao capacityDao() {
+ return Mockito.mock(CapacityDao.class);
+ }
+
+ @Bean
+ public AccountManager accountManager() {
+ return Mockito.mock(AccountManager.class);
+ }
+
+ @Bean
+ public StorageManager storageManager() {
+ return Mockito.mock(StorageManager.class);
+ }
+
+ @Bean
+ public DataStoreManager dataStoreManager() {
+ return Mockito.mock(DataStoreManager.class);
+ }
+
+ @Bean
+ public ClusterDetailsDao clusterDetailsDao() {
+ return Mockito.mock(ClusterDetailsDao.class);
+ }
+
+ @Bean
+ public ServiceOfferingDao serviceOfferingDao() {
+ return Mockito.mock(ServiceOfferingDao.class);
+ }
+
+ @Bean
+ public ServiceOfferingDetailsDao serviceOfferingDetailsDao() {
+ return Mockito.mock(ServiceOfferingDetailsDao.class);
+ }
+
+ @Bean
+ public ResourceManager resourceManager() {
+ return Mockito.mock(ResourceManager.class);
+ }
+
+ public static class Library implements TypeFilter {
+ @Override
+ public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
+ ComponentScan cs = TestConfiguration.class.getAnnotation(ComponentScan.class);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/plugins/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/pom.xml b/plugins/pom.xml
index e49fac9..2efa248 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -38,6 +38,7 @@
<module>affinity-group-processors/host-anti-affinity</module>
<module>deployment-planners/user-concentrated-pod</module>
<module>deployment-planners/user-dispersing</module>
+ <module>deployment-planners/implicit-dedication</module>
<module>host-allocators/random</module>
<module>hypervisors/ovm</module>
<module>hypervisors/xen</module>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/server/src/com/cloud/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java
index d0ae914..8db037b 100755
--- a/server/src/com/cloud/configuration/ConfigurationManager.java
+++ b/server/src/com/cloud/configuration/ConfigurationManager.java
@@ -80,10 +80,11 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @param id
* @param useVirtualNetwork
* @param deploymentPlanner
+ * @param details
* @return ID
*/
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
- boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner);
+ boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details);
/**
* Creates a new disk offering
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 9e0c847..52d6176 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -39,7 +39,6 @@ import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
-
import com.cloud.dc.*;
import com.cloud.dc.dao.*;
import com.cloud.user.*;
@@ -105,7 +104,6 @@ import com.cloud.dc.dao.DcDetailsDao;
import com.cloud.dc.dao.HostPodDao;
import com.cloud.dc.dao.PodVlanMapDao;
import com.cloud.dc.dao.VlanDao;
-
import com.cloud.deploy.DataCenterDeployment;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
@@ -165,6 +163,7 @@ import com.cloud.server.ConfigurationServer;
import com.cloud.server.ManagementService;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
+import com.cloud.service.dao.ServiceOfferingDetailsDao;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.SwiftVO;
import com.cloud.storage.dao.DiskOfferingDao;
@@ -277,6 +276,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
@Inject
ServiceOfferingDao _serviceOfferingDao;
@Inject
+ ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
+ @Inject
DiskOfferingDao _diskOfferingDao;
@Inject
NetworkOfferingDao _networkOfferingDao;
@@ -2050,19 +2051,26 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
}
- return createServiceOffering(userId, cmd.getIsSystem(), vmType, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
- localStorageRequired, offerHA, limitCpuUse, volatileVm, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag(), cmd.getNetworkRate(), cmd.getDeploymentPlanner());
+ return createServiceOffering(userId, cmd.getIsSystem(), vmType, cmd.getServiceOfferingName(),
+ cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
+ localStorageRequired, offerHA, limitCpuUse, volatileVm, cmd.getTags(), cmd.getDomainId(),
+ cmd.getHostTag(), cmd.getNetworkRate(), cmd.getDeploymentPlanner(), cmd.getDetails());
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
- public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type, String name, int cpu, int ramSize, int speed, String displayText,
- boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner) {
+ public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type,
+ String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
+ boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag,
+ Integer networkRate, String deploymentPlanner, Map<String, String> details) {
tags = cleanupTags(tags);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA, limitResourceUse, volatileVm, displayText, localStorageRequired, false, tags, isSystem, vm_type,
domainId, hostTag, deploymentPlanner);
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
+ if (details != null) {
+ _serviceOfferingDetailsDao.persist(offering.getId(), details);
+ }
UserContext.current().setEventDetails("Service offering id=" + offering.getId());
return offering;
} else {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index ba18fa1..4fb182a 100755
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -431,7 +431,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
*/
@Override
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA,
- boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner) {
+ boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details) {
// TODO Auto-generated method stub
return null;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index 7ffbe32..a825699 100644
--- a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -19,14 +19,8 @@ package org.apache.cloudstack.networkoffering;
import java.io.IOException;
-import com.cloud.dc.ClusterDetailsDao;
-import com.cloud.dc.dao.*;
-import com.cloud.server.ConfigurationServer;
-import com.cloud.user.*;
import org.apache.cloudstack.acl.SecurityChecker;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
@@ -44,6 +38,18 @@ import com.cloud.api.query.dao.UserAccountJoinDaoImpl;
import com.cloud.capacity.dao.CapacityDaoImpl;
import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl;
import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.dao.AccountVlanMapDaoImpl;
+import com.cloud.dc.dao.ClusterDaoImpl;
+import com.cloud.dc.dao.DataCenterDaoImpl;
+import com.cloud.dc.dao.DataCenterIpAddressDaoImpl;
+import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDao;
+import com.cloud.dc.dao.DataCenterVnetDaoImpl;
+import com.cloud.dc.dao.DcDetailsDaoImpl;
+import com.cloud.dc.dao.HostPodDaoImpl;
+import com.cloud.dc.dao.PodVlanDaoImpl;
+import com.cloud.dc.dao.PodVlanMapDaoImpl;
+import com.cloud.dc.dao.VlanDaoImpl;
import com.cloud.domain.dao.DomainDaoImpl;
import com.cloud.event.dao.UsageEventDaoImpl;
import com.cloud.host.dao.HostDaoImpl;
@@ -80,10 +86,11 @@ import com.cloud.network.vpc.dao.PrivateIpDaoImpl;
import com.cloud.network.vpn.RemoteAccessVpnService;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
-import com.cloud.offerings.dao.NetworkOfferingServiceMapDaoImpl;
import com.cloud.projects.ProjectManager;
+import com.cloud.server.ConfigurationServer;
import com.cloud.server.ManagementService;
import com.cloud.service.dao.ServiceOfferingDaoImpl;
+import com.cloud.service.dao.ServiceOfferingDetailsDaoImpl;
import com.cloud.storage.dao.DiskOfferingDaoImpl;
import com.cloud.storage.dao.S3DaoImpl;
import com.cloud.storage.dao.SnapshotDaoImpl;
@@ -94,6 +101,11 @@ import com.cloud.storage.s3.S3Manager;
import com.cloud.storage.secondary.SecondaryStorageVmManager;
import com.cloud.storage.swift.SwiftManager;
import com.cloud.tags.dao.ResourceTagsDaoImpl;
+import com.cloud.user.AccountDetailsDao;
+import com.cloud.user.AccountManager;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.UserContext;
+import com.cloud.user.UserContextInitializer;
import com.cloud.user.dao.AccountDaoImpl;
import com.cloud.user.dao.UserDaoImpl;
import com.cloud.vm.dao.InstanceGroupDaoImpl;
@@ -110,6 +122,7 @@ import com.cloud.vm.dao.VMInstanceDaoImpl;
DomainDaoImpl.class,
SwiftDaoImpl.class,
ServiceOfferingDaoImpl.class,
+ ServiceOfferingDetailsDaoImpl.class,
VlanDaoImpl.class,
IPAddressDaoImpl.class,
ResourceTagsDaoImpl.class,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 442a544..fe66207 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -393,7 +393,16 @@ CREATE TABLE `cloud`.`vm_snapshots` (
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor';
UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer');
-
+CREATE TABLE `cloud`.`service_offering_details` (
+ `id` bigint unsigned NOT NULL auto_increment,
+ `service_offering_id` bigint unsigned NOT NULL COMMENT 'service offering id',
+ `name` varchar(255) NOT NULL,
+ `value` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_service_offering_details__service_offering_id` FOREIGN KEY (`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE,
+ CONSTRAINT UNIQUE KEY `uk_service_offering_id_name` (`service_offering_id`, `name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
CREATE VIEW `cloud`.`user_vm_view` AS
select
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/test/integration/component/test_implicit_planner.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_implicit_planner.py b/test/integration/component/test_implicit_planner.py
new file mode 100644
index 0000000..ffcd248
--- /dev/null
+++ b/test/integration/component/test_implicit_planner.py
@@ -0,0 +1,232 @@
+# 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.
+""" P1 tests for Storage motion
+"""
+#Import Local Modules
+import marvin
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.remoteSSHClient import remoteSSHClient
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from nose.plugins.attrib import attr
+#Import System modules
+import time
+
+_multiprocess_shared_ = True
+class Services:
+ """Test VM Life Cycle Services
+ """
+
+ def __init__(self):
+ self.services = {
+ "disk_offering":{
+ "displaytext": "Small",
+ "name": "Small",
+ "disksize": 1
+ },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended in create account to
+ # ensure unique username generated each time
+ "password": "password",
+ },
+ "small":
+ # Create a small virtual machine instance with disk offering
+ {
+ "displayname": "testserver",
+ "username": "root", # VM creds for SSH
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'XenServer',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "service_offerings":
+ {
+ "implicitplanner":
+ {
+ # Small service offering ID to for change VM
+ # service offering from medium to small
+ "name": "Implicit Strict",
+ "displaytext": "Implicit Strict",
+ "cpunumber": 1,
+ "cpuspeed": 500,
+ "memory": 512,
+ "deploymentplanner": "ImplicitDedicationPlanner"
+ }
+ },
+ "template": {
+ "displaytext": "Cent OS Template",
+ "name": "Cent OS Template",
+ "passwordenabled": True,
+ },
+ "diskdevice": '/dev/xvdd',
+ # Disk device where ISO is attached to instance
+ "mount_dir": "/mnt/tmp",
+ "sleep": 60,
+ "timeout": 10,
+ #Migrate VM to hostid
+ "ostype": 'CentOS 5.3 (64-bit)',
+ # CentOS 5.3 (64-bit)
+ }
+
+class TestImplicitPlanner(cloudstackTestCase):
+
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestImplicitPlanner, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+
+ # Get Zone, Domain and templates
+ domain = get_domain(cls.api_client, cls.services)
+ cls.zone = get_zone(cls.api_client, cls.services)
+ cls.services['mode'] = cls.zone.networktype
+
+ template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+ # Set Zones and disk offerings
+ cls.services["small"]["zoneid"] = cls.zone.id
+ cls.services["small"]["template"] = template.id
+
+ # Create VMs, NAT Rules etc
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=domain.id
+ )
+
+ cls.small_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offerings"]["implicitplanner"]
+ )
+
+ cls._cleanup = [
+ cls.small_offering,
+ cls.account
+ ]
+
+ @classmethod
+ def tearDownClass(cls):
+ cls.api_client = super(TestImplicitPlanner, cls).getClsTestClient().getApiClient()
+ cleanup_resources(cls.api_client, cls._cleanup)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+
+ def tearDown(self):
+ #Clean up, terminate the created ISOs
+ cleanup_resources(self.apiclient, self.cleanup)
+ return
+
+ # This test requires multi host and at least one host which is empty (no vms should
+ # be running on that host). It uses an implicit planner to deploy instances and the
+ # instances of a new account should go to an host that doesn't have vms of any other
+ # account.
+ @attr(tags = ["advanced", "basic", "multihosts", "implicitplanner"])
+ def test_01_deploy_vm_with_implicit_planner(self):
+ """Test implicit planner is placing vms of an account on implicitly dedicated hosts.
+ """
+ # Validate the following
+ # 1. Deploy a vm using implicit planner. It should go on to a
+ # host that is empty (not running vms of any other account)
+ # 2. Deploy another vm it should get deployed on the same host.
+
+ #create a virtual machine
+ virtual_machine_1 = VirtualMachine.create(
+ self.api_client,
+ self.services["small"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.small_offering.id,
+ mode=self.services["mode"]
+ )
+
+ list_vm_response_1 = list_virtual_machines(
+ self.apiclient,
+ id=virtual_machine_1.id
+ )
+ self.assertEqual(
+ isinstance(list_vm_response_1, list),
+ True,
+ "Check list response returns a valid list"
+ )
+
+ self.assertNotEqual(
+ list_vm_response_1,
+ None,
+ "Check virtual machine is listVirtualMachines"
+ )
+
+ vm_response_1 = list_vm_response_1[0]
+
+ self.assertEqual(
+ vm_response_1.id,
+ virtual_machine_1.id,
+ "Check virtual machine ID of VM"
+ )
+
+ virtual_machine_2 = VirtualMachine.create(
+ self.api_client,
+ self.services["small"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.small_offering.id,
+ mode=self.services["mode"]
+ )
+
+ list_vm_response_2 = list_virtual_machines(
+ self.apiclient,
+ id=virtual_machine_2.id
+ )
+ self.assertEqual(
+ isinstance(list_vm_response_2, list),
+ True,
+ "Check list response returns a valid list"
+ )
+
+ self.assertNotEqual(
+ list_vm_response_2,
+ None,
+ "Check virtual machine is listVirtualMachines"
+ )
+
+ vm_response_2 = list_vm_response_2[0]
+
+ self.assertEqual(
+ vm_response_2.id,
+ virtual_machine_2.id,
+ "Check virtual machine ID of VM"
+ )
+
+ self.assertEqual(
+ vm_response_1.hostid,
+ vm_response_2.hostid,
+ "Check both vms have the same host id"
+ )
+ return
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/adbebc18/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index ecdc841..a811f14 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -1268,6 +1268,10 @@ class ServiceOffering:
if "tags" in services:
cmd.tags = services["tags"]
+
+ if "deploymentplanner" in services:
+ cmd.deploymentplanner = services["deploymentplanner"]
+
# Service Offering private to that domain
if domainid:
cmd.domainid = domainid
[14/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-751: 41-42 DB upgrade - insert new global config blacklisted.routes
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7cae8ca2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7cae8ca2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7cae8ca2
Branch: refs/heads/pvlan
Commit: 7cae8ca23102a834509f0277a378e17670992ac6
Parents: 31a6770
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Fri May 17 15:06:50 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Fri May 17 15:07:21 2013 -0700
----------------------------------------------------------------------
setup/db/db/schema-410to420.sql | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7cae8ca2/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index fe66207..c088ac1 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1667,6 +1667,10 @@ CREATE TABLE `cloud`.`nic_ip_alias` (
alter table `cloud`.`vpc_gateways` add column network_acl_id bigint unsigned default 1 NOT NULL;
update `cloud`.`vpc_gateways` set network_acl_id = 2;
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'VpcManager', 'blacklisted.routes', NULL, 'Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway');
+
+
-- Re-enable foreign key checking, at the end of the upgrade path
SET foreign_key_checks = 1;
[07/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Fixed CLOUDSTACK-2081 Volume which is added thru upload volume is failed to attach to the instance saying Volume state must be in Allocated, Ready or in Uploaded state( Though uploaded Volume state is uploaded)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/107f4924
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/107f4924
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/107f4924
Branch: refs/heads/pvlan
Commit: 107f4924757d6d59bff4256a56df3c8e81763818
Parents: 28c5fbc
Author: Rajesh Battala <ra...@citrix.com>
Authored: Thu May 9 18:02:41 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Fri May 17 14:58:25 2013 +0530
----------------------------------------------------------------------
.../org/apache/cloudstack/storage/volume/VolumeServiceImpl.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/107f4924/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 2625354..7fdf6bb 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -748,11 +748,11 @@ public class VolumeServiceImpl implements VolumeService {
protected Void registerVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, CreateCmdResult> callback, CreateVolumeContext<VolumeApiResult> context) {
CreateCmdResult result = callback.getResult();
VolumeObject vo = (VolumeObject)context.volume;
- /*if (result.isFailed()) {
+ if (result.isFailed()) {
vo.stateTransit(Volume.Event.OperationFailed);
} else {
vo.stateTransit(Volume.Event.OperationSucceeded);
- }*/
+ }
VolumeApiResult res = new VolumeApiResult(vo);
context.future.complete(res);
return null;
[19/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2554: Incorrect compute of minmemory and cpu
23e54bb0 introduced multiple hypervisors support for cpu and memory
overcommit. Here the HypervisorGuru base which determines the min, max
range for the memory for all hypervisors computes the minCpu using the
MemoryOverCommit ratio and minMemory using the CpuOverCommit ratio.
Minor typo/logic issue but massive damage across all HV if enabled ;)
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85d54cd1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85d54cd1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85d54cd1
Branch: refs/heads/pvlan
Commit: 85d54cd1c088997dd08f0328984bee1a55703636
Parents: 7ea2c95
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Sun May 19 16:12:31 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun May 19 18:34:27 2013 +0530
----------------------------------------------------------------------
.../hypervisor/xen/resource/CitrixResourceBase.java | 5 +----
.../cloud/hypervisor/xen/resource/XcpServerResource.java | 11 +++++++----
server/src/com/cloud/hypervisor/HypervisorGuruBase.java | 6 +++---
3 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 78bca32..19444cc 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -3520,10 +3520,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
* @throws XenAPIException
*/
protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
- vm.setMemoryStaticMin(conn, mem_128m);
- vm.setMemoryDynamicMin(conn, minMemsize);
- vm.setMemoryDynamicMax(conn, maxMemsize);
- vm.setMemoryStaticMax(conn, maxMemsize);
+ vm.setMemoryLimits(conn, mem_128m, maxMemsize, minMemsize, maxMemsize);
}
protected void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index 7df4c46..bf0a408 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -140,9 +140,12 @@ public class XcpServerResource extends CitrixResourceBase {
*/
@Override
protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
- vm.setMemoryStaticMin(conn, mem_32m);
- vm.setMemoryDynamicMin(conn, minMemsize);
- vm.setMemoryDynamicMax(conn, maxMemsize);
- vm.setMemoryStaticMax(conn, maxMemsize);
+ //setMemoryLimits(staticMin, staticMax, dynamicMin, dynamicMax)
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Memory Limits for VM [" + vm.getNameLabel(conn) +
+ "[staticMin:" + mem_32m + ", staticMax:" + maxMemsize
+ + ", dynamicMin: " + minMemsize + ", dynamicMax:" + maxMemsize+"]]");
+ }
+ vm.setMemoryLimits(conn, mem_32m, maxMemsize, minMemsize, maxMemsize);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85d54cd1/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index ca1644a..ea4fcc1 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -86,9 +86,9 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
ServiceOffering offering = vmProfile.getServiceOffering();
VirtualMachine vm = vmProfile.getVirtualMachine();
- Long minMemory = (long) (offering.getRamSize()/vmProfile.getCpuOvercommitRatio());
- int minspeed= (int)(offering.getSpeed()/vmProfile.getMemoryOvercommitRatio());
- int maxspeed = (offering.getSpeed());
+ Long minMemory = (long) (offering.getRamSize() / vmProfile.getMemoryOvercommitRatio());
+ int minspeed = (int) (offering.getSpeed() / vmProfile.getCpuOvercommitRatio());
+ int maxspeed = (offering.getSpeed());
VirtualMachineTO to = new VirtualMachineTO(vm.getId(), vm.getInstanceName(), vm.getType(), offering.getCpu(), minspeed, maxspeed,
minMemory * 1024l * 1024l, offering.getRamSize() * 1024l * 1024l, null, null, vm.isHaEnabled(), vm.limitCpuUse(), vm.getVncPassword());
to.setBootArgs(vmProfile.getBootArgs());
[13/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2070: Anti-Affinity - When Vm deployment fails because of not being able to satisfy the anti-affinity rule , user should be provided with more informative message.
Changes:
- There is no good mechanism currently to figure out if the deployment failed due to affinity groups only
- We can just hint the user that the deployment might have failed due to the affinity groups and ask to review the input
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/31a67706
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/31a67706
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/31a67706
Branch: refs/heads/pvlan
Commit: 31a67706e402fc73c592f871291223107ed0c21c
Parents: 55c1e28
Author: Prachi Damle <pr...@cloud.com>
Authored: Fri May 17 14:36:23 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Fri May 17 14:36:23 2013 -0700
----------------------------------------------------------------------
.../InsufficientServerCapacityException.java | 11 +++++++
.../api/command/user/vm/DeployVMCmd.java | 11 +++++--
.../api/command/user/vm/StartVMCmd.java | 14 +++++++--
.../cloud/entity/api/VMEntityManagerImpl.java | 18 ++++++++++-
.../com/cloud/vm/VirtualMachineManagerImpl.java | 32 ++++++++++++++------
5 files changed, 72 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31a67706/api/src/com/cloud/exception/InsufficientServerCapacityException.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/exception/InsufficientServerCapacityException.java b/api/src/com/cloud/exception/InsufficientServerCapacityException.java
index af34e57..8f889fe 100755
--- a/api/src/com/cloud/exception/InsufficientServerCapacityException.java
+++ b/api/src/com/cloud/exception/InsufficientServerCapacityException.java
@@ -27,6 +27,8 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
private static final long serialVersionUID = SerialVersionUID.InsufficientServerCapacityException;
+ private boolean affinityGroupsApplied = false;
+
public InsufficientServerCapacityException(String msg, Long clusterId) {
this(msg, Cluster.class, clusterId);
}
@@ -34,4 +36,13 @@ public class InsufficientServerCapacityException extends InsufficientCapacityExc
public InsufficientServerCapacityException(String msg, Class<?> scope, Long id) {
super(msg, scope, id);
}
+
+ public InsufficientServerCapacityException(String msg, Class<?> scope, Long id, boolean affinityGroupsApplied) {
+ super(msg, scope, id);
+ this.affinityGroupsApplied = affinityGroupsApplied;
+ }
+
+ public boolean isAffinityApplied() {
+ return affinityGroupsApplied;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31a67706/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index b5cf9f9..63198a4 100755
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -51,6 +51,7 @@ import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
@@ -424,9 +425,15 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if(((InsufficientServerCapacityException)ex).isAffinityApplied()){
+ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
+ }
+ }
s_logger.info(ex);
- s_logger.info(ex.getMessage(), ex);
- throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ s_logger.info(message.toString(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
}
} else {
result = _userVmService.getUserVm(getEntityId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31a67706/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
index 3012780..09b34d4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@ -30,10 +30,10 @@ import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.StorageUnavailableException;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
@@ -112,7 +112,7 @@ public class StartVMCmd extends BaseAsyncCmd {
}
@Override
- public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException {
+ public void execute() throws ResourceUnavailableException, ResourceAllocationException {
try {
UserContext.current().setEventDetails("Vm Id: " + getId());
@@ -135,6 +135,16 @@ public class StartVMCmd extends BaseAsyncCmd {
} catch (ExecutionException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (InsufficientCapacityException ex) {
+ StringBuilder message = new StringBuilder(ex.getMessage());
+ if (ex instanceof InsufficientServerCapacityException) {
+ if (((InsufficientServerCapacityException) ex).isAffinityApplied()) {
+ message.append(", Please check the affinity groups provided, there may not be sufficient capacity to follow them");
+ }
+ }
+ s_logger.info(ex);
+ s_logger.info(message.toString(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, message.toString());
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31a67706/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 25e7423..38ed7e6 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -24,6 +24,7 @@ import java.util.UUID;
import javax.inject.Inject;
+import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao;
@@ -60,6 +61,7 @@ import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserDao;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VirtualMachineProfileImpl;
@@ -111,6 +113,9 @@ public class VMEntityManagerImpl implements VMEntityManager {
@Inject
DeploymentPlanningManager _dpMgr;
+ @Inject
+ protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
+
@Override
public VMEntityVO loadVirtualMachine(String vmId) {
// TODO Auto-generated method stub
@@ -123,6 +128,16 @@ public class VMEntityManagerImpl implements VMEntityManager {
}
+ protected boolean areAffinityGroupsAssociated(VirtualMachineProfile<? extends VirtualMachine> vmProfile) {
+ VirtualMachine vm = vmProfile.getVirtualMachine();
+ long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
+
+ if (vmGroupCount > 0) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude)
throws InsufficientCapacityException, ResourceUnavailableException {
@@ -194,7 +209,8 @@ public class VMEntityManagerImpl implements VMEntityManager {
// call retry it.
return UUID.randomUUID().toString();
}else{
- throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
+ throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile,
+ DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/31a67706/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index d153bb2..cea0567 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -36,6 +36,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
@@ -253,6 +254,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
protected ResourceLimitService _resourceLimitMgr;
@Inject
protected RulesManager rulesMgr;
+ @Inject
+ protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
protected List<DeploymentPlanner> _planners;
public List<DeploymentPlanner> getPlanners() {
@@ -666,6 +669,16 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
}
+ protected boolean areAffinityGroupsAssociated(VirtualMachineProfile<? extends VirtualMachine> vmProfile) {
+ VirtualMachine vm = vmProfile.getVirtualMachine();
+ long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
+
+ if (vmGroupCount > 0) {
+ return true;
+ }
+ return false;
+ }
+
@Override
public <T extends VMInstanceVO> T advanceStart(T vm, Map<VirtualMachineProfile.Param, Object> params, User caller, Account account) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
@@ -797,7 +810,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
reuseVolume = false;
continue;
}
- throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
+ throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile,
+ DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
}
if (dest != null) {
@@ -1152,7 +1166,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
vmGuru.prepareStop(profile);
-
+
StopCommand stop = new StopCommand(vm);
boolean stopped = false;
StopAnswer answer = null;
@@ -2802,7 +2816,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
VirtualMachineGuru<VMInstanceVO> vmGuru = getVmGuru(vmVO);
s_logger.debug("Plugging nic for vm " + vm + " in network " + network);
-
+
boolean result = false;
try{
result = vmGuru.plugNic(network, nicTO, vmTO, context, dest);
@@ -2812,17 +2826,17 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
// insert nic's Id into DB as resource_name
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(),
vmVO.getDataCenterId(), vmVO.getId(), Long.toString(nic.getId()), nic.getNetworkId(),
- null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid());
+ null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid());
return nic;
} else {
s_logger.warn("Failed to plug nic to the vm " + vm + " in network " + network);
return null;
- }
+ }
}finally{
if(!result){
_networkMgr.removeNic(vmProfile, _nicsDao.findById(nic.getId()));
}
- }
+ }
} else if (vm.getState() == State.Stopped) {
//1) allocate nic
return _networkMgr.createNicForVm(network, requested, context, vmProfile, false);
@@ -2863,10 +2877,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.warn("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + ", nic is default.");
}
-
+
// if specified nic is associated with PF/LB/Static NAT
if(rulesMgr.listAssociatedRulesForGuestNic(nic).size() > 0){
- throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network
+ throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network
+ ", nic has associated Port forwarding or Load balancer or Static NAT rules.");
}
@@ -2884,7 +2898,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
s_logger.debug("Nic is unplugged successfully for vm " + vm + " in network " + network );
long isDefault = (nic.isDefaultNic()) ? 1 : 0;
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(),
- vm.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), null,
+ vm.getId(), Long.toString(nic.getId()), network.getNetworkOfferingId(), null,
isDefault, VirtualMachine.class.getName(), vm.getUuid());
} else {
s_logger.warn("Failed to unplug nic for the vm " + vm + " from network " + network);
[20/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2554: Ensuring that we honor hypervisor xen's memory constraints
When setting memory constraints on Xen guests we should honor:
static-min <= dynamic-min <= dynamic-max <= static-max
Our VmSpec while allows the guests to like between dynamic-min and
dynamic-max the memory set by the resource set the static min to be
equal to the dynamic max. This restricts the hypervisor from ensuring
optimized memory handling of guests.
see: http://wiki.xen.org/wiki/XCP_FAQ_Dynamic_Memory_Control#How_does_XCP_choose_targets_for_guests_in_dynamic_range_mode.3F
Another fix was related the restrict_dmc option. when enabled (true)
this option disallows scaling a vm. The logic was reverse handled
allowing scaling when restrict_dmc was on. This control flow is now
fixed.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7ea2c950
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7ea2c950
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7ea2c950
Branch: refs/heads/pvlan
Commit: 7ea2c950f5c1c2446ae94087d7f78812cc94a658
Parents: 6ea2b06
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Sun May 19 16:07:18 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun May 19 18:34:27 2013 +0530
----------------------------------------------------------------------
.../xen/resource/CitrixResourceBase.java | 25 ++++++-
.../xen/resource/XcpServerResource.java | 73 ++++++++++++++++----
.../xen/resource/XenServer56FP1Resource.java | 36 +++++-----
3 files changed, 98 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ea2c950/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index a166347..78bca32 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -335,6 +335,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
long _xs_memory_used = 128 * 1024 * 1024L; // xen hypervisor used 128 M
double _xs_virtualization_factor = 63.0/64.0; // 1 - virtualization overhead
+ //static min values for guests on xen
+ private static final long mem_128m = 134217728L;
+
protected boolean _canBridgeFirewall = false;
protected boolean _isOvs = false;
protected List<VIF> _tmpDom0Vif = new ArrayList<VIF>();
@@ -1208,8 +1211,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
+ if (!templates.iterator().hasNext()) {
+ throw new CloudRuntimeException("No matching OS type found for starting a [" + vmSpec.getOs()
+ + "] VM on host " + host.getHostname(conn));
+ }
VM template = templates.iterator().next();
-
VM vm = template.createClone(conn, vmSpec.getName());
VM.Record vmr = vm.getRecord(conn);
if (s_logger.isDebugEnabled()) {
@@ -3503,8 +3509,21 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
}
}
+ /**
+ * WARN: static-min <= dynamic-min <= dynamic-max <= static-max
+ * @see XcpServerResource#setMemory(com.xensource.xenapi.Connection, com.xensource.xenapi.VM, long, long)
+ * @param conn
+ * @param vm
+ * @param minMemsize
+ * @param maxMemsize
+ * @throws XmlRpcException
+ * @throws XenAPIException
+ */
protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
- vm.setMemoryLimits(conn, maxMemsize, maxMemsize, minMemsize, maxMemsize);
+ vm.setMemoryStaticMin(conn, mem_128m);
+ vm.setMemoryDynamicMin(conn, minMemsize);
+ vm.setMemoryDynamicMax(conn, maxMemsize);
+ vm.setMemoryStaticMax(conn, maxMemsize);
}
protected void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException {
@@ -4299,7 +4318,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
* @throws XenAPIException
* @throws XmlRpcException
*
- * @see enableVlanNetwork
+ * @see CitrixResourceBase#enableVlanNetwork
*/
protected XsLocalNetwork getNetworkByName(Connection conn, String name) throws XenAPIException, XmlRpcException {
Set<Network> networks = Network.getByNameLabel(conn, name);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ea2c950/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index 77dcb8f..7df4c46 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -37,6 +37,8 @@ import java.util.List;
@Local(value=ServerResource.class)
public class XcpServerResource extends CitrixResourceBase {
private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
+ private static final long mem_32m = 33554432L;
+
private String version;
public XcpServerResource() {
@@ -70,20 +72,6 @@ public class XcpServerResource extends CitrixResourceBase {
return CitrixHelper.getXcpGuestOsType(stdType);
}
- @Override
- protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
-
- vm.setMemoryStaticMin(conn, 33554432L);
- //vm.setMemoryDynamicMin(conn, 33554432L);
- //vm.setMemoryDynamicMax(conn, 33554432L);
- vm.setMemoryStaticMax(conn, 33554432L);
-
- //vm.setMemoryStaticMax(conn, maxMemsize );
- vm.setMemoryDynamicMax(conn, maxMemsize );
- vm.setMemoryDynamicMin(conn, minMemsize );
- //vm.setMemoryStaticMin(conn, maxMemsize );
- }
-
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
try {
Connection conn = getConnection();
@@ -100,4 +88,61 @@ public class XcpServerResource extends CitrixResourceBase {
return new NetworkUsageAnswer(cmd, ex);
}
}
+
+ /**
+ XCP provides four memory configuration fields through which
+ administrators can control this behaviour:
+
+ * static-min
+ * dynamic-min
+ * dynamic-max
+ * static-max
+
+ The fields static-{min,max} act as *hard* lower and upper
+ bounds for a guest's memory. For a running guest:
+ * it's not possible to assign the guest more memory than
+ static-max without first shutting down the guest.
+ * it's not possible to assign the guest less memory than
+ static-min without first shutting down the guest.
+
+ The fields dynamic-{min,max} act as *soft* lower and upper
+ bounds for a guest's memory. It's possible to change these
+ fields even when a guest is running.
+
+ The dynamic range must lie wholly within the static range. To
+ put it another way, XCP at all times ensures that:
+
+ static-min <= dynamic-min <= dynamic-max <= static-max
+
+ At all times, XCP will attempt to keep a guest's memory usage
+ between dynamic-min and dynamic-max.
+
+ If dynamic-min = dynamic-max, then XCP will attempt to keep
+ a guest's memory allocation at a constant size.
+
+ If dynamic-min < dynamic-max, then XCP will attempt to give
+ the guest as much memory as possible, while keeping the guest
+ within dynamic-min and dynamic-max.
+
+ If there is enough memory on a given host to give all resident
+ guests dynamic-max, then XCP will attempt do so.
+
+ If there is not enough memory to give all guests dynamic-max,
+ then XCP will ask each of the guests (on that host) to use
+ an amount of memory that is the same *proportional* distance
+ between dynamic-min and dynamic-max.
+
+ XCP will refuse to start guests if starting those guests would
+ cause the sum of all the dynamic-min values to exceed the total
+ host memory (taking into account various memory overheads).
+
+ cf: http://wiki.xen.org/wiki/XCP_FAQ_Dynamic_Memory_Control
+ */
+ @Override
+ protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
+ vm.setMemoryStaticMin(conn, mem_32m);
+ vm.setMemoryDynamicMin(conn, minMemsize);
+ vm.setMemoryDynamicMax(conn, maxMemsize);
+ vm.setMemoryStaticMax(conn, maxMemsize);
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7ea2c950/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 24cb75c..ad412c1 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -17,18 +17,6 @@
package com.cloud.hypervisor.xen.resource;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.ejb.Local;
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
import com.cloud.agent.api.FenceAnswer;
import com.cloud.agent.api.FenceCommand;
import com.cloud.agent.api.to.VirtualMachineTO;
@@ -39,13 +27,23 @@ import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Console;
import com.xensource.xenapi.Host;
import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.XenAPIException;
import com.xensource.xenapi.VBD;
import com.xensource.xenapi.VDI;
import com.xensource.xenapi.VM;
-import com.xensource.xenapi.Types.XenAPIException;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import javax.ejb.Local;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
@Local(value=ServerResource.class)
public class XenServer56FP1Resource extends XenServer56Resource {
@@ -137,17 +135,17 @@ public class XenServer56FP1Resource extends XenServer56Resource {
record.nameLabel = vmSpec.getName();
record.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
record.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
- record.memoryDynamicMax = vmSpec.getMaxRam();
record.memoryDynamicMin = vmSpec.getMinRam();
+ record.memoryDynamicMax = vmSpec.getMaxRam();
Map<String, String> hostParams = new HashMap<String, String>();
hostParams = host.getLicenseParams(conn);
if (hostParams.get("restrict_dmc").equalsIgnoreCase("false")) {
- record.memoryStaticMax = 8589934592L; //8GB
- record.memoryStaticMin = 134217728L; //128MB
+ record.memoryStaticMin = vmSpec.getMinRam();
+ record.memoryStaticMax = vmSpec.getMaxRam();
} else {
s_logger.warn("Host "+ _host.uuid + " does not support Dynamic Memory Control, so we cannot scale up the vm");
- record.memoryStaticMax = vmSpec.getMaxRam();
- record.memoryStaticMin = vmSpec.getMinRam();
+ record.memoryStaticMin = 134217728L; //128MB
+ record.memoryStaticMax = 8589934592L; //8GB
}
if (guestOsTypeName.toLowerCase().contains("windows")) {
[16/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Better parse domain XMLs so network devices can be detached as well
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/239bb13d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/239bb13d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/239bb13d
Branch: refs/heads/pvlan
Commit: 239bb13dde0d32ca3e05a8ea2b35a8885cb30538
Parents: 1851f7f
Author: Wido den Hollander <wi...@42on.com>
Authored: Sat May 18 10:10:45 2013 +0200
Committer: Wido den Hollander <wi...@42on.com>
Committed: Sat May 18 10:34:22 2013 +0200
----------------------------------------------------------------------
.../kvm/resource/LibvirtDomainXMLParser.java | 57 ++++++++++++--------
1 file changed, 36 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/239bb13d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index ac4baf1..b8645e1 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@ -35,6 +35,7 @@ import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.nicModel;
@@ -64,31 +65,45 @@ public class LibvirtDomainXMLParser {
NodeList disks = devices.getElementsByTagName("disk");
for (int i = 0; i < disks.getLength(); i++) {
Element disk = (Element) disks.item(i);
- String diskFmtType = getAttrValue("driver", "type", disk);
- String diskFile = getAttrValue("source", "file", disk);
- String diskDev = getAttrValue("source", "dev", disk);
-
- String diskLabel = getAttrValue("target", "dev", disk);
- String bus = getAttrValue("target", "bus", disk);
String type = disk.getAttribute("type");
- String device = disk.getAttribute("device");
-
DiskDef def = new DiskDef();
- if (type.equalsIgnoreCase("file")) {
- if (device.equalsIgnoreCase("disk")) {
- DiskDef.diskFmtType fmt = null;
- if (diskFmtType != null) {
- fmt = DiskDef.diskFmtType.valueOf(diskFmtType
- .toUpperCase());
+ if (type.equalsIgnoreCase("network")) {
+ String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskPath = getAttrValue("source", "name", disk);
+ String protocol = getAttrValue("source", "protocol", disk);
+ String authUserName = getAttrValue("auth", "username", disk);
+ String poolUuid = getAttrValue("secret", "uuid", disk);
+ String host = getAttrValue("host", "name", disk);
+ int port = Integer.parseInt(getAttrValue("host", "port", disk));
+ String diskLabel = getAttrValue("target", "dev", disk);
+ String bus = getAttrValue("target", "bus", disk);
+ def.defNetworkBasedDisk(diskPath, host, port, authUserName, poolUuid, diskLabel,
+ DiskDef.diskBus.valueOf(bus.toUpperCase()), DiskDef.diskProtocol.valueOf(protocol.toUpperCase()));
+ } else {
+ String diskFmtType = getAttrValue("driver", "type", disk);
+ String diskFile = getAttrValue("source", "file", disk);
+ String diskDev = getAttrValue("source", "dev", disk);
+
+ String diskLabel = getAttrValue("target", "dev", disk);
+ String bus = getAttrValue("target", "bus", disk);
+ String device = disk.getAttribute("device");
+
+ if (type.equalsIgnoreCase("file")) {
+ if (device.equalsIgnoreCase("disk")) {
+ DiskDef.diskFmtType fmt = null;
+ if (diskFmtType != null) {
+ fmt = DiskDef.diskFmtType.valueOf(diskFmtType
+ .toUpperCase());
+ }
+ def.defFileBasedDisk(diskFile, diskLabel,
+ DiskDef.diskBus.valueOf(bus.toUpperCase()), fmt);
+ } else if (device.equalsIgnoreCase("cdrom")) {
+ def.defISODisk(diskFile);
}
- def.defFileBasedDisk(diskFile, diskLabel,
- DiskDef.diskBus.valueOf(bus.toUpperCase()), fmt);
- } else if (device.equalsIgnoreCase("cdrom")) {
- def.defISODisk(diskFile);
+ } else if (type.equalsIgnoreCase("block")) {
+ def.defBlockBasedDisk(diskDev, diskLabel,
+ DiskDef.diskBus.valueOf(bus.toUpperCase()));
}
- } else if (type.equalsIgnoreCase("block")) {
- def.defBlockBasedDisk(diskDev, diskLabel,
- DiskDef.diskBus.valueOf(bus.toUpperCase()));
}
diskDefs.add(def);
}
[48/50] [abbrv] git commit: updated refs/heads/master to d893cb4
Posted by ya...@apache.org.
CLOUDSTACK-3643: Automation: Fix wrong network acl rule for ping
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/982c0b5d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/982c0b5d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/982c0b5d
Branch: refs/heads/master
Commit: 982c0b5dfb41b90ba5ee7f2c478f26384e89c316
Parents: 2df1d7f
Author: Sheng Yang <sh...@citrix.com>
Authored: Sun Jul 21 19:40:10 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Sun Jul 21 22:24:03 2013 -0700
----------------------------------------------------------------------
test/integration/component/test_vpc.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/982c0b5d/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index c503be8..3a661d5 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -143,11 +143,11 @@ class Services:
# Any network (For creating FW rule)
"protocol": "TCP"
},
- "http_rule": {
- "startport": 80,
- "endport": 80,
+ "icmp_rule": {
+ "icmptype": -1,
+ "icmpcode": -1,
"cidrlist": '0.0.0.0/0',
- "protocol": "TCP"
+ "protocol": "ICMP"
},
"virtual_machine": {
"displayname": "Test VM",
@@ -1066,13 +1066,13 @@ class TestVPC(cloudstackTestCase):
nwacl_internet_1 = NetworkACL.create(
self.apiclient,
networkid=network_1.id,
- services=self.services["http_rule"],
+ services=self.services["icmp_rule"],
traffictype='Egress'
)
nwacl_internet_2 = NetworkACL.create(
self.apiclient,
networkid=network_2.id,
- services=self.services["http_rule"],
+ services=self.services["icmp_rule"],
traffictype='Egress'
)
@@ -1411,13 +1411,13 @@ class TestVPC(cloudstackTestCase):
nwacl_internet_1 = NetworkACL.create(
self.apiclient,
networkid=network_1.id,
- services=self.services["http_rule"],
+ services=self.services["icmp_rule"],
traffictype='Egress'
)
nwacl_internet_2 = NetworkACL.create(
self.apiclient,
networkid=network_2.id,
- services=self.services["http_rule"],
+ services=self.services["icmp_rule"],
traffictype='Egress'
)
[32/50] [abbrv] CLOUDSTACK-652: meging 'portable public ip' feature
Posted by ya...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index ed9a8c4..1533ca9 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -39,6 +39,7 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.network.vpc.dao.VpcDao;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
@@ -184,32 +185,6 @@ import com.cloud.vm.dao.NicSecondaryIpDao;
import com.cloud.vm.dao.NicSecondaryIpVO;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
-import com.cloud.vm.*;
-import com.cloud.vm.dao.*;
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
-import org.apache.cloudstack.acl.SecurityChecker;
-import org.apache.cloudstack.acl.SecurityChecker.AccessType;
-import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
-import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
-import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
-import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.security.InvalidParameterException;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.*;
/**
@@ -315,6 +290,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
@Inject
AccountGuestVlanMapDao _accountGuestVlanMapDao;
@Inject
+ VpcDao _vpcDao;
+ @Inject
NetworkACLDao _networkACLDao;
int _cidrLimit;
@@ -527,22 +504,23 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
public IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId)
throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
+ Account caller = UserContext.current().getCaller();
+ long callerUserId = UserContext.current().getCallerUserId();
+ DataCenter zone = _configMgr.getZone(zoneId);
+
if (networkId != null) {
Network network = _networksDao.findById(networkId);
if (network == null) {
throw new InvalidParameterValueException("Invalid network id is given");
}
+
if (network.getGuestType() == Network.GuestType.Shared) {
- DataCenter zone = _configMgr.getZone(zoneId);
if (zone == null) {
throw new InvalidParameterValueException("Invalid zone Id is given");
}
-
// if shared network in the advanced zone, then check the caller against the network for 'AccessType.UseNetwork'
if (zone.getNetworkType() == NetworkType.Advanced) {
if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
- Account caller = UserContext.current().getCaller();
- long callerUserId = UserContext.current().getCallerUserId();
_accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
@@ -554,20 +532,67 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
}
+ } else {
+ _accountMgr.checkAccess(caller, null, false, ipOwner);
}
- return allocateIP(ipOwner, false, zoneId);
+ return _networkMgr.allocateIp(ipOwner, false, caller, callerUserId, zone);
}
- public IpAddress allocateIP(Account ipOwner, boolean isSystem, long zoneId)
+ @Override
+ @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_ASSIGN, eventDescription = "allocating portable public Ip", create = true)
+ public IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId)
throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException {
Account caller = UserContext.current().getCaller();
- // check permissions
- _accountMgr.checkAccess(caller, null, false, ipOwner);
long callerUserId = UserContext.current().getCallerUserId();
DataCenter zone = _configMgr.getZone(zoneId);
- return _networkMgr.allocateIp(ipOwner, isSystem, caller, callerUserId, zone);
+ if ((networkId == null && vpcId == null) && (networkId != null && vpcId != null)) {
+ throw new InvalidParameterValueException("One of Network id or VPC is should be passed");
+ }
+
+ if (networkId != null) {
+ Network network = _networksDao.findById(networkId);
+ if (network == null) {
+ throw new InvalidParameterValueException("Invalid network id is given");
+ }
+
+ if (network.getGuestType() == Network.GuestType.Shared) {
+ if (zone == null) {
+ throw new InvalidParameterValueException("Invalid zone Id is given");
+ }
+ // if shared network in the advanced zone, then check the caller against the network for 'AccessType.UseNetwork'
+ if (zone.getNetworkType() == NetworkType.Advanced) {
+ if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+ _accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Associate IP address called by the user " + callerUserId + " account " + ipOwner.getId());
+ }
+ return _networkMgr.allocatePortableIp(ipOwner, caller, zoneId, networkId, null);
+ } else {
+ throw new InvalidParameterValueException("Associate IP address can only be called on the shared networks in the advanced zone" +
+ " with Firewall/Source Nat/Static Nat/Port Forwarding/Load balancing services enabled");
+ }
+ }
+ }
+ }
+
+ if (vpcId != null) {
+ Vpc vpc = _vpcDao.findById(vpcId);
+ if (vpc != null) {
+ throw new InvalidParameterValueException("Invalid vpc id is given");
+ }
+ }
+
+ _accountMgr.checkAccess(caller, null, false, ipOwner);
+
+ return _networkMgr.allocatePortableIp(ipOwner, caller, zoneId, null, null);
+ }
+
+ @Override
+ @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_RELEASE, eventDescription = "disassociating portable Ip", async = true)
+ public boolean releasePortableIpAddress(long ipAddressId) throws InsufficientAddressCapacityException {
+ return releaseIpAddressInternal(ipAddressId);
}
@Override
@@ -810,9 +835,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
@Override
- @DB
@ActionEvent(eventType = EventTypes.EVENT_NET_IP_RELEASE, eventDescription = "disassociating Ip", async = true)
public boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException {
+ return releaseIpAddressInternal(ipAddressId);
+ }
+
+ @DB
+ private boolean releaseIpAddressInternal(long ipAddressId) throws InsufficientAddressCapacityException {
Long userId = UserContext.current().getCallerUserId();
Account caller = UserContext.current().getCaller();
@@ -851,6 +880,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
boolean success = _networkMgr.disassociatePublicIpAddress(ipAddressId, userId, caller);
if (success) {
+ if (!ipVO.isPortable()) {
+ return success;
+ }
Long networkId = ipVO.getAssociatedWithNetworkId();
if (networkId != null) {
Network guestNetwork = getNetwork(networkId);
@@ -867,7 +899,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return success;
}
-
@Override
@DB
public Network getNetwork(long id) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/network/addr/PublicIp.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/addr/PublicIp.java b/server/src/com/cloud/network/addr/PublicIp.java
index c753b49..b18c691 100644
--- a/server/src/com/cloud/network/addr/PublicIp.java
+++ b/server/src/com/cloud/network/addr/PublicIp.java
@@ -220,6 +220,15 @@ public class PublicIp implements PublicIpAddress {
return _addr.getVmIp();
}
+ @Override
+ public boolean isPortable() {
+ return _addr.isPortable();
+ }
+
+ public void setPortable(boolean portable) {
+ _addr.setPortable(portable);
+ }
+
public Long getIpMacAddress() {
return _addr.getMacAddress();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java
index c9b47b4..8834553 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -491,6 +491,49 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
return false;
}
performedIpAssoc = true;
+ } else if (ipAddress.isPortable()) {
+ s_logger.info("Portable IP " + ipAddress.getUuid() + " is not associated with the network, so" +
+ "associate IP with the network " + networkId);
+ try {
+ // check if StaticNat service is enabled in the network
+ _networkModel.checkIpForService(ipAddress, Service.StaticNat, networkId);
+
+ // associate portable IP to vpc, if network is part of VPC
+ if (network.getVpcId() != null) {
+ _vpcMgr.associateIPToVpc(ipId, network.getVpcId());
+ }
+
+ // associate portable IP with guest network
+ _networkMgr.associatePortableIPToGuestNetwork(ipId, networkId, false);
+ } catch (Exception e) {
+ s_logger.warn("Failed to associate portable id=" + ipId + " to network id=" + networkId + " as " +
+ "a part of enable static nat");
+ return false;
+ }
+ performedIpAssoc = true;
+ }
+ } else if (ipAddress.getAssociatedWithNetworkId() != networkId) {
+ if (ipAddress.isPortable()) {
+ // check if destination network has StaticNat service enabled
+ _networkModel.checkIpForService(ipAddress, Service.StaticNat, networkId);
+
+ // check if portable IP can be transferred across the networks
+ if (_networkMgr.isPortableIpTransferableFromNetwork(ipId, ipAddress.getAssociatedWithNetworkId() )) {
+ try {
+ _networkMgr.transferPortableIP(ipId, ipAddress.getAssociatedWithNetworkId(), networkId);
+ } catch (Exception e) {
+ s_logger.warn("Failed to associate portable id=" + ipId + " to network id=" + networkId + " as " +
+ "a part of enable static nat");
+ return false;
+ }
+ } else {
+ throw new InvalidParameterValueException("Portable IP: " + ipId + " has associated services" +
+ "in network " + ipAddress.getAssociatedWithNetworkId() + " so can not be transferred to " +
+ " network " + networkId);
+ }
+ } else {
+ throw new InvalidParameterValueException("Invalid network Id=" + networkId + ". IP is associated with"
+ + " a different network than passed network id");
}
} else {
_networkModel.checkIpForService(ipAddress, Service.StaticNat, null);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/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 8b3eea4..8323af8 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -47,6 +47,14 @@ import com.cloud.exception.*;
import com.cloud.vm.*;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.ApiConstants;
+
+import com.cloud.event.ActionEventUtils;
+import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
+import org.apache.cloudstack.api.command.admin.region.*;
+import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.api.ApiConstants;
@@ -124,9 +132,6 @@ import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
-import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
-import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
-import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
@@ -571,8 +576,78 @@ import com.cloud.vm.dao.VMInstanceDao;
import edu.emory.mathcs.backport.java.util.Arrays;
import edu.emory.mathcs.backport.java.util.Collections;
-import org.apache.cloudstack.api.command.admin.config.ListDeploymentPlannersCmd;
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
+import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
+import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
+import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
+import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
+import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
+import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
+import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
+import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
+import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
+import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
+import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
+import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
+import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
+import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
+import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
+import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
+import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
+import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
+import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
+import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
+import org.apache.cloudstack.api.command.admin.vm.MigrateVirtualMachineWithVolumeCmd;
+import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
+import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
+import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
+import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
+import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
+import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
+import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
+import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
+import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
+import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
+import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
+import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
+import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
+import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
+import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
+import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
+import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
+import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
+import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
+import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
+import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
+import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
+import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
+import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
+import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
+import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
+import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
+import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
+import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
+import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
+import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
+import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
+import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
+import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
+import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
+import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.api.command.admin.config.ListDeploymentPlannersCmd;
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
@@ -2897,6 +2972,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
cmdList.add(ListAffinityGroupsCmd.class);
cmdList.add(UpdateVMAffinityGroupCmd.class);
cmdList.add(ListAffinityGroupTypesCmd.class);
+ cmdList.add(CreatePortableIpRangeCmd.class);
+ cmdList.add(DeletePortableIpRangeCmd.class);
+ cmdList.add(ListPortableIpRangesCmd.class);
cmdList.add(ListDeploymentPlannersCmd.class);
cmdList.add(ReleaseHostReservationCmd.class);
cmdList.add(ScaleSystemVMCmd.class);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpDao.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpDao.java b/server/src/org/apache/cloudstack/region/PortableIpDao.java
new file mode 100755
index 0000000..9f5341f
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpDao.java
@@ -0,0 +1,39 @@
+// 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.region;
+
+import java.util.List;
+
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PortableIpDao extends GenericDao<PortableIpVO, Long> {
+
+ List<PortableIpVO> listByRegionId(int regionId);
+
+ List<PortableIpVO> listByRangeId(long rangeId);
+
+ List<PortableIpVO> listByRangeIdAndState(long rangeId, PortableIp.State state);
+
+ List<PortableIpVO> listByRegionIdAndState(int regionId, PortableIp.State state);
+
+ PortableIpVO findByIpAddress(String ipAddress);
+
+ void unassignIpAddress(long ipAddressId);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpDaoImpl.java b/server/src/org/apache/cloudstack/region/PortableIpDaoImpl.java
new file mode 100755
index 0000000..488761b
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpDaoImpl.java
@@ -0,0 +1,131 @@
+// 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.region;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.dc.PodVlanMapVO;
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={PortableIpDao.class})
+public class PortableIpDaoImpl extends GenericDaoBase<PortableIpVO, Long> implements PortableIpDao {
+
+ private final SearchBuilder<PortableIpVO> listByRegionIDSearch;
+ private final SearchBuilder<PortableIpVO> listByRangeIDSearch;
+ private final SearchBuilder<PortableIpVO> listByRangeIDAndStateSearch;
+ private final SearchBuilder<PortableIpVO> listByRegionIDAndStateSearch;
+ private final SearchBuilder<PortableIpVO> findByIpAddressSearch;
+
+ public PortableIpDaoImpl() {
+ listByRegionIDSearch = createSearchBuilder();
+ listByRegionIDSearch.and("regionId", listByRegionIDSearch.entity().getRegionId(), SearchCriteria.Op.EQ);
+ listByRegionIDSearch.done();
+
+ listByRangeIDSearch = createSearchBuilder();
+ listByRangeIDSearch.and("rangeId", listByRangeIDSearch.entity().getRangeId(), SearchCriteria.Op.EQ);
+ listByRangeIDSearch.done();
+
+ listByRangeIDAndStateSearch = createSearchBuilder();
+ listByRangeIDAndStateSearch.and("rangeId", listByRangeIDAndStateSearch.entity().getRangeId(), SearchCriteria.Op.EQ);
+ listByRangeIDAndStateSearch.and("state", listByRangeIDAndStateSearch.entity().getState(), SearchCriteria.Op.EQ);
+ listByRangeIDAndStateSearch.done();
+
+ listByRegionIDAndStateSearch = createSearchBuilder();
+ listByRegionIDAndStateSearch.and("regionId", listByRegionIDAndStateSearch.entity().getRangeId(), SearchCriteria.Op.EQ);
+ listByRegionIDAndStateSearch.and("state", listByRegionIDAndStateSearch.entity().getState(), SearchCriteria.Op.EQ);
+ listByRegionIDAndStateSearch.done();
+
+ findByIpAddressSearch = createSearchBuilder();
+ findByIpAddressSearch.and("address", findByIpAddressSearch.entity().getAddress(), SearchCriteria.Op.EQ);
+ findByIpAddressSearch.done();
+ }
+
+ @Override
+ public List<PortableIpVO> listByRegionId(int regionIdId) {
+ SearchCriteria<PortableIpVO> sc = listByRegionIDSearch.create();
+ sc.setParameters("regionId", regionIdId);
+ return listBy(sc);
+ }
+
+ @Override
+ public List<PortableIpVO> listByRangeId(long rangeId) {
+ SearchCriteria<PortableIpVO> sc = listByRangeIDSearch.create();
+ sc.setParameters("rangeId", rangeId);
+ return listBy(sc);
+ }
+
+ @Override
+ public List<PortableIpVO> listByRangeIdAndState(long rangeId, PortableIp.State state) {
+ SearchCriteria<PortableIpVO> sc = listByRangeIDAndStateSearch.create();
+ sc.setParameters("rangeId", rangeId);
+ sc.setParameters("state", state);
+ return listBy(sc);
+ }
+
+ @Override
+ public List<PortableIpVO> listByRegionIdAndState(int regionId, PortableIp.State state) {
+ SearchCriteria<PortableIpVO> sc = listByRegionIDAndStateSearch.create();
+ sc.setParameters("regionId", regionId);
+ sc.setParameters("state", state);
+ return listBy(sc);
+ }
+
+ @Override
+ public PortableIpVO findByIpAddress(String ipAddress) {
+ SearchCriteria<PortableIpVO> sc = findByIpAddressSearch.create();
+ sc.setParameters("address", ipAddress);
+ return findOneBy(sc);
+ }
+
+ @Override
+ public void unassignIpAddress(long ipAddressId) {
+ PortableIpVO address = createForUpdate();
+ address.setAllocatedToAccountId(null);
+ address.setAllocatedInDomainId(null);
+ address.setAllocatedTime(null);
+ address.setState(PortableIp.State.Free);
+ address.setAssociatedWithNetworkId(null);
+ address.setAssociatedDataCenterId(null);
+ address.setAssociatedWithVpcId(null);
+ address.setPhysicalNetworkId(null);
+ update(ipAddressId, address);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpRangeDao.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpRangeDao.java b/server/src/org/apache/cloudstack/region/PortableIpRangeDao.java
new file mode 100755
index 0000000..85da6c0
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpRangeDao.java
@@ -0,0 +1,30 @@
+// 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.region;
+
+import java.util.List;
+
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface PortableIpRangeDao extends GenericDao<PortableIpRangeVO, Long> {
+
+ List<PortableIpRangeVO> listByRegionId(int regionId);
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpRangeDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpRangeDaoImpl.java b/server/src/org/apache/cloudstack/region/PortableIpRangeDaoImpl.java
new file mode 100755
index 0000000..496c9e6
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpRangeDaoImpl.java
@@ -0,0 +1,65 @@
+// 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.region;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.dc.AccountVlanMapVO;
+import com.cloud.dc.PodVlanMapVO;
+import com.cloud.dc.Vlan;
+import com.cloud.dc.Vlan.VlanType;
+import com.cloud.dc.VlanVO;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.utils.Pair;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@Component
+@Local(value={PortableIpRangeDao.class})
+public class PortableIpRangeDaoImpl extends GenericDaoBase<PortableIpRangeVO, Long> implements PortableIpRangeDao {
+
+ private final SearchBuilder<PortableIpRangeVO> listByRegionIDSearch;
+
+ public PortableIpRangeDaoImpl() {
+ listByRegionIDSearch = createSearchBuilder();
+ listByRegionIDSearch.and("regionId", listByRegionIDSearch.entity().getRegionId(), SearchCriteria.Op.EQ);
+ listByRegionIDSearch.done();
+ }
+
+ @Override
+ public List<PortableIpRangeVO> listByRegionId(int regionIdId) {
+ SearchCriteria<PortableIpRangeVO> sc = listByRegionIDSearch.create();
+ sc.setParameters("regionId", regionIdId);
+ return listBy(sc);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpRangeVO.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpRangeVO.java b/server/src/org/apache/cloudstack/region/PortableIpRangeVO.java
new file mode 100644
index 0000000..933fcc3
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpRangeVO.java
@@ -0,0 +1,119 @@
+// 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.region;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="portable_ip_range")
+public class PortableIpRangeVO implements PortableIpRange {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ Long id;
+
+ @Column(name="uuid")
+ String uuid;
+
+ @Column(name="region_id")
+ int regionId;
+
+ @Column(name="vlan_id")
+ String vlan;
+
+ @Column(name="gateway")
+ String gateway;
+
+ @Column(name="netmask")
+ String netmask;
+
+ @Column(name="start_ip")
+ String startIp;
+
+ @Column(name="end_ip")
+ String endIp;
+
+ public PortableIpRangeVO() {
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public PortableIpRangeVO(int regionId, String vlan, String gateway, String netmask, String startIp, String endIp) {
+ this.uuid = UUID.randomUUID().toString();
+ this.regionId =regionId;
+ this.vlan = vlan;
+ this.gateway = gateway;
+ this.netmask = netmask;
+ this.startIp = startIp;
+ this.endIp = endIp;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ @Override
+ public String getVlanTag() {
+ return vlan;
+ }
+
+ public void setVlanTag(String vlan) {
+ this.vlan = vlan;
+ }
+
+ @Override
+ public String getGateway() {
+ return gateway;
+ }
+
+ @Override
+ public String getNetmask() {
+ return netmask;
+ }
+
+ @Override
+ public int getRegionId() {
+ return regionId;
+ }
+
+ @Override
+ public String getIpRange() {
+ return startIp + "-" + endIp;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/org/apache/cloudstack/region/PortableIpVO.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/region/PortableIpVO.java b/server/src/org/apache/cloudstack/region/PortableIpVO.java
new file mode 100644
index 0000000..9a63009
--- /dev/null
+++ b/server/src/org/apache/cloudstack/region/PortableIpVO.java
@@ -0,0 +1,222 @@
+// 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.region;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.*;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name="portable_ip_address")
+public class PortableIpVO implements PortableIp {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ Long id;
+
+ @Column(name="region_id")
+ int regionId;
+
+ @Column(name="allocated")
+ @Temporal(value=TemporalType.TIMESTAMP)
+ private Date allocatedTime;
+
+ @Column(name="account_id")
+ private Long allocatedToAccountId = null;
+
+ @Column(name="domain_id")
+ private Long allocatedInDomainId = null;
+
+ @Column(name="state")
+ private State state;
+
+ @Column(name="vlan")
+ String vlan;
+
+ @Column(name="gateway")
+ String gateway;
+
+ @Column(name="netmask")
+ String netmask;
+
+ @Column(name="portable_ip_address")
+ String address;
+
+ @Column(name="portable_ip_range_id")
+ private long rangeId;
+
+ @Column(name="physical_network_id")
+ private Long physicalNetworkId;
+
+ @Column(name="data_center_id")
+ private Long dataCenterId;
+
+ @Column(name="network_id")
+ private Long networkId;
+
+ @Column(name="vpc_id")
+ private Long vpcId;
+
+ public PortableIpVO() {
+
+ }
+
+ public PortableIpVO(int regionId, Long rangeId, String vlan, String gateway, String netmask, String address) {
+ this.regionId =regionId;
+ this.vlan = vlan;
+ this.gateway = gateway;
+ this.netmask = netmask;
+ this.address = address;
+ state = State.Free;
+ this.rangeId = rangeId;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public Long getAllocatedToAccountId() {
+ return allocatedToAccountId;
+ }
+
+ public void setAllocatedToAccountId(Long accountId) {
+ this.allocatedToAccountId = accountId;
+ }
+
+ @Override
+ public Long getAllocatedInDomainId() {
+ return allocatedInDomainId;
+ }
+
+ public void setAllocatedInDomainId(Long domainId) {
+ this.allocatedInDomainId = domainId;
+ }
+
+ @Override
+ public Date getAllocatedTime() {
+ return allocatedTime;
+ }
+
+ public void setAllocatedTime(Date date) {
+ this.allocatedTime = date;
+ }
+
+ @Override
+ public State getState() {
+ return state;
+ }
+
+ public void setState(State state) {
+ this.state = state;
+ }
+
+ @Override
+ public int getRegionId() {
+ return regionId;
+ }
+
+ public void setRegionId(int regionId) {
+ this.regionId = regionId;
+ }
+
+ @Override
+ public Long getAssociatedDataCenterId() {
+ return dataCenterId;
+ }
+
+ public void setAssociatedDataCenterId(Long datacenterId) {
+ this.dataCenterId = datacenterId;
+ }
+
+ @Override
+ public Long getAssociatedWithNetworkId() {
+ return networkId;
+ }
+
+ public void setAssociatedWithNetworkId(Long networkId) {
+ this.networkId = networkId;
+ }
+
+ @Override
+ public Long getAssociatedWithVpcId() {
+ return vpcId;
+ }
+
+ public void setAssociatedWithVpcId(Long vpcId) {
+ this.vpcId = vpcId;
+ }
+
+ @Override
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
+ public void setPhysicalNetworkId(Long physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
+ }
+
+ @Override
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ @Override
+ public String getVlan() {
+ return vlan;
+ }
+
+ public void setVlan(String vlan) {
+ this.vlan = vlan;
+ }
+
+ @Override
+ public String getNetmask() {
+ return netmask;
+ }
+
+ public void setNetmask(String netmask) {
+ this.netmask = netmask;
+ }
+
+ @Override
+ public String getGateway() {
+ return gateway;
+ }
+
+ public void setGateay(String gateway) {
+ this.gateway = gateway;
+ }
+
+ Long getRangeId() {
+ return rangeId;
+ }
+
+ public void setRangeId(Long rangeId) {
+ this.rangeId = rangeId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java
index 87431ab..1ac014d 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -75,7 +75,6 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.*;
import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineProfile;
-import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.api.command.admin.network.DedicateGuestVlanRangeCmd;
import org.apache.cloudstack.api.command.admin.network.ListDedicatedGuestVlanRangesCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
@@ -89,7 +88,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-
@Component
@Local(value = { NetworkManager.class, NetworkService.class })
public class MockNetworkManagerImpl extends ManagerBase implements NetworkManager, NetworkService {
@@ -107,6 +105,27 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
}
@Override
+ public IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException {
+ return null;// TODO Auto-generated method stub
+ }
+
+ @Override
+ public IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException {
+ return null; // TODO Auto-generated method stub
+ }
+
+ @Override
+ public boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId) {
+ return false;
+ }
+
+ @Override
+ public void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+
+ }
+
+ @Override
public boolean releaseIpAddress(long ipAddressId) {
// TODO Auto-generated method stub
return false;
@@ -862,6 +881,23 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
}
@Override
+ public IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
+ throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException {
+ return null;// TODO Auto-generated method stub
+ }
+
+ @Override
+ public IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+ return null;
+ }
+
+ @Override
+ public boolean releasePortableIpAddress(long ipAddressId) throws InsufficientAddressCapacityException {
+ return false;// TODO Auto-generated method stub
+ }
+
+ @Override
public boolean isSecondaryIpSetForNic(long nicId) {
// TODO Auto-generated method stub
return false;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index 4fb182a..21b3590 100755
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@ -16,6 +16,44 @@
// under the License.
package com.cloud.vpc;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import javax.naming.NamingException;
+
+import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
+import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
+import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
+import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
+import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
+import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+import org.apache.cloudstack.api.command.admin.region.CreatePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.DeletePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.ListPortableIpRangesCmd;
+import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
+import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
+import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
+import org.springframework.stereotype.Component;
+
import com.cloud.configuration.Configuration;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.ConfigurationService;
@@ -381,6 +419,26 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
return false;
}
+ @Override
+ public PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException {
+ return null;// TODO Auto-generated method stub
+ }
+
+ @Override
+ public boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd) {
+ return false;// TODO Auto-generated method stub
+ }
+
+ @Override
+ public List<? extends PortableIpRange> listPortableIpRanges(ListPortableIpRangesCmd cmd) {
+ return null;// TODO Auto-generated method stub
+ }
+
+ @Override
+ public List<? extends PortableIp> listPortableIps(long id) {
+ return null;// TODO Auto-generated method stub
+ }
+
/* (non-Javadoc)
* @see com.cloud.utils.component.Manager#configure(java.lang.String, java.util.Map)
*/
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 3e6a08b..62599b8 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -63,7 +63,6 @@ import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.PublicIpAddress;
import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.AccountGuestVlanMapVO;
import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.dao.NetworkVO;
@@ -198,13 +197,36 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
return null;
}
+ @Override
+ public IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
+ throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException {
+ return null;// TODO Auto-generated method stub
+ }
+ @Override
+ public IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+ return null;
+ }
+ @Override
+ public boolean releasePortableIpAddress(long ipAddressId) throws InsufficientAddressCapacityException {
+ return false;// TODO Auto-generated method stub
+ }
+ @Override
+ public boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId) {
+ return false;
+ }
+
+ @Override
+ public void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+ }
/* (non-Javadoc)
- * @see com.cloud.network.NetworkService#releaseIpAddress(long)
- */
+ * @see com.cloud.network.NetworkService#releaseIpAddress(long)
+ */
@Override
public boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException {
// TODO Auto-generated method stub
@@ -1112,13 +1134,20 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
return null;
}
+ @Override
+ public IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException {
+ return null;// TODO Auto-generated method stub
+ }
-
+ @Override
+ public IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException, InsufficientAddressCapacityException, ConcurrentOperationException {
+ return null;// TODO Auto-generated method stub
+ }
/* (non-Javadoc)
- * @see com.cloud.network.NetworkManager#setupDns(com.cloud.network.Network, com.cloud.network.Network.Provider)
- */
+ * @see com.cloud.network.NetworkManager#setupDns(com.cloud.network.Network, com.cloud.network.Network.Provider)
+ */
@Override
public boolean setupDns(Network network, Provider provider) {
// TODO Auto-generated method stub
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index a825699..f862a2a 100644
--- a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -20,6 +20,9 @@ package org.apache.cloudstack.networkoffering;
import java.io.IOException;
import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.region.PortableIpDaoImpl;
+import org.apache.cloudstack.region.dao.RegionDaoImpl;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
@@ -113,6 +116,7 @@ import com.cloud.vm.dao.NicDaoImpl;
import com.cloud.vm.dao.NicSecondaryIpDaoImpl;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDaoImpl;
+import org.apache.cloudstack.region.PortableIpRangeDaoImpl;
@Configuration
@ComponentScan(basePackageClasses={
@@ -162,6 +166,9 @@ import com.cloud.vm.dao.VMInstanceDaoImpl;
NetworkServiceMapDaoImpl.class,
PrimaryDataStoreDaoImpl.class,
StoragePoolDetailsDaoImpl.class,
+ PortableIpRangeDaoImpl.class,
+ RegionDaoImpl.class,
+ PortableIpDaoImpl.class,
AccountGuestVlanMapDaoImpl.class
},
includeFilters={@Filter(value=ChildTestConfiguration.Library.class, type=FilterType.CUSTOM)},
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index c088ac1..7b5e9cb 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1267,6 +1267,43 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'Netwo
alter table `cloud_usage`.`usage_network_offering` add column nic_id bigint(20) unsigned NOT NULL;
+
+CREATE TABLE `cloud`.`portable_ip_range` (
+ `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
+ `uuid` varchar(40),
+ `region_id` int unsigned NOT NULL,
+ `vlan_id` varchar(255),
+ `gateway` varchar(255),
+ `netmask` varchar(255),
+ `start_ip` varchar(255),
+ `end_ip` varchar(255),
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_portableip__region_id` FOREIGN KEY (`region_id`) REFERENCES `region`(`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`portable_ip_address` (
+ `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
+ `account_id` bigint unsigned NULL,
+ `domain_id` bigint unsigned NULL,
+ `allocated` datetime NULL COMMENT 'Date portable ip was allocated',
+ `state` char(32) NOT NULL default 'Free' COMMENT 'state of the portable ip address',
+ `region_id` int unsigned NOT NULL,
+ `vlan` varchar(255),
+ `gateway` varchar(255),
+ `netmask` varchar(255),
+ `portable_ip_address` varchar(255),
+ `portable_ip_range_id` bigint unsigned NOT NULL,
+ `data_center_id` bigint unsigned NULL COMMENT 'zone to which portable IP is associated',
+ `physical_network_id` bigint unsigned NULL COMMENT 'physical network id in the zone to which portable IP is associated',
+ `network_id` bigint unsigned NULL COMMENT 'guest network to which portable ip address is associated with',
+ `vpc_id` bigint unsigned COMMENT 'vpc to which portable ip address is associated with',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_portable_ip_address__portable_ip_range_id` FOREIGN KEY (`portable_ip_range_id`) REFERENCES `portable_ip_range`(`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_portable_ip_address__region_id` FOREIGN KEY (`region_id`) REFERENCES `region`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN is_portable int(1) unsigned NOT NULL default '0';
+
DROP VIEW IF EXISTS `cloud`.`disk_offering_view`;
CREATE VIEW `cloud`.`disk_offering_view` AS
select
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/test/integration/smoke/test_portable_publicip.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
new file mode 100644
index 0000000..101747d
--- /dev/null
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -0,0 +1,237 @@
+#!/usr/bin/env python
+# 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.
+
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from marvin import remoteSSHClient
+from nose.plugins.attrib import attr
+
+class Services:
+ """Test Data
+ """
+
+ def __init__(self):
+ self.services = {
+ "domain": {
+ "name": "Domain",
+ },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ # in MHz
+ "memory": 128,
+ # In MBs
+ },
+ "network_offering": {
+ "name": 'Test Network offering',
+ "displaytext": 'Test Network offering',
+ "guestiptype": 'Isolated',
+ "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+ "traffictype": 'GUEST',
+ "availability": 'Optional',
+ "serviceProviderList" : {
+ "Dhcp": 'VirtualRouter',
+ "Dns": 'VirtualRouter',
+ "SourceNat": 'VirtualRouter',
+ "PortForwarding": 'VirtualRouter',
+ },
+ },
+ "network": {
+ "name": "Test Network",
+ "displaytext": "Test Network",
+ },
+ "ostype": 'CentOS 5.3 (64-bit)',
+ "gateway" : "10.1.1.1",
+ "netmask" : "255.255.255.0",
+ "startip" : "10.1.1.10",
+ "endip" : "10.1.1.20",
+ "regionid" : "1",
+ "vlan" :"10",
+ "isportable" : "true",
+ "virtual_machine" : {
+ "affinity": {
+ "name": "webvms",
+ "type": "host anti-affinity",
+ },
+ "hypervisor" : "XenServer",
+ }
+ }
+
+class TestPortablePublicIPRange(cloudstackTestCase):
+
+ """
+ This test validates functionality where
+ - admin can provision a portable public ip range
+ - list provisioned portable public ip range
+ - delete provisioned portable public ip range
+ """
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestPortablePublicIPRange, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.zone = get_zone(cls.api_client, cls.services)
+
+ # Create Account
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+ cls._cleanup = [
+ cls.account,
+ ]
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Cleanup resources used
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+ return
+
+ def tearDown(self):
+ try:
+ # Clean up
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ @attr(tags = ["simulator", "basic", "advanced", "portablepublicip"])
+ def test_createPortablePublicIPRange(self):
+ """
+ """
+ self.debug("attempting to create a portable Public IP range")
+ self.portable_ip_range = PortablePublicIpRange.create(
+ self.api_client,
+ self.services
+ )
+ self.debug("attempting to verify portable Public IP range is created")
+ list_portbale_ip_range_response = PortablePublicIpRange.list(
+ self.apiclient,
+ id=self.portable_ip_range.id
+ )
+ self.portable_ip_range.delete(self.apiclient)
+ return
+
+
+class TestPortablePublicIPAcquire(cloudstackTestCase):
+
+ """
+ This test validates functionality where
+ - admin has provisioned a portable public ip range
+ - user can acquire portable ip from the provisioned ip range
+ """
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestPortablePublicIPAcquire, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.zone = get_zone(cls.api_client, cls.services)
+ # Create Account
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+ cls.services["network"]["zoneid"] = cls.zone.id
+
+ cls.network_offering = NetworkOffering.create(
+ cls.api_client,
+ cls.services["network_offering"],
+ )
+ # Enable Network offering
+ cls.network_offering.update(cls.api_client, state='Enabled')
+
+ cls.services["network"]["networkoffering"] = cls.network_offering.id
+ cls.account_network = Network.create(
+ cls.api_client,
+ cls.services["network"],
+ cls.account.name,
+ cls.account.domainid
+ )
+ cls._cleanup = [
+ cls.account_network,
+ cls.network_offering,
+ cls.account
+ ]
+
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Cleanup resources used
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+ return
+
+ def tearDown(self):
+ try:
+ # Clean up
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ @attr(tags = ["simulator", "basic", "advanced", "portablepublicip"])
+ def test_createPortablePublicIPAcquire(self):
+ """
+ """
+ self.debug("attempting to create a portable Public IP range")
+ self.portable_ip_range = PortablePublicIpRange.create(
+ self.api_client,
+ self.services
+ )
+
+ ip_address = PublicIPAddress.create(self.api_client, self.account.name, self.zone.id, self.account.domainid)
+
+ self.portable_ip_range.delete(self.apiclient)
+ return
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index f3a96bd..ec1c34e 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -2131,6 +2131,42 @@ class PublicIpRange:
cmd.id = self.vlan.id
return apiclient.releasePublicIpRange(cmd)
+
+class PortablePublicIpRange:
+ """Manage portable public Ip Range"""
+
+ def __init__(self, items):
+ self.__dict__.update(items)
+
+ @classmethod
+ def create(cls, apiclient, services):
+ """Create portable public Ip Range"""
+
+ cmd = createPortableIpRange.createPortableIpRangeCmd()
+ cmd.gateway = services["gateway"]
+ cmd.netmask = services["netmask"]
+ cmd.startip = services["startip"]
+ cmd.endip = services["endip"]
+ cmd.regionid = services["regionid"]
+ cmd.vlan = services["vlan"]
+
+ return PortablePublicIpRange(apiclient.createVlanIpRange(cmd).__dict__)
+
+ def delete(self, apiclient):
+ """Delete portable IpRange"""
+
+ cmd = deletePortableIpRange.deletePortableIpRangeCmd()
+ cmd.id = self.id
+ apiclient.deletePortableIpRange(cmd)
+
+ @classmethod
+ def list(cls, apiclient, **kwargs):
+ """Lists all portable public IP ranges."""
+
+ cmd = listPortableIpRanges.listPortableIpRangesCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ return(apiclient.listPortableIpRanges(cmd))
+
class SecondaryStorage:
"""Manage Secondary storage"""
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/utils/src/com/cloud/utils/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java
index 9551c26..37dcef3 100755
--- a/utils/src/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/com/cloud/utils/net/NetUtils.java
@@ -1296,6 +1296,18 @@ public class NetUtils {
return resultIp;
}
+ public static boolean isValidVlan(String vlan) {
+ try {
+ int vnet = Integer.parseInt(vlan);
+ if (vnet < 0 || vnet > 4096) {
+ return false;
+ }
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+
public static URI generateUriForPvlan(String primaryVlan, String isolatedPvlan) {
return URI.create("pvlan://" + primaryVlan + "-i" + isolatedPvlan);
}
@@ -1320,4 +1332,5 @@ public class NetUtils {
}
return null;
}
+
}
[47/50] [abbrv] git commit: updated refs/heads/master to d893cb4
Posted by ya...@apache.org.
Revert "CLOUDSTACK-3357: dnsmasq on vpc-routervm"
This reverts commit f99d599930a4bc1bfcdfd44d4f088cdae58890e5.
Due to it break vpc function and block regression test.
Conflicts:
server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
server/test/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImplTest.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2df1d7f3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2df1d7f3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2df1d7f3
Branch: refs/heads/master
Commit: 2df1d7f328b97700c6b2b6ede5a890daeb0fde6b
Parents: d423a75
Author: Sheng Yang <sh...@citrix.com>
Authored: Sun Jul 21 17:09:19 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Sun Jul 21 22:23:48 2013 -0700
----------------------------------------------------------------------
.../VirtualNetworkApplianceManagerImpl.java | 22 +---
.../VpcVirtualNetworkApplianceManagerImpl.java | 70 ++---------
...cVirtualNetworkApplianceManagerImplTest.java | 121 -------------------
server/test/resources/VpcVirtNetAppContext.xml | 41 -------
4 files changed, 11 insertions(+), 243 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2df1d7f3/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index dda2df8..6c0f7a1 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -1320,7 +1320,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
}
}
}
-
+
protected class CheckRouterTask implements Runnable {
public CheckRouterTask() {
@@ -1589,12 +1589,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException,
StorageUnavailableException, ResourceUnavailableException {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("deployRouter(" + owner.getAccountName() + ", " + dest.getHost() + ", " + plan.toString() + ", " + params.toString()
- + ", " + isRedundant + ", " + vrProvider.getUuid() + ", " + svcOffId + ", " + vpcId
- + ", list_of_" + networks.size() + "networks, " + startRouter + ", " + supportedHypervisors + ")");
- }
-
ServiceOfferingVO routerOffering = _serviceOfferingDao.findById(svcOffId);
// Router is the network element, we don't know the hypervisor type yet.
@@ -1872,11 +1866,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
private DomainRouterVO startVirtualRouter(DomainRouterVO router, User user, Account caller, Map<Param, Object> params)
throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
-
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("startVirtualRouter(" + router.getHostName() + ", " + user.getUsername() + ", " + caller.getAccountName() + ", " + params.toString() + ")");
- }
-
+
if (router.getRole() != Role.VIRTUAL_ROUTER || !router.getIsRedundantRouter()) {
return this.start(router, user, caller, params, null);
}
@@ -2510,7 +2500,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
createIpAlias(router, activeIpAliasTOs, guestNetworkId, cmds);
configDnsMasq(router, _networkDao.findById(guestNetworkId), cmds);
}
-
}
}
}
@@ -2912,9 +2901,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
public boolean applyDhcpEntry(Network network, final NicProfile nic, VirtualMachineProfile<UserVm> profile,
DeployDestination dest, List<DomainRouterVO> routers)
throws ResourceUnavailableException {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("applyDhcpEntry(" + network.getCidr() + ", " + nic.getMacAddress() + ", " + profile.getUuid() + ", " + dest.getHost() + ", " + routers + ")");
- }
_userVmDao.loadDetails((UserVmVO) profile.getVirtualMachine());
final VirtualMachineProfile<UserVm> updatedProfile = profile;
@@ -3448,9 +3434,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
}
private void configDnsMasq(VirtualRouter router, Network network, Commands cmds) {
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("configDnsMasq(" + router.getHostName() + ", " + network.getNetworkDomain() + ", " + cmds + ")");
- }
DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
List<NicIpAliasVO> ipAliasVOList = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.state.active);
List<DhcpTO> ipList = new ArrayList<DhcpTO>();
@@ -3482,7 +3465,6 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
dnsMasqConfigCmd.setDomainSuffix(domain_suffix);
dnsMasqConfigCmd.setIfDnsProvided(dnsProvided);
cmds.addCommand("dnsMasqConfig" ,dnsMasqConfigCmd);
- //To change body of created methods use File | Settings | File Templates.
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2df1d7f3/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index 3ca4331..5dbecb7 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -167,9 +167,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
public List<DomainRouterVO> deployVirtualRouterInVpc(Vpc vpc, DeployDestination dest, Account owner,
Map<Param, Object> params) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("deployVirtualRouterInVpc(" + vpc.getName() +", "+dest.getHost()+", "+owner.getAccountName()+", "+params.toString()+")");
- }
List<DomainRouterVO> routers = findOrDeployVirtualRouterInVpc(vpc, dest, owner, params);
@@ -247,9 +244,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
@Override
public boolean addVpcRouterToGuestNetwork(VirtualRouter router, Network network, boolean isRedundant)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("addVpcRouterToGuestNetwork(" + router.getUuid() + ", " + network.getCidr() + ", " + isRedundant + ")");
- }
+
if (network.getTrafficType() != TrafficType.Guest) {
s_logger.warn("Network " + network + " is not of type " + TrafficType.Guest);
return false;
@@ -321,10 +316,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
Long vpcId, PublicIp sourceNatIp) throws ConcurrentOperationException,
InsufficientAddressCapacityException, InsufficientServerCapacityException, InsufficientCapacityException,
StorageUnavailableException, ResourceUnavailableException {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("deployVpcRouter(" + owner.getAccountName() + ", " + dest.getHost() + ", " + plan.toString() + ", " + params.toString()
- + ", " + isRedundant + ", " + vrProvider.getUuid() + ", " + svcOffId + ", " + vpcId + ", " + sourceNatIp + ")");
- }
+
List<Pair<NetworkVO, NicProfile>> networks = createVpcRouterNetworks(owner, isRedundant, plan, new Pair<Boolean, PublicIp>(true, sourceNatIp),
vpcId);
DomainRouterVO router =
@@ -705,15 +697,12 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
@Override
public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<DomainRouterVO> profile) {
DomainRouterVO router = profile.getVirtualMachine();
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("finalizeCommandsOnStart(" + cmds + ", " + profile.getHostName() + ")");
- }
boolean isVpc = (router.getVpcId() != null);
if (!isVpc) {
return super.finalizeCommandsOnStart(cmds, profile);
}
-
+
//1) FORM SSH CHECK COMMAND
NicProfile controlNic = getControlNic(profile);
if (controlNic == null) {
@@ -722,7 +711,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
}
finalizeSshAndVersionAndNetworkUsageOnStart(cmds, profile, router, controlNic);
-
+
//2) FORM PLUG NIC COMMANDS
List<Pair<Nic, Network>> guestNics = new ArrayList<Pair<Nic, Network>>();
List<Pair<Nic, Network>> publicNics = new ArrayList<Pair<Nic, Network>>();
@@ -875,49 +864,15 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
//Add network usage commands
cmds.addCommands(usageCmds);
- configDnsMasq(router, cmds);
-
+
return true;
}
- protected void configDnsMasq(VirtualRouter router, Commands cmds) {
- if (s_logger.isTraceEnabled()) {
- s_logger.trace("configDnsMasq(" + router.getHostName() + ", " + cmds + ")");
- }
- VpcVO vpc = _vpcDao.findById(router.getVpcId());
- DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId());
- List<DhcpTO> ipList = new ArrayList<DhcpTO>();
-
- String cidr = vpc.getCidr();
- String[] cidrPair = cidr.split("\\/");
- String cidrAddress = cidrPair[0];
- long cidrSize = Long.parseLong(cidrPair[1]);
- String startIpOfSubnet = NetUtils.getIpRangeStartIpFromCidr(cidrAddress, cidrSize);
- DhcpTO DhcpTO = new DhcpTO(router.getPrivateIpAddress(), router.getPublicIpAddress(), NetUtils.getCidrNetmask(cidrSize), startIpOfSubnet);
- ipList.add(DhcpTO);
-
- NicVO nic = _nicDao.findByIp4AddressAndVmId(_routerDao.findById(router.getId()).getPrivateIpAddress(), router.getId());
- DataCenterVO dcvo = _dcDao.findById(router.getDataCenterId());
- boolean dnsProvided = _networkModel.isProviderSupportServiceInNetwork(nic.getNetworkId(), Service.Dns, Provider.VirtualRouter);
- String domain_suffix = dcvo.getDetail(ZoneConfig.DnsSearchOrder.getName());
- DnsMasqConfigCommand dnsMasqConfigCmd = new DnsMasqConfigCommand(vpc.getNetworkDomain(),ipList, dcVo.getDns1(), dcVo.getDns2(), dcVo.getInternalDns1(), dcVo.getInternalDns2());
- dnsMasqConfigCmd.setAccessDetail(NetworkElementCommand.ROUTER_IP, getRouterControlIp(router.getId()));
- dnsMasqConfigCmd.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
- dnsMasqConfigCmd.setAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP, router.getPublicIpAddress());
- dnsMasqConfigCmd.setAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE, dcVo.getNetworkType().toString());
- dnsMasqConfigCmd.setDomainSuffix(domain_suffix);
- dnsMasqConfigCmd.setIfDnsProvided(dnsProvided);
-
- cmds.addCommand("dnsMasqConfig" ,dnsMasqConfigCmd);
- }
-
-
@Override
protected void finalizeNetworkRulesForNetwork(Commands cmds, DomainRouterVO router, Provider provider, Long guestNetworkId) {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("finalizing network config for "+ router.getHostName());
- }
+
super.finalizeNetworkRulesForNetwork(cmds, router, provider, guestNetworkId);
+
if (router.getVpcId() != null) {
if (_networkModel.isProviderSupportServiceInNetwork(guestNetworkId, Service.NetworkACL, Provider.VPCVirtualRouter)) {
List<NetworkACLItemVO> networkACLs = _networkACLMgr.listNetworkACLItems(guestNetworkId);
@@ -927,10 +882,6 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
createNetworkACLsCommands(networkACLs, router, cmds, guestNetworkId, false);
}
}
-
- if(s_logger.isDebugEnabled()) {
- s_logger.debug("setup the vpc domain on router " + router.getHostName());
- }
}
}
@@ -975,10 +926,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
*/
protected boolean setupVpcPrivateNetwork(VirtualRouter router, boolean add, NicProfile privateNic)
throws ResourceUnavailableException {
- if(s_logger.isTraceEnabled()) {
- s_logger.trace("deployVpcRouter(" + router.getHostName() + ", " + add + ", " + privateNic.getMacAddress() + ")");
- }
-
+
if (router.getState() == State.Running) {
PrivateIpVO ipVO = _privateIpDao.findByIpAndSourceNetworkId(privateNic.getNetworkId(), privateNic.getIp4Address());
Network network = _networkDao.findById(privateNic.getNetworkId());
@@ -990,7 +938,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
privateIps.add(ip);
Commands cmds = new Commands(OnError.Stop);
createVpcAssociatePrivateIPCommands(router, privateIps, cmds, add);
-
+
if (sendCommandsToRouter(router, cmds)) {
s_logger.debug("Successfully applied ip association for ip " + ip + " in vpc network " + network);
return true;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2df1d7f3/server/test/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImplTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImplTest.java b/server/test/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImplTest.java
deleted file mode 100644
index 071f658..0000000
--- a/server/test/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImplTest.java
+++ /dev/null
@@ -1,121 +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 com.cloud.network.router;
-
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.mockingDetails;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import com.cloud.configuration.ZoneConfig;
-import com.cloud.network.Network;
-import com.cloud.network.NetworkModel;
-import com.cloud.vm.VirtualMachine;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import com.cloud.agent.AgentManager.OnError;
-import com.cloud.agent.api.routing.DnsMasqConfigCommand;
-import com.cloud.agent.manager.Commands;
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.network.NetworkManager;
-import com.cloud.network.router.VirtualRouter.RedundantState;
-import com.cloud.network.vpc.VpcVO;
-import com.cloud.network.vpc.dao.VpcDao;
-import com.cloud.vm.DomainRouterVO;
-import com.cloud.vm.NicVO;
-import com.cloud.vm.dao.DomainRouterDao;
-import com.cloud.vm.dao.NicDao;
-
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations="classpath:/VpcVirtNetAppContext.xml")
-public class VpcVirtualNetworkApplianceManagerImplTest {
- private static final Logger s_logger = Logger.getLogger(VpcVirtualNetworkApplianceManagerImplTest.class);
-
- @Mock DataCenterDao _dcDao;
- @Mock VpcDao _vpcDao;
- @Mock VirtualRouter router;
- @Mock NicDao _nicDao;
- @Mock DomainRouterDao _routerDao;
- @Mock NetworkModel _networkmodel;
- @Mock NicVO nicVO;
- @Mock DataCenterVO dcVO;
-
- @Before
- public void setup() {
- MockitoAnnotations.initMocks(this);
-
- }
-
- @Test
- public void testConfigDnsMasq() {
- VpcVirtualNetworkApplianceManagerImpl vpcVirtNetAppMgr = new VpcVirtualNetworkApplianceManagerImpl();
- vpcVirtNetAppMgr._vpcDao = _vpcDao;
- vpcVirtNetAppMgr._dcDao = _dcDao;
- vpcVirtNetAppMgr._nicDao = _nicDao;
- vpcVirtNetAppMgr._routerDao = _routerDao;
- when(router.getId()).thenReturn(1L);
- when(router.getVpcId()).thenReturn(1L);
- when(router.getDataCenterId()).thenReturn(1L);
- VpcVO vpc = new VpcVO(1L,"bla","bla",1L,1L,1L,"10.0.0.0/8","blieb.net");
- when( _vpcDao.findById(1L)).thenReturn(vpc);
- DataCenterVO dcVo = new DataCenterVO(1L,"dc","dc","8.8.8.8",null,null,null,"10.0.0.0/8","bla.net",new Long(1L),NetworkType.Advanced,null,".net");
- Map<String, String> map = new HashMap<String, String>();
- dcVo.setDetails(map);
- dcVo.setDetail(ZoneConfig.DnsSearchOrder.getName(), "dummy");
- when(_dcDao.findById(1L)).thenReturn(dcVo);
- DomainRouterVO routerVo = new DomainRouterVO(1L,1L,1L,"brr",1L,HypervisorType.Any,1L,1L,1L,false,0,false,RedundantState.MASTER,false,false,1L);
- when( _routerDao.findById(1L)).thenReturn(routerVo);
-// when( vpcVirtNetAppMgr.getRouterControlIp(1L)).thenReturn("10.0.0.1");
- when( router.getInstanceName()).thenReturn("r-vm-1");
- when( router.getPublicIpAddress()).thenReturn("11.11.11.11");
- NicVO nicvo = new NicVO("server", 1l, 1l, VirtualMachine.Type.DomainRouter);
- nicvo.setNetworkId(1l);
- when(_nicDao.findByIp4AddressAndVmId(anyString(), anyLong())).thenReturn(nicvo);
- NetworkManager netMgr = mock(NetworkManager.class);
- vpcVirtNetAppMgr._networkMgr = netMgr;
- vpcVirtNetAppMgr._networkModel = _networkmodel;
- when(nicVO.getNetworkId()).thenReturn(1l);
- when(_networkmodel.isProviderSupportServiceInNetwork(1l, Network.Service.Dhcp, Network.Provider.VirtualRouter)).thenReturn(true);
- when(dcVO.getDetail(anyString())).thenReturn(null);
- Commands cmds = new Commands(OnError.Stop);
-
- vpcVirtNetAppMgr.configDnsMasq(router, cmds);
- Assert.assertEquals("expected one command",1, cmds.size());
-
- DnsMasqConfigCommand cmd = cmds.getCommand(DnsMasqConfigCommand.class);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2df1d7f3/server/test/resources/VpcVirtNetAppContext.xml
----------------------------------------------------------------------
diff --git a/server/test/resources/VpcVirtNetAppContext.xml b/server/test/resources/VpcVirtNetAppContext.xml
deleted file mode 100644
index f8a8aa4..0000000
--- a/server/test/resources/VpcVirtNetAppContext.xml
+++ /dev/null
@@ -1,41 +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. -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
- <context:annotation-config />
-
- <!-- @DB support -->
-<!--
- <bean id="vpcVirtualNetworkApplianceManager" class="com.cloud.network.router.VpcVirtualNetworkApplianceManagerImpl" />
- <bean id="vpcDao" class="com.cloud.network.vpc.dao.VpcDaoImpl" />
- <bean id="nicDao" class="com.cloud.vm.dao.NicDaoImpl" />
- <bean id="dcDao" class="com.cloud.dc.dao.DataCenterDaoImpl" />
- -->
- <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
- <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor">
- <property name="Interceptors">
- <list>
- <ref bean="transactionContextBuilder" />
- </list>
- </property>
- </bean>
-
- </beans>
[44/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
PVLAN: CLOUDSTACK-2401: VM Migration support
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb7c3214
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb7c3214
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb7c3214
Branch: refs/heads/pvlan
Commit: eb7c3214260371b0551040831ad7404f5880fc8d
Parents: 7260e8d
Author: Sheng Yang <sh...@citrix.com>
Authored: Fri May 3 11:02:44 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon May 20 16:43:24 2013 -0700
----------------------------------------------------------------------
.../network/element/VirtualRouterElement.java | 70 +++++++++++++++++++-
.../router/VirtualNetworkApplianceManager.java | 2 +-
.../VirtualNetworkApplianceManagerImpl.java | 32 ++++++---
server/src/com/cloud/vm/UserVmManager.java | 1 +
server/src/com/cloud/vm/UserVmManagerImpl.java | 13 ++--
.../com/cloud/vm/MockUserVmManagerImpl.java | 6 ++
.../MockVpcVirtualNetworkApplianceManager.java | 6 ++
7 files changed, 110 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/src/com/cloud/network/element/VirtualRouterElement.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index 8021e6f..1916678 100755
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -47,7 +47,9 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
+import com.cloud.network.NetworkMigrationResponder;
import com.cloud.network.NetworkModel;
+import com.cloud.network.Networks;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.PhysicalNetworkServiceProvider;
@@ -85,9 +87,13 @@ import com.cloud.utils.db.SearchCriteriaService;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.NicProfile;
+import com.cloud.vm.NicVO;
import com.cloud.vm.ReservationContext;
+import com.cloud.vm.UserVmManager;
+import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.UserVmDao;
@@ -108,10 +114,12 @@ import java.util.Set;
@Local(value = {NetworkElement.class, FirewallServiceProvider.class,
DhcpServiceProvider.class, UserDataServiceProvider.class,
StaticNatServiceProvider.class, LoadBalancingServiceProvider.class,
- PortForwardingServiceProvider.class, IpDeployer.class, RemoteAccessVPNServiceProvider.class} )
+ PortForwardingServiceProvider.class, IpDeployer.class,
+ RemoteAccessVPNServiceProvider.class, NetworkMigrationResponder.class} )
public class VirtualRouterElement extends AdapterBase implements VirtualRouterElementService, DhcpServiceProvider,
UserDataServiceProvider, SourceNatServiceProvider, StaticNatServiceProvider, FirewallServiceProvider,
- LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer {
+ LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer,
+ NetworkMigrationResponder {
private static final Logger s_logger = Logger.getLogger(VirtualRouterElement.class);
protected static final Map<Service, Map<Capability, String>> capabilities = setCapabilities();
@@ -130,6 +138,8 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
ConfigurationManager _configMgr;
@Inject
RulesManager _rulesMgr;
+ @Inject
+ UserVmManager _userVmMgr;
@Inject
UserVmDao _userVmDao;
@@ -1024,7 +1034,6 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
// TODO Auto-generated method stub
return null;
}
-
private boolean canHandleLbRules(List<LoadBalancingRule> rules) {
Map<Capability, String> lbCaps = this.getCapabilities().get(Service.Lb);
if (!lbCaps.isEmpty()) {
@@ -1039,5 +1048,60 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
}
}
return true;
+ }
+
+ @Override
+ public boolean prepareMigration(NicProfile nic, Network network,
+ VirtualMachineProfile<? extends VirtualMachine> vm,
+ DeployDestination dest, ReservationContext context) {
+ if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
+ return true;
+ }
+ if (vm.getType() == Type.DomainRouter) {
+ assert vm instanceof DomainRouterVO;
+ DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine();
+ _routerMgr.setupDhcpForPvlan(false, router, router.getHostId(), nic);
+ } else if (vm.getType() == Type.User){
+ assert vm instanceof UserVmVO;
+ UserVmVO userVm = (UserVmVO)vm.getVirtualMachine();
+ _userVmMgr.setupVmForPvlan(false, userVm.getHostId(), nic);
+ }
+ return true;
+ }
+
+ @Override
+ public void rollbackMigration(NicProfile nic, Network network,
+ VirtualMachineProfile<? extends VirtualMachine> vm,
+ ReservationContext src, ReservationContext dst) {
+ if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
+ return;
+ }
+ if (vm.getType() == Type.DomainRouter) {
+ assert vm instanceof DomainRouterVO;
+ DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine();
+ _routerMgr.setupDhcpForPvlan(true, router, router.getHostId(), nic);
+ } else if (vm.getType() == Type.User){
+ assert vm instanceof UserVmVO;
+ UserVmVO userVm = (UserVmVO)vm.getVirtualMachine();
+ _userVmMgr.setupVmForPvlan(true, userVm.getHostId(), nic);
+ }
+ }
+
+ @Override
+ public void commitMigration(NicProfile nic, Network network,
+ VirtualMachineProfile<? extends VirtualMachine> vm,
+ ReservationContext src, ReservationContext dst) {
+ if (nic.getBroadcastType() != Networks.BroadcastDomainType.Pvlan) {
+ return;
+ }
+ if (vm.getType() == Type.DomainRouter) {
+ assert vm instanceof DomainRouterVO;
+ DomainRouterVO router = (DomainRouterVO)vm.getVirtualMachine();
+ _routerMgr.setupDhcpForPvlan(true, router, router.getHostId(), nic);
+ } else if (vm.getType() == Type.User){
+ assert vm instanceof UserVmVO;
+ UserVmVO userVm = (UserVmVO)vm.getVirtualMachine();
+ _userVmMgr.setupVmForPvlan(true, userVm.getHostId(), nic);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
index 9852c47..72fddf4 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManager.java
@@ -33,7 +33,6 @@ import com.cloud.user.User;
import com.cloud.uservm.UserVm;
import com.cloud.utils.component.Manager;
import com.cloud.vm.DomainRouterVO;
-import com.cloud.vm.Nic;
import com.cloud.vm.NicProfile;
import com.cloud.vm.VirtualMachineProfile;
@@ -113,4 +112,5 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
boolean removeDhcpSupportForSubnet(Network network, List<DomainRouterVO> routers) throws ResourceUnavailableException;
+ boolean setupDhcpForPvlan(boolean add, DomainRouterVO router, Long hostId, NicProfile nic);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 50ae4c1..64e412a 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2223,8 +2223,9 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
return dhcpRange;
}
- private boolean setupDhcpForPvlan(boolean add, DomainRouterVO router, Nic nic) {
- if (!nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ @Override
+ public boolean setupDhcpForPvlan(boolean add, DomainRouterVO router, Long hostId, NicProfile nic) {
+ if (!nic.getBroadCastUri().getScheme().equals("pvlan")) {
return false;
}
String op = "add";
@@ -2233,15 +2234,22 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
}
Network network = _networkDao.findById(nic.getNetworkId());
String networkTag = _networkModel.getNetworkTag(router.getHypervisorType(), network);
- PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadcastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
- Commands cmds = new Commands(cmd);
+ PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadCastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
// In fact we send command to the host of router, we're not programming router but the host
- try {
- sendCommandsToRouter(router, cmds);
- } catch (AgentUnavailableException e) {
+ Answer answer = null;
+ try {
+ answer = _agentMgr.send(hostId, cmd);
+ } catch (OperationTimedoutException e) {
+ s_logger.warn("Timed Out", e);
+ return false;
+ } catch (AgentUnavailableException e) {
s_logger.warn("Agent Unavailable ", e);
- return false;
- }
+ return false;
+ }
+
+ if (answer == null || !answer.getResult()) {
+ return false;
+ }
return true;
}
@@ -2563,7 +2571,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
if (network.getTrafficType() == TrafficType.Guest) {
guestNetworks.add(network);
if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
- result = setupDhcpForPvlan(true, router, nic);
+ NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
+ result = setupDhcpForPvlan(true, router, router.getHostId(), nicProfile);
}
}
}
@@ -2601,7 +2610,8 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
for (Nic nic : routerNics) {
Network network = _networkModel.getNetwork(nic.getNetworkId());
if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri().getScheme().equals("pvlan")) {
- setupDhcpForPvlan(false, domR, nic);
+ NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
+ setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/src/com/cloud/vm/UserVmManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java
index 0f8e368..4dcfb73 100755
--- a/server/src/com/cloud/vm/UserVmManager.java
+++ b/server/src/com/cloud/vm/UserVmManager.java
@@ -94,4 +94,5 @@ public interface UserVmManager extends VirtualMachineGuru<UserVmVO>, UserVmServi
boolean upgradeVirtualMachine(Long id, Long serviceOfferingId) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+ boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 86150a2..71b4e3f 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2821,8 +2821,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
return true;
}
- private boolean setupVmForPvlan(boolean add, Long hostId, NicVO nic) {
- if (!nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ @Override
+ public boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic) {
+ if (!nic.getBroadCastUri().getScheme().equals("pvlan")) {
return false;
}
String op = "add";
@@ -2833,7 +2834,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
Network network = _networkDao.findById(nic.getNetworkId());
Host host = _hostDao.findById(hostId);
String networkTag = _networkModel.getNetworkTag(host.getHypervisorType(), network);
- PvlanSetupCommand cmd = PvlanSetupCommand.createVmSetup(op, nic.getBroadcastUri(), networkTag, nic.getMacAddress());
+ PvlanSetupCommand cmd = PvlanSetupCommand.createVmSetup(op, nic.getBroadCastUri(), networkTag, nic.getMacAddress());
Answer answer = null;
try {
answer = _agentMgr.send(hostId, cmd);
@@ -2916,7 +2917,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
// In vmware, we will be effecting pvlan settings in portgroups in StartCommand.
if (profile.getHypervisorType() != HypervisorType.VMware) {
if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
- if (!setupVmForPvlan(true, hostId, nic)) {
+ NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
+ if (!setupVmForPvlan(true, hostId, nicProfile)) {
return false;
}
}
@@ -3058,7 +3060,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
NetworkVO network = _networkDao.findById(nic.getNetworkId());
if (network.getTrafficType() == TrafficType.Guest) {
if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
- setupVmForPvlan(false, vm.getHostId(), nic);
+ NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
+ setupVmForPvlan(false, vm.getHostId(), nicProfile);
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/test/com/cloud/vm/MockUserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
index 50a90f2..448a5dd 100644
--- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java
+++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
@@ -455,4 +455,10 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
// TODO Auto-generated method stub
return null;
}
+
+ @Override
+ public boolean setupVmForPvlan(boolean add, Long hostId, NicProfile nic) {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb7c3214/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
index 8d50211..f325c4a 100644
--- a/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
+++ b/server/test/com/cloud/vpc/MockVpcVirtualNetworkApplianceManager.java
@@ -420,4 +420,10 @@ VpcVirtualNetworkApplianceService {
return null;
}
+ @Override
+ public boolean setupDhcpForPvlan(boolean add, DomainRouterVO router, Long hostId,
+ NicProfile nic) {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
[40/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Adding package declaration to MidoNetElementTest
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cede6c11
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cede6c11
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cede6c11
Branch: refs/heads/pvlan
Commit: cede6c11ab5e5ee7838dd84b0914a640267c7769
Parents: 54ac779
Author: Dave Cahill <dc...@midokura.com>
Authored: Mon May 20 17:00:12 2013 +0900
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon May 20 18:57:42 2013 +0100
----------------------------------------------------------------------
.../test/com/cloud/network/element/MidoNetElementTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cede6c11/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
index baf99b9..a7d96b0 100644
--- a/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
+++ b/plugins/network-elements/midonet/test/com/cloud/network/element/MidoNetElementTest.java
@@ -17,7 +17,8 @@
* under the License.
*/
-import com.cloud.network.element.MidoNetElement;
+package com.cloud.network.element;
+
import com.cloud.user.AccountVO;
import com.cloud.user.dao.AccountDao;
import junit.framework.TestCase;
[22/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-1901 : API:MS: DeleteEvents deletes Archived events as well
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e7332b7c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e7332b7c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e7332b7c
Branch: refs/heads/pvlan
Commit: e7332b7c0447c8fc9bde157e4f639fde453790cd
Parents: 63e92a4
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Fri May 10 12:10:56 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Mon May 20 11:58:19 2013 +0530
----------------------------------------------------------------------
engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java | 8 ++++++++
engine/schema/src/com/cloud/event/dao/EventDaoImpl.java | 5 +++++
2 files changed, 13 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7332b7c/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
index 4b9bc6a..01a560a 100755
--- a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
+++ b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java
@@ -43,6 +43,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
AlertSearchByIdsAndType.and("type", AlertSearchByIdsAndType.entity().getType(), Op.EQ);
AlertSearchByIdsAndType.and("createdDateL", AlertSearchByIdsAndType.entity().getCreatedDate(), Op.LT);
AlertSearchByIdsAndType.and("data_center_id", AlertSearchByIdsAndType.entity().getDataCenterId(), Op.EQ);
+ AlertSearchByIdsAndType.and("archived", AlertSearchByIdsAndType.entity().getArchived(), Op.EQ);
AlertSearchByIdsAndType.done();
}
@@ -53,6 +54,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
if (podId != null) {
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
}
@@ -74,6 +76,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type));
sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId));
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
if (podId != null) {
sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
}
@@ -101,6 +104,8 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if(olderThan != null) {
sc.setParameters("createdDateL", olderThan);
}
+ sc.setParameters("archived", false);
+
boolean result = true;;
List<AlertVO> alerts = listBy(sc);
if (Ids != null && alerts.size() < Ids.size()) {
@@ -135,6 +140,8 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if(olderThan != null) {
sc.setParameters("createdDateL", olderThan);
}
+ sc.setParameters("archived", false);
+
boolean result = true;
List<AlertVO> alerts = listBy(sc);
if (ids != null && alerts.size() < ids.size()) {
@@ -150,6 +157,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert
if (oldTime == null) return null;
SearchCriteria<AlertVO> sc = createSearchCriteria();
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
return listIncludingRemovedBy(sc, null);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e7332b7c/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
index 0d3d38a..cefe107 100644
--- a/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/EventDaoImpl.java
@@ -44,6 +44,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
CompletedEventSearch = createSearchBuilder();
CompletedEventSearch.and("state",CompletedEventSearch.entity().getState(),SearchCriteria.Op.EQ);
CompletedEventSearch.and("startId", CompletedEventSearch.entity().getStartId(), SearchCriteria.Op.EQ);
+ CompletedEventSearch.and("archived", CompletedEventSearch.entity().getArchived(), Op.EQ);
CompletedEventSearch.done();
ToArchiveOrDeleteEventSearch = createSearchBuilder();
@@ -51,6 +52,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
ToArchiveOrDeleteEventSearch.and("type", ToArchiveOrDeleteEventSearch.entity().getType(), Op.EQ);
ToArchiveOrDeleteEventSearch.and("accountIds", ToArchiveOrDeleteEventSearch.entity().getAccountId(), Op.IN);
ToArchiveOrDeleteEventSearch.and("createDateL", ToArchiveOrDeleteEventSearch.entity().getCreateDate(), Op.LT);
+ ToArchiveOrDeleteEventSearch.and("archived", ToArchiveOrDeleteEventSearch.entity().getArchived(), Op.EQ);
ToArchiveOrDeleteEventSearch.done();
}
@@ -64,6 +66,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
if (oldTime == null) return null;
SearchCriteria<EventVO> sc = createSearchCriteria();
sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime);
+ sc.addAnd("archived", SearchCriteria.Op.EQ, false);
return listIncludingRemovedBy(sc, null);
}
@@ -72,6 +75,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
SearchCriteria<EventVO> sc = CompletedEventSearch.create();
sc.setParameters("state", State.Completed);
sc.setParameters("startId", startId);
+ sc.setParameters("archived", false);
return findOneIncludingRemovedBy(sc);
}
@@ -90,6 +94,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event
if (accountIds != null && !accountIds.isEmpty()) {
sc.setParameters("accountIds", accountIds.toArray(new Object[accountIds.size()]));
}
+ sc.setParameters("archived", false);
return search(sc, null);
}
[06/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2483: Fix base.py migrate volume method
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/28c5fbcb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/28c5fbcb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/28c5fbcb
Branch: refs/heads/pvlan
Commit: 28c5fbcb05750b91a54acfa84f0b59b03c7ce794
Parents: 2867c6a
Author: SrikanteswaraRao Talluri <sr...@citrix.com>
Authored: Wed May 15 00:22:32 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri May 17 14:24:47 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/integration/lib/base.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/28c5fbcb/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index a811f14..f3a96bd 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -685,6 +685,7 @@ class Volume:
timeout = timeout - 1
return
+ @classmethod
def migrate(cls, apiclient, **kwargs):
"""Migrate a volume"""
cmd = migrateVolume.migrateVolumeCmd()
[04/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2478: Fix test_volumes.py script for BVT failures
removed storage type in compute offering and disk offering
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/55d304a5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/55d304a5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/55d304a5
Branch: refs/heads/pvlan
Commit: 55d304a5bbca27994c01c0f7c63b6168d2a90f60
Parents: 4d0cea6
Author: SrikanteswaraRao Talluri <sr...@citrix.com>
Authored: Tue May 14 20:06:47 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri May 17 14:05:05 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_volumes.py | 84 ++++++++++++++++++-----------
1 file changed, 52 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55d304a5/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index 4bf8203..89b013a 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -53,19 +53,17 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- "storagetype": "local"
+ "memory": 260 # In MBs
+
},
"disk_offering": {
"displaytext": "Small",
"name": "Small",
- "storagetype": "local",
"disksize": 1
},
'resized_disk_offering': {
"displaytext": "Resized",
"name": "Resized",
- "storagetype": "local",
"disksize": 3
},
"volume_offerings": {
@@ -152,7 +150,7 @@ class TestCreateVolume(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_01_create_volume(self):
"""Test Volume creation for all Disk Offerings (incl. custom)
"""
@@ -346,8 +344,9 @@ class TestVolumes(cloudstackTestCase):
cls.custom_resized_disk_offering,
cls.service_offering,
cls.disk_offering,
+ cls.volume,
cls.account
- ]
+ ]
@classmethod
def tearDownClass(cls):
@@ -359,14 +358,17 @@ class TestVolumes(cloudstackTestCase):
def setUp(self):
self.apiClient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
+ self.attached = False
self.cleanup = []
def tearDown(self):
#Clean up, terminate the created volumes
+ if self.attached:
+ self.virtual_machine.detach_volume(self.apiClient, self.volume)
cleanup_resources(self.apiClient, self.cleanup)
return
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_02_attach_volume(self):
"""Attach a created Volume to a Running VM
"""
@@ -381,7 +383,7 @@ class TestVolumes(cloudstackTestCase):
self.virtual_machine.id
))
self.virtual_machine.attach_volume(self.apiClient, self.volume)
-
+ self.attached = True
list_volume_response = list_volumes(
self.apiClient,
id=self.volume.id
@@ -412,7 +414,7 @@ class TestVolumes(cloudstackTestCase):
(self.virtual_machine.ipaddress, e))
return
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_03_download_attached_volume(self):
"""Download a Volume attached to a VM
"""
@@ -423,6 +425,8 @@ class TestVolumes(cloudstackTestCase):
self.debug("Extract attached Volume ID: %s" % self.volume.id)
+ self.virtual_machine.attach_volume(self.apiClient, self.volume)
+ self.attached = True
cmd = extractVolume.extractVolumeCmd()
cmd.id = self.volume.id
cmd.mode = "HTTP_DOWNLOAD"
@@ -432,7 +436,7 @@ class TestVolumes(cloudstackTestCase):
with self.assertRaises(Exception):
self.apiClient.extractVolume(cmd)
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_04_delete_attached_volume(self):
"""Delete a Volume attached to a VM
"""
@@ -444,19 +448,16 @@ class TestVolumes(cloudstackTestCase):
self.debug("Trying to delete attached Volume ID: %s" %
self.volume.id)
-
+ self.virtual_machine.attach_volume(self.apiClient, self.volume)
+ self.attached = True
cmd = deleteVolume.deleteVolumeCmd()
cmd.id = self.volume.id
#Proper exception should be raised; deleting attach VM is not allowed
#with self.assertRaises(Exception):
- result = self.apiClient.deleteVolume(cmd)
- self.assertEqual(
- result,
- None,
- "Check for delete download error while volume is attached"
- )
+ with self.assertRaises(Exception):
+ self.apiClient.deleteVolume(cmd)
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_05_detach_volume(self):
"""Detach a Volume attached to a VM
"""
@@ -470,8 +471,9 @@ class TestVolumes(cloudstackTestCase):
self.volume.id,
self.virtual_machine.id
))
-
+ self.virtual_machine.attach_volume(self.apiClient, self.volume)
self.virtual_machine.detach_volume(self.apiClient, self.volume)
+ self.attached = False
#Sleep to ensure the current state will reflected in other calls
time.sleep(self.services["sleep"])
list_volume_response = list_volumes(
@@ -497,7 +499,7 @@ class TestVolumes(cloudstackTestCase):
)
return
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_06_download_detached_volume(self):
"""Download a Volume unattached to an VM
"""
@@ -506,6 +508,10 @@ class TestVolumes(cloudstackTestCase):
self.debug("Extract detached Volume ID: %s" % self.volume.id)
+ self.virtual_machine.attach_volume(self.apiClient, self.volume)
+ self.virtual_machine.detach_volume(self.apiClient, self.volume)
+ self.attached = False
+
cmd = extractVolume.extractVolumeCmd()
cmd.id = self.volume.id
cmd.mode = "HTTP_DOWNLOAD"
@@ -528,7 +534,7 @@ class TestVolumes(cloudstackTestCase):
% (extract_vol.url, self.volume.id)
)
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_07_resize_fail(self):
"""Verify invalid options fail to Resize a volume"""
# Verify the size is the new size is what we wanted it to be.
@@ -543,7 +549,7 @@ class TestVolumes(cloudstackTestCase):
response = self.apiClient.resizeVolume(cmd)
except Exception as ex:
#print str(ex)
- if "HTTP Error 431:" in str(ex):
+ if "invalid" in str(ex):
success = True
self.assertEqual(
success,
@@ -557,7 +563,7 @@ class TestVolumes(cloudstackTestCase):
try:
response = self.apiClient.resizeVolume(cmd)
except Exception as ex:
- if "HTTP Error 431:" in str(ex):
+ if "invalid" in str(ex):
success = True
self.assertEqual(
success,
@@ -576,6 +582,7 @@ class TestVolumes(cloudstackTestCase):
)
#attach the volume
self.virtual_machine.attach_volume(self.apiClient, self.volume)
+ self.attached = True
#stop the vm if it is on xenserver
if self.services['hypervisor'].lower() == "xenserver":
self.virtual_machine.stop(self.apiClient)
@@ -603,10 +610,11 @@ class TestVolumes(cloudstackTestCase):
True,
"Verify the volume did not resize"
)
- self.virtual_machine.detach_volume(self.apiClient, self.volume)
- self.cleanup.append(self.volume)
+ if self.services['hypervisor'].lower() == "xenserver":
+ self.virtual_machine.start(self.apiClient)
+
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke", "basic"])
def test_08_resize_volume(self):
"""Resize a volume"""
# Verify the size is the new size is what we wanted it to be.
@@ -616,6 +624,8 @@ class TestVolumes(cloudstackTestCase):
self.virtual_machine.id
))
self.virtual_machine.attach_volume(self.apiClient, self.volume)
+ self.attached = True
+
if self.services['hypervisor'].lower() == "xenserver":
self.virtual_machine.stop(self.apiClient)
self.debug("Resize Volume ID: %s" % self.volume.id)
@@ -635,7 +645,7 @@ class TestVolumes(cloudstackTestCase):
type='DATADISK'
)
for vol in list_volume_response:
- if vol.id == self.volume.id and vol.size == 3221225472L:
+ if vol.id == self.volume.id and vol.size == 3221225472L and vol.state == 'Ready':
success = True
if success:
break
@@ -649,10 +659,10 @@ class TestVolumes(cloudstackTestCase):
"Check if the volume resized appropriately"
)
- self.virtual_machine.detach_volume(self.apiClient, self.volume)
- self.cleanup.append(self.volume)
+ if self.services['hypervisor'].lower() == "xenserver":
+ self.virtual_machine.start(self.apiClient)
- @attr(tags = ["advanced", "advancedns", "smoke"])
+ @attr(tags = ["advanced", "advancedns", "smoke","basic"])
def test_09_delete_detached_volume(self):
"""Delete a Volume unattached to an VM
"""
@@ -665,13 +675,23 @@ class TestVolumes(cloudstackTestCase):
self.debug("Delete Volume ID: %s" % self.volume.id)
+ self.volume_1 = Volume.create(
+ self.api_client,
+ self.services,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
+
+ self.virtual_machine.attach_volume(self.apiClient, self.volume_1)
+ self.virtual_machine.detach_volume(self.apiClient, self.volume_1)
+
cmd = deleteVolume.deleteVolumeCmd()
- cmd.id = self.volume.id
+ cmd.id = self.volume_1.id
self.apiClient.deleteVolume(cmd)
list_volume_response = list_volumes(
self.apiClient,
- id=self.volume.id,
+ id=self.volume_1.id,
type='DATADISK'
)
self.assertEqual(
[17/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2554: CloudStack fails to load XCP 1.6 hypervisors
Missing default constructor fails the agent manager reloading the XCP
resource on reboot of management server. This is fixed by using the
default constructor as do other Xen resources and include a new resource
ala XenServers for XCP1.6.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/806aeb99
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/806aeb99
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/806aeb99
Branch: refs/heads/pvlan
Commit: 806aeb990d28179ff532e97dbf64f87cd3d5ca34
Parents: 239bb13
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Sat May 18 11:46:12 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun May 19 18:34:26 2013 +0530
----------------------------------------------------------------------
.../xen/discoverer/XcpServerDiscoverer.java | 109 ++++++++++---------
.../hypervisor/xen/resource/CitrixHelper.java | 4 +-
.../xen/resource/XcpServer16Resource.java | 32 ++++++
.../xen/resource/XcpServerResource.java | 45 +++-----
4 files changed, 107 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/806aeb99/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 562a7fe..f0121e7 100755
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@ -16,24 +16,6 @@
// under the License.
package com.cloud.hypervisor.xen.discoverer;
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Set;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import javax.persistence.EntityExistsException;
-
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener;
import com.cloud.agent.api.AgentControlAnswer;
@@ -65,6 +47,7 @@ import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
import com.cloud.hypervisor.xen.resource.XcpOssResource;
+import com.cloud.hypervisor.xen.resource.XcpServer16Resource;
import com.cloud.hypervisor.xen.resource.XcpServerResource;
import com.cloud.hypervisor.xen.resource.XenServer56FP1Resource;
import com.cloud.hypervisor.xen.resource.XenServer56Resource;
@@ -79,9 +62,9 @@ import com.cloud.resource.ResourceManager;
import com.cloud.resource.ResourceStateAdapter;
import com.cloud.resource.ServerResource;
import com.cloud.resource.UnableDeleteHostException;
-import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
+import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplateHostDao;
import com.cloud.user.Account;
@@ -97,6 +80,22 @@ import com.xensource.xenapi.Pool;
import com.xensource.xenapi.Session;
import com.xensource.xenapi.Types.SessionAuthenticationFailed;
import com.xensource.xenapi.Types.XenAPIException;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+import javax.persistence.EntityExistsException;
+import java.net.InetAddress;
+import java.net.URI;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Queue;
+import java.util.Set;
@Local(value=Discoverer.class)
public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
@@ -420,6 +419,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
} else {
prodBrand = prodBrand.trim();
}
+
String prodVersion = record.softwareVersion.get("product_version");
if (prodVersion == null) {
prodVersion = record.softwareVersion.get("platform_version").trim();
@@ -427,36 +427,35 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
prodVersion = prodVersion.trim();
}
- if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
- return new XcpServerResource("1.1");
+ // Xen Cloud Platform group of hypervisors
+ if (prodBrand.equals("XCP") && (
+ prodVersion.equals("1.0.0")
+ || prodVersion.equals("1.1.0")
+ || prodVersion.equals("5.6.100")
+ || prodVersion.startsWith("1.4")
+ )) {
+ return new XcpServerResource();
} else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
- return new XcpServerResource("1.6");
- }
-
- if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
- return new XenServer56Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
- return new XenServer600Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
- return new XenServer602Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
+ return new XcpServer16Resource();
+ } // Citrix Xenserver group of hypervisors
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
+ return new XenServer56Resource();
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
+ return new XenServer600Resource();
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
+ return new XenServer602Resource();
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
return new XenServer610Resource();
-
- if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
- String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
- if("5.6 SP2".equals(prodVersionTextShort)) {
- return new XenServer56SP2Resource();
- } else if("5.6 FP1".equals(prodVersionTextShort)) {
- return new XenServer56FP1Resource();
- }
- }
-
- if (prodBrand.equals("XCP_Kronos")) {
- return new XcpOssResource();
- }
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
+ String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
+ if ("5.6 SP2".equals(prodVersionTextShort)) {
+ return new XenServer56SP2Resource();
+ } else if ("5.6 FP1".equals(prodVersionTextShort)) {
+ return new XenServer56FP1Resource();
+ }
+ } else if (prodBrand.equals("XCP_Kronos")) {
+ return new XcpOssResource();
+ }
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion;
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
@@ -585,10 +584,12 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
Map<String, String> details = startup.getHostDetails();
String prodBrand = details.get("product_brand").trim();
String prodVersion = details.get("product_version").trim();
-
- if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6"))) {
+
+ if (prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
resource = XcpServerResource.class.getName();
- } else if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) {
+ } else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
+ resource = XcpServer16Resource.class.getName();
+ } else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) {
resource = XenServer56Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0")) {
resource = XenServer600Resource.class.getName();
@@ -596,15 +597,15 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
resource = XenServer602Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) {
resource = XenServer610Resource.class.getName();
- } else if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
+ } else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
String prodVersionTextShort = details.get("product_version_text_short").trim();
- if("5.6 SP2".equals(prodVersionTextShort)) {
+ if ("5.6 SP2".equals(prodVersionTextShort)) {
resource = XenServer56SP2Resource.class.getName();
- } else if("5.6 FP1".equals(prodVersionTextShort)) {
+ } else if ("5.6 FP1".equals(prodVersionTextShort)) {
resource = XenServer56FP1Resource.class.getName();
}
} else if (prodBrand.equals("XCP_Kronos")) {
- resource = XcpOssResource.class.getName();
+ resource = XcpOssResource.class.getName();
}
if( resource == null ){
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/806aeb99/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
index 34b8f29..0f71c7b 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixHelper.java
@@ -16,11 +16,11 @@
// under the License.
package com.cloud.hypervisor.xen.resource;
+import org.apache.log4j.Logger;
+
import java.util.ArrayList;
import java.util.HashMap;
-import org.apache.log4j.Logger;
-
/**
* Reduce bloat inside CitrixResourceBase
*
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/806aeb99/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
new file mode 100644
index 0000000..8cb7997
--- /dev/null
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServer16Resource.java
@@ -0,0 +1,32 @@
+/*
+ * 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 com.cloud.hypervisor.xen.resource;
+
+public class XcpServer16Resource extends XcpServerResource {
+
+ public XcpServer16Resource() {
+ super();
+ }
+
+ @Override
+ protected String getGuestOsType(String stdType, boolean bootFromCD) {
+ return CitrixHelper.getXcp160GuestOsType(stdType);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/806aeb99/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index 6baf6a0..77dcb8f 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -16,15 +16,6 @@
// under the License.
package com.cloud.hypervisor.xen.resource;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ejb.Local;
-
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.NetworkUsageAnswer;
@@ -33,18 +24,25 @@ import com.cloud.resource.ServerResource;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.VM;
import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VM;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
+import javax.ejb.Local;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
@Local(value=ServerResource.class)
public class XcpServerResource extends CitrixResourceBase {
- private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
- private String version;
- public XcpServerResource(String version) {
+ private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
+ private String version;
+
+ public XcpServerResource() {
super();
- this.version = version;
}
-
+
@Override
public Answer executeRequest(Command cmd) {
if (cmd instanceof NetworkUsageCommand) {
@@ -53,15 +51,6 @@ public class XcpServerResource extends CitrixResourceBase {
return super.executeRequest(cmd);
}
}
-
- @Override
- protected String getGuestOsType(String stdType, boolean bootFromCD) {
- if (version.equalsIgnoreCase("1.6")) {
- return CitrixHelper.getXcp160GuestOsType(stdType);
- } else {
- return CitrixHelper.getXcpGuestOsType(stdType);
- }
- }
@Override
protected List<File> getPatchFiles() {
@@ -77,6 +66,11 @@ public class XcpServerResource extends CitrixResourceBase {
}
@Override
+ protected String getGuestOsType(String stdType, boolean bootFromCD) {
+ return CitrixHelper.getXcpGuestOsType(stdType);
+ }
+
+ @Override
protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException {
vm.setMemoryStaticMin(conn, 33554432L);
@@ -90,7 +84,6 @@ public class XcpServerResource extends CitrixResourceBase {
//vm.setMemoryStaticMin(conn, maxMemsize );
}
-
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
try {
Connection conn = getConnection();
@@ -107,6 +100,4 @@ public class XcpServerResource extends CitrixResourceBase {
return new NetworkUsageAnswer(cmd, ex);
}
}
-
-
}
[02/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2552. Modify AWSAPI to decrypt db values using the decrypted database_key and not management_server_key
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/046580fc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/046580fc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/046580fc
Branch: refs/heads/pvlan
Commit: 046580fcf117aadf77179011ecfb5dfffdcca65f
Parents: adbebc1
Author: Likitha Shetty <li...@citrix.com>
Authored: Fri May 17 13:12:36 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Fri May 17 13:16:04 2013 +0530
----------------------------------------------------------------------
.../cloud/bridge/persist/dao/CloudStackUserDaoImpl.java | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/046580fc/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java b/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
index f108a20..5aac396 100644
--- a/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
+++ b/awsapi/src/com/cloud/bridge/persist/dao/CloudStackUserDaoImpl.java
@@ -19,15 +19,14 @@ package com.cloud.bridge.persist.dao;
import javax.ejb.Local;
import org.apache.log4j.Logger;
-import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.springframework.stereotype.Component;
import com.cloud.bridge.model.CloudStackUserVO;
-import com.cloud.bridge.util.EncryptionSecretKeyCheckerUtil;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.Transaction;
+import com.cloud.utils.crypt.DBEncryptionUtil;
@Component
@Local(value={CloudStackUserDao.class})
@@ -51,13 +50,8 @@ public class CloudStackUserDaoImpl extends GenericDaoBase<CloudStackUserVO, Stri
sc.setParameters("apiKey", accessKey);
user = findOneBy(sc);
if ( user != null && user.getSecretKey() != null) {
- // if the cloud db is encrypted, decrypt the secret_key returned by cloud db before signature generation
- if( EncryptionSecretKeyCheckerUtil.useEncryption() ) {
- StandardPBEStringEncryptor encryptor = EncryptionSecretKeyCheckerUtil.getEncryptor();
- cloudSecretKey = encryptor.decrypt( user.getSecretKey() );
- } else {
- cloudSecretKey = user.getSecretKey();
- }
+ // User secret key could be encrypted
+ cloudSecretKey = DBEncryptionUtil.decrypt(user.getSecretKey());
}
return cloudSecretKey;
} finally {
[36/50] [abbrv] Fix all occurrences of account.account
Posted by ya...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vm_life_cycle.py b/test/integration/component/test_vpc_vm_life_cycle.py
index 13726c5..7658beb 100644
--- a/test/integration/component/test_vpc_vm_life_cycle.py
+++ b/test/integration/component/test_vpc_vm_life_cycle.py
@@ -237,7 +237,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -253,7 +253,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -272,7 +272,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -283,7 +283,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -292,7 +292,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -300,7 +300,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_2.id)]
)
@@ -309,7 +309,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -320,7 +320,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
@@ -328,7 +328,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -516,7 +516,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -966,7 +966,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -982,7 +982,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -1006,7 +1006,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.shared_nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -1017,7 +1017,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id),
str(cls.network_2.id)]
@@ -1027,7 +1027,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id),
str(cls.network_2.id)]
@@ -1036,7 +1036,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id),
str(cls.network_2.id)]
@@ -1045,7 +1045,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -1056,7 +1056,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2, cls.vm_3])
@@ -1064,7 +1064,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -1242,7 +1242,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1368,7 +1368,7 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1773,7 +1773,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -1789,7 +1789,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -1809,7 +1809,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -1965,7 +1965,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network_1.id),
str(self.network_2.id)]
@@ -1990,7 +1990,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_1.id,
listall=True
)
@@ -2033,7 +2033,7 @@ class TestVMLifeCycleBothIsolated(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network_1.id)]
)
@@ -2111,7 +2111,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -2127,7 +2127,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -2146,7 +2146,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -2157,7 +2157,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -2166,7 +2166,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -2174,7 +2174,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_2.id)]
)
@@ -2183,7 +2183,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -2194,7 +2194,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
@@ -2202,7 +2202,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -2405,7 +2405,7 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -2868,7 +2868,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -2884,7 +2884,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -2903,7 +2903,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -2914,7 +2914,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_1.id)]
)
@@ -2923,7 +2923,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_1.id)]
)
@@ -2931,7 +2931,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_2.id,
networkids=[str(cls.network_2.id)]
)
@@ -2940,7 +2940,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -2951,7 +2951,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
@@ -2959,7 +2959,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -3057,7 +3057,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_1.id,
listall=True
)
@@ -3072,7 +3072,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_2.id,
listall=True
)
@@ -3204,7 +3204,7 @@ class TestVMLifeCycleDiffHosts(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_vms_deployment.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_vms_deployment.py b/test/integration/component/test_vpc_vms_deployment.py
index 506ae34..c49ef45 100644
--- a/test/integration/component/test_vpc_vms_deployment.py
+++ b/test/integration/component/test_vpc_vms_deployment.py
@@ -320,7 +320,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -339,7 +339,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -363,7 +363,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -378,7 +378,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.3.1',
@@ -392,7 +392,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -404,7 +404,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -415,7 +415,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_3.id)]
)
@@ -425,7 +425,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -468,7 +468,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
state="Running",
listall=True
)
@@ -535,7 +535,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -554,7 +554,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -578,7 +578,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -593,7 +593,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.3.1',
@@ -607,7 +607,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -619,7 +619,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -630,7 +630,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_3.id)]
)
@@ -640,7 +640,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -720,7 +720,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
state="Running",
listall=True
)
@@ -788,7 +788,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -807,7 +807,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -831,7 +831,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -846,7 +846,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.3.1',
@@ -860,7 +860,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -872,7 +872,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -883,7 +883,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_3.id)]
)
@@ -893,7 +893,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -965,7 +965,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.4.1',
@@ -978,7 +978,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_4.id)]
)
@@ -989,7 +989,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
state="Running",
listall=True
)
@@ -1057,7 +1057,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1076,7 +1076,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1100,7 +1100,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -1115,7 +1115,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.3.1',
@@ -1129,7 +1129,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1141,7 +1141,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1152,7 +1152,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_3.id)]
)
@@ -1162,7 +1162,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1236,7 +1236,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.4.1',
@@ -1249,7 +1249,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_4.id)]
)
@@ -1283,7 +1283,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
state="Running",
listall=True
)
@@ -1337,7 +1337,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1360,7 +1360,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.0.1',
@@ -1399,7 +1399,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1417,7 +1417,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1436,7 +1436,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1453,7 +1453,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -1512,7 +1512,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1531,7 +1531,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1555,7 +1555,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -1569,7 +1569,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1578,7 +1578,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1590,7 +1590,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1599,7 +1599,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1609,7 +1609,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1650,7 +1650,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
listall=True
)
@@ -1685,7 +1685,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
listall=True
)
@@ -1704,7 +1704,7 @@ class TestVMDeployVPC(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1777,7 +1777,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1796,7 +1796,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1820,7 +1820,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -1834,7 +1834,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1843,7 +1843,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1855,7 +1855,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1864,7 +1864,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1874,7 +1874,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1895,7 +1895,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1927,7 +1927,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1956,7 +1956,7 @@ class TestVMDeployVPC(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -1974,7 +1974,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -1993,7 +1993,7 @@ class TestVMDeployVPC(cloudstackTestCase):
accountid=self.account.name,
networkid=network_2.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (
@@ -2066,7 +2066,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -2098,7 +2098,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -2127,7 +2127,7 @@ class TestVMDeployVPC(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -2145,7 +2145,7 @@ class TestVMDeployVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -2164,7 +2164,7 @@ class TestVMDeployVPC(cloudstackTestCase):
accountid=self.account.name,
networkid=network_2.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (
@@ -2339,7 +2339,7 @@ class TestVMDeployVPC(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
listall=True
)
@@ -2447,7 +2447,7 @@ class TestVMDeployVPC(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
networks,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpn_users.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpn_users.py b/test/integration/component/test_vpn_users.py
index 8f08fa0..fe020d0 100644
--- a/test/integration/component/test_vpn_users.py
+++ b/test/integration/component/test_vpn_users.py
@@ -396,7 +396,7 @@ class TestVPNUsers(cloudstackTestCase):
DomainName=self.account.domain)
self.debug("Adding new user to VPN as a global admin: %s" %
- admin.account.name)
+ admin.name)
try:
self.create_VPN_Users(api_client=api_client)
except Exception as e:
@@ -438,7 +438,7 @@ class TestVPNUsers(cloudstackTestCase):
DomainName=self.account.domain)
self.debug("Adding new user to VPN as a domain admin: %s" %
- admin.account.name)
+ admin.name)
try:
self.create_VPN_Users(api_client=api_client)
except Exception as e:
[42/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-747: internalLb in VPC - UI - create network offering - system offering dropdown is for router only. Change its variable name to be more intuitive.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cf6045f1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cf6045f1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cf6045f1
Branch: refs/heads/pvlan
Commit: cf6045f1aa37674f0225144ae0a1f662f955f153
Parents: 0365d55
Author: Jessica Wang <je...@apache.org>
Authored: Mon May 20 13:40:37 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon May 20 13:41:02 2013 -0700
----------------------------------------------------------------------
ui/scripts/configuration.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf6045f1/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 9a08c4c..e3421a3 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -1122,7 +1122,7 @@
title: 'label.add.network.offering',
preFilter: function(args) {
var $availability = args.$form.find('.form-item[rel=availability]');
- var $serviceOfferingId = args.$form.find('.form-item[rel=serviceOfferingId]');
+ var $systemOfferingForRouter = args.$form.find('.form-item[rel=systemOfferingForRouter]');
var $conservemode = args.$form.find('.form-item[rel=conservemode]');
var $serviceSourceNatRedundantRouterCapabilityCheckbox = args.$form.find('.form-item[rel="service.SourceNat.redundantRouterCapabilityCheckbox"]');
var hasAdvancedZones = false;
@@ -1185,10 +1185,10 @@
}
});
if(havingVirtualRouterForAtLeastOneService == true) {
- $serviceOfferingId.css('display', 'inline-block');
+ $systemOfferingForRouter.css('display', 'inline-block');
}
else {
- $serviceOfferingId.hide();
+ $systemOfferingForRouter.hide();
}
@@ -1569,8 +1569,8 @@
},
//show or hide upon checked services and selected providers above (begin)
- serviceOfferingId: {
- label: 'label.system.offering',
+ systemOfferingForRouter: {
+ label: 'System Offering for Router',
docID: 'helpNetworkOfferingSystemOffering',
select: function(args) {
$.ajax({
@@ -1829,8 +1829,8 @@
if(args.$form.find('.form-item[rel=availability]').css("display") == "none")
inputData['availability'] = 'Optional';
- if(args.$form.find('.form-item[rel=serviceOfferingId]').css("display") == "none")
- delete inputData.serviceOfferingId;
+ if(args.$form.find('.form-item[rel=systemOfferingForRouter]').css("display") == "none")
+ delete inputData.systemOfferingForRouter;
inputData['traffictype'] = 'GUEST'; //traffic type dropdown has been removed since it has only one option ('Guest'). Hardcode traffic type value here.
[33/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-652: meging 'portable public ip' feature
Squashed commit of the following:
commit f244f9ce7982db16984dd87c31545f1c0240c704
Merge: 993cbb0 f5c8e38
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 20 18:54:05 2013 +0530
Merge branch 'master' into portablepublicip
Conflicts:
server/src/com/cloud/server/ManagementServerImpl.java
server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
commit 993cbb0df9fa6e64b96b18ed775b73cdf4a8f5d7
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 20 18:49:54 2013 +0530
introduce 'transferPortableIP' interface method in network manger. This
method will transfer association of portable ip from one network to
another network.
commit 0c1c2652c1b39e9a81ca35464360e11ed9ef23f1
Merge: a718d35 a29e393
Author: Murali Reddy <mu...@gmail.com>
Date: Fri May 17 02:48:54 2013 +0530
Merge branch 'master' into portablepublicip
Conflicts:
utils/src/com/cloud/utils/net/NetUtils.java
commit a718d353f7acf0328d928673df6f22de1abc0acb
Merge: ecca117 c211818
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 13 21:22:19 2013 +0530
Merge branch 'master' into portablepublicip
Conflicts:
api/src/org/apache/cloudstack/api/ResponseGenerator.java
server/src/com/cloud/api/ApiResponseHelper.java
server/src/com/cloud/network/NetworkServiceImpl.java
server/src/com/cloud/network/addr/PublicIp.java
server/src/com/cloud/server/ManagementServerImpl.java
server/test/com/cloud/network/MockNetworkManagerImpl.java
server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
server/test/com/cloud/vpc/MockNetworkManagerImpl.java
setup/db/db/schema-410to420.sql
commit ecca117e345224059297f5c1ffa0f442209b3160
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 13 20:05:29 2013 +0530
added integration tests for testing portable ip ranges
commit 895a27c2771dbb497ecc6fe0d212589f012a48d8
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 13 15:12:19 2013 +0530
- establish model for transferring portable IP association from a network
with which it is associated to another network.
- enabling static nat api, extended to transfer potrtable IP across the
networks if the VM/network is different from the current associate
network of the portable ip
commit 51509751b290c0e51cbdd104a9aebff189cbe806
Author: Murali Reddy <mu...@gmail.com>
Date: Mon May 13 12:05:33 2013 +0530
seperate out associate/disassociate with guest network operations from
alloc and release of portable ip
commit bd058f58c2d8d36ec25e31ed9de4cd414e0ca051
Author: Murali Reddy <mu...@gmail.com>
Date: Sun May 12 21:14:48 2013 +0530
enhance disasociateIPAddr API to release protable IP associated with a
guest network or VPC
commit 27504d9098729e8c3ac3b33f053f2d66ac2c4401
Author: Murali Reddy <mu...@gmail.com>
Date: Sun May 12 16:53:45 2013 +0530
enhance asociateIPAddr API to acquire a protable IP and associate with a
guest network or VPC
commit f82c6a8431647114462665c1306c6215cb92afd3
Merge: 3dbfb44 0749013
Author: Murali Reddy <mu...@gmail.com>
Date: Sat May 11 23:32:13 2013 +0530
Merge branch 'master' into portablepublicip
Conflicts:
api/src/com/cloud/network/IpAddress.java
api/src/org/apache/cloudstack/api/ResponseGenerator.java
client/tomcatconf/commands.properties.in
server/src/com/cloud/api/ApiResponseHelper.java
server/src/com/cloud/configuration/ConfigurationManagerImpl.java
server/src/com/cloud/server/ManagementServerImpl.java
server/test/org/apache/cloudstack/affinity/AffinityApiTestConfiguration.java
server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
setup/db/db/schema-410to420.sql
commit 3dbfb44eb5b888367375a96b8ae0ac9cf54309a6
Author: Murali Reddy <mu...@gmail.com>
Date: Sat May 11 20:33:19 2013 +0530
- add 'portable' boolean as property of IpAddress, persist the property in
IPAddressVO, return the property in IpAddressResponse
- add ability to request portable IP in associateIpAddress api
commit bf3cb274cfeb1ef41c63794ced83c7c6940f34cc
Author: Murali Reddy <mu...@gmail.com>
Date: Sat May 11 16:08:40 2013 +0530
add the status of each portable IP (its state, details of associated data
center/VPC/guest network etc) in the PortableIpRangeResponse returned by
listPortableIpRanges API
commit e7b2fb22557cb4ef0ce9c8dde3ed1b9c857038bf
Author: Murali Reddy <mu...@gmail.com>
Date: Sat May 11 14:36:01 2013 +0530
Introdcues notion of 'portable IP' pool at region level.
Introduces root admin only API's to provision portable ip to a region
- createPortableIpRange
- deletePortableIpRange
- listPortableIpRanges
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d6452be8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d6452be8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d6452be8
Branch: refs/heads/pvlan
Commit: d6452be8618198454c6f20f4210f6ac18ce9b11d
Parents: f5c8e38
Author: Murali Reddy <mu...@gmail.com>
Authored: Mon May 20 20:05:47 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Mon May 20 20:05:47 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/async/AsyncJob.java | 1 +
.../configuration/ConfigurationService.java | 13 +
api/src/com/cloud/event/EventTypes.java | 5 +
api/src/com/cloud/network/IpAddress.java | 4 +-
api/src/com/cloud/network/NetworkService.java | 5 +
.../org/apache/cloudstack/api/ApiConstants.java | 2 +
.../cloudstack/api/ResponseGenerator.java | 9 +-
.../admin/region/CreatePortableIpRangeCmd.java | 156 +++++++++++
.../admin/region/DeletePortableIpRangeCmd.java | 93 +++++++
.../admin/region/ListPortableIpRangesCmd.java | 109 ++++++++
.../user/address/AssociateIPAddrCmd.java | 28 +-
.../user/address/DisassociateIPAddrCmd.java | 12 +-
.../command/user/nat/EnableStaticNatCmd.java | 6 +
.../api/response/IPAddressResponse.java | 7 +
.../api/response/PortableIpRangeResponse.java | 93 +++++++
.../api/response/PortableIpResponse.java | 106 ++++++++
.../apache/cloudstack/region/PortableIp.java | 58 ++++
.../cloudstack/region/PortableIpRange.java | 38 +++
client/tomcatconf/applicationContext.xml.in | 2 +
client/tomcatconf/commands.properties.in | 6 +
.../src/com/cloud/network/dao/IPAddressVO.java | 24 ++
server/src/com/cloud/api/ApiResponseHelper.java | 70 ++++-
.../configuration/ConfigurationManagerImpl.java | 165 +++++++++++-
.../src/com/cloud/network/NetworkManager.java | 14 +
.../com/cloud/network/NetworkManagerImpl.java | 262 ++++++++++++++++++-
.../com/cloud/network/NetworkServiceImpl.java | 105 +++++---
server/src/com/cloud/network/addr/PublicIp.java | 9 +
.../cloud/network/rules/RulesManagerImpl.java | 43 +++
.../com/cloud/server/ManagementServerImpl.java | 86 +++++-
.../apache/cloudstack/region/PortableIpDao.java | 39 +++
.../cloudstack/region/PortableIpDaoImpl.java | 131 ++++++++++
.../cloudstack/region/PortableIpRangeDao.java | 30 +++
.../region/PortableIpRangeDaoImpl.java | 65 +++++
.../cloudstack/region/PortableIpRangeVO.java | 119 +++++++++
.../apache/cloudstack/region/PortableIpVO.java | 222 ++++++++++++++++
.../cloud/network/MockNetworkManagerImpl.java | 40 ++-
.../cloud/vpc/MockConfigurationManagerImpl.java | 58 ++++
.../com/cloud/vpc/MockNetworkManagerImpl.java | 41 ++-
.../networkoffering/ChildTestConfiguration.java | 7 +
setup/db/db/schema-410to420.sql | 37 +++
.../integration/smoke/test_portable_publicip.py | 237 +++++++++++++++++
tools/marvin/marvin/integration/lib/base.py | 36 +++
utils/src/com/cloud/utils/net/NetUtils.java | 13 +
43 files changed, 2542 insertions(+), 64 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/com/cloud/async/AsyncJob.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/async/AsyncJob.java b/api/src/com/cloud/async/AsyncJob.java
index ccdc406..47f9b57 100644
--- a/api/src/com/cloud/async/AsyncJob.java
+++ b/api/src/com/cloud/async/AsyncJob.java
@@ -35,6 +35,7 @@ public interface AsyncJob extends Identity, InternalIdentity {
Host,
StoragePool,
IpAddress,
+ PortableIpAddress,
SecurityGroup,
PhysicalNetwork,
TrafficType,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/com/cloud/configuration/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index fdbd9d6..381fcad 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -39,6 +39,9 @@ import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+import org.apache.cloudstack.api.command.admin.region.CreatePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.DeletePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.ListPortableIpRangesCmd;
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
@@ -56,6 +59,8 @@ import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
public interface ConfigurationService {
@@ -278,4 +283,12 @@ public interface ConfigurationService {
* @return
*/
boolean isOfferingForVpc(NetworkOffering offering);
+
+ PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException;
+
+ boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd);
+
+ List<? extends PortableIpRange> listPortableIpRanges(ListPortableIpRangesCmd cmd);
+
+ List<? extends PortableIp> listPortableIps(long id);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 9c83f13..fcac8e8 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -102,6 +102,8 @@ public class EventTypes {
// Network Events
public static final String EVENT_NET_IP_ASSIGN = "NET.IPASSIGN";
public static final String EVENT_NET_IP_RELEASE = "NET.IPRELEASE";
+ public static final String EVENT_PORTABLE_IP_ASSIGN = "PORTABLE.IPASSIGN";
+ public static final String EVENT_PORTABLE_IP_RELEASE = "PORTABLEIPRELEASE";
public static final String EVENT_NET_RULE_ADD = "NET.RULEADD";
public static final String EVENT_NET_RULE_DELETE = "NET.RULEDELETE";
public static final String EVENT_NET_RULE_MODIFY = "NET.RULEMODIFY";
@@ -432,6 +434,9 @@ public class EventTypes {
public static final String EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE = "GUESTVLANRANGE.RELEASE";
+ public static final String EVENT_PORTABLE_IP_RANGE_CREATE = "PORTABLE.IP.RANGE.CREATE";
+ public static final String EVENT_PORTABLE_IP_RANGE_DELETE = "PORTABLE.IP.RANGE.DELETE";
+
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/com/cloud/network/IpAddress.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java
index c48e8b9..de11a6d 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -81,7 +81,9 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
Long getVpcId();
String getVmIp();
-
+
+ boolean isPortable();
+
Long getNetworkId();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/com/cloud/network/NetworkService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index 2e50c53..59702a2 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -52,6 +52,11 @@ public interface NetworkService {
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
+ IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
+ InsufficientAddressCapacityException, ConcurrentOperationException;
+
+ boolean releasePortableIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
+
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException,
ResourceAllocationException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index cf093bf..1e9435f 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -114,6 +114,7 @@ public class ApiConstants {
public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
public static final String IS_EXTRACTABLE = "isextractable";
public static final String IS_FEATURED = "isfeatured";
+ public static final String IS_PORTABLE = "isportable";
public static final String IS_PUBLIC = "ispublic";
public static final String IS_PERSISTENT = "ispersistent";
public static final String IS_READY = "isready";
@@ -158,6 +159,7 @@ public class ApiConstants {
public static final String POLICY_ID = "policyid";
public static final String PORT = "port";
public static final String PORTAL = "portal";
+ public static final String PORTABLE_IP_ADDRESS = "portableipaddress";
public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
public static final String PRIVATE_INTERFACE = "privateinterface";
public static final String PRIVATE_IP = "privateip";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/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 10bf305..0732e77 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -119,6 +119,8 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.usage.Usage;
import com.cloud.async.AsyncJob;
@@ -441,7 +443,12 @@ public interface ResponseGenerator {
Long getAffinityGroupId(String name, long entityOwnerId);
+ PortableIpRangeResponse createPortableIPRangeResponse(PortableIpRange range);
+
+ PortableIpResponse createPortableIPResponse(PortableIp portableIp);
+
InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
-
+
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
new file mode 100644
index 0000000..78e4c94
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/CreatePortableIpRangeCmd.java
@@ -0,0 +1,156 @@
+// 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.command.admin.region;
+
+import javax.inject.Inject;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.dc.Vlan;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.region.PortableIpRange;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "createPortableIpRange", responseObject=PortableIpRangeResponse.class, description="adds a range of portable public IP's to a region", since="4.2.0")
+public class CreatePortableIpRangeCmd extends BaseAsyncCreateCmd {
+
+ public static final Logger s_logger = Logger.getLogger(CreatePortableIpRangeCmd.class.getName());
+
+ private static final String s_name = "createportableiprangeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, entityType = RegionResponse.class, required=true, description="Id of the Region")
+ private Integer regionId;
+
+ @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the portable IP range")
+ private String startIp;
+
+ @Parameter(name=ApiConstants.END_IP, type=CommandType.STRING, required=true, description="the ending IP address in the portable IP range")
+ private String endIp;
+
+ @Parameter(name=ApiConstants.GATEWAY, type=CommandType.STRING, required=true, description="the gateway for the portable IP range")
+ private String gateway;
+
+ @Parameter(name=ApiConstants.NETMASK, type=CommandType.STRING, required=true, description="the netmask of the portable IP range")
+ private String netmask;
+
+ @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="VLAN id, if not specified defaulted to untagged")
+ private String vlan;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
+ public String getStartIp() {
+ return startIp;
+ }
+
+ public String getEndIp() {
+ return endIp;
+ }
+
+ public String getVlan() {
+ return vlan;
+ }
+
+ public String getGateway() {
+ return gateway;
+ }
+
+ public String getNetmask() {
+ return netmask;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ PortableIpRange portableIpRange = _entityMgr.findById(PortableIpRange.class, getEntityId());
+ PortableIpRangeResponse response = null;
+ if (portableIpRange != null) {
+ response = _responseGenerator.createPortableIPRangeResponse(portableIpRange);
+ }
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ try {
+ PortableIpRange portableIpRange = _configService.createPortableIpRange(this);
+ if (portableIpRange != null) {
+ this.setEntityId(portableIpRange.getId());
+ this.setEntityUuid(portableIpRange.getUuid());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create portable public IP range");
+ }
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PORTABLE_IP_RANGE_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating a portable public ip range in region: " + getRegionId();
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PortableIpAddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
new file mode 100644
index 0000000..856e8ef
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/DeletePortableIpRangeCmd.java
@@ -0,0 +1,93 @@
+// 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.command.admin.region;
+
+import javax.inject.Inject;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "deletePortableIpRange", description="deletes a range of portable public IP's associated with a region", responseObject=SuccessResponse.class)
+public class DeletePortableIpRangeCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeletePortableIpRangeCmd.class.getName());
+
+ private static final String s_name = "deleteportablepublicipresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, required=true, entityType = PortableIpRangeResponse.class, description="Id of the portable ip range")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _configService.deletePortableIpRange(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete portable ip range");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_PORTABLE_IP_RANGE_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "deleting a portable public ip range";
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.PortableIpAddress;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
new file mode 100644
index 0000000..75bcce0
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/ListPortableIpRangesCmd.java
@@ -0,0 +1,109 @@
+// 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.command.admin.region;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+import org.apache.cloudstack.api.response.PortableIpResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@APICommand(name = "listPortableIpRanges", description="list portable IP ranges", responseObject=PortableIpRangeResponse.class)
+public class ListPortableIpRangesCmd extends BaseListCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ListPortableIpRangesCmd.class.getName());
+
+ private static final String s_name = "listportableipresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, required=false, description="Id of a Region")
+ private Integer regionId;
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, required=false, entityType = PortableIpRangeResponse.class, description="Id of the portable ip range")
+ private Long id;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getRegionIdId() {
+ return regionId;
+ }
+
+ public Long getPortableIpRangeId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ ListResponse<PortableIpRangeResponse> response = new ListResponse<PortableIpRangeResponse>();
+ List<PortableIpRangeResponse> responses = new ArrayList<PortableIpRangeResponse>();
+ List<? extends PortableIpRange> portableIpRanges = new ArrayList<PortableIpRange>();
+
+ portableIpRanges = _configService.listPortableIpRanges(this);
+ if (portableIpRanges != null && !portableIpRanges.isEmpty()) {
+ for (PortableIpRange range : portableIpRanges) {
+ PortableIpRangeResponse rangeResponse = _responseGenerator.createPortableIPRangeResponse(range);
+
+ List<? extends PortableIp> portableIps = _configService.listPortableIps(range.getId());
+ if (portableIps != null && !portableIps.isEmpty()) {
+ List<PortableIpResponse> portableIpResponses = new ArrayList<PortableIpResponse>();
+ for (PortableIp portableIP: portableIps) {
+ PortableIpResponse portableIpresponse = _responseGenerator.createPortableIPResponse(portableIP);
+ portableIpResponses.add(portableIpresponse);
+ }
+ rangeResponse.setPortableIpResponses(portableIpResponses);
+ }
+
+ rangeResponse.setObjectName("portableiprange");
+ responses.add(rangeResponse);
+ }
+ }
+ response.setResponses(responses, portableIpRanges.size());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 28fbae4..f37e820 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@ -66,6 +66,14 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
"be associated with")
private Long vpcId;
+ @Parameter(name=ApiConstants.IS_PORTABLE, type = BaseCmd.CommandType.BOOLEAN, description = "should be set to true " +
+ "if public IP is required to be transferable across zones, if not specified defaults to false")
+ private Boolean isPortable;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, entityType = RegionResponse.class,
+ required=false, description="region ID from where portable ip is to be associated.")
+ private Integer regionId;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -107,6 +115,18 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
return vpcId;
}
+ public boolean isPortable() {
+ if (isPortable == null) {
+ return false;
+ } else {
+ return isPortable;
+ }
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
public Long getNetworkId() {
if (vpcId != null) {
return null;
@@ -196,7 +216,13 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException{
try {
- IpAddress ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
+ IpAddress ip = null;
+
+ if (!isPortable()) {
+ ip = _networkService.allocateIP(_accountService.getAccount(getEntityOwnerId()), getZoneId(), getNetworkId());
+ } else {
+ ip = _networkService.allocatePortableIP(_accountService.getAccount(getEntityOwnerId()), 1, getZoneId(), getNetworkId(), getVpcId());
+ }
if (ip != null) {
this.setEntityId(ip.getId());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index 8271119..8f78fe3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@ -74,7 +74,12 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
@Override
public void execute() throws InsufficientAddressCapacityException{
UserContext.current().setEventDetails("Ip Id: " + getIpAddressId());
- boolean result = _networkService.releaseIpAddress(getIpAddressId());
+ boolean result = false;
+ if (!isPortable(id)) {
+ _networkService.releaseIpAddress(getIpAddressId());
+ } else {
+ _networkService.releaseIpAddress(getIpAddressId());
+ }
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
@@ -139,4 +144,9 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
public Long getInstanceId() {
return getIpAddressId();
}
+
+ private boolean isPortable(long id) {
+ IpAddress ip = getIpAddress(id);
+ return ip.isPortable();
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index 902dbae..2e2e150 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -91,6 +91,12 @@ public class EnableStaticNatCmd extends BaseCmd{
} else {
ntwkId = networkId;
}
+
+ // in case of portable public IP, network ID passed takes precedence
+ if (ip.isPortable() && networkId != null ) {
+ ntwkId = networkId;
+ }
+
if (ntwkId == null) {
throw new InvalidParameterValueException("Unable to enable static nat for the ipAddress id=" + ipAddressId +
" as ip is not associated with any network and no networkId is passed in");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
index cede84f..e3d5cc6 100644
--- a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java
@@ -115,6 +115,9 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with ip address", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
+ @SerializedName(ApiConstants.IS_PORTABLE) @Param(description = "is public IP portable across the zones")
+ private Boolean isPortable;
+
/*
@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");
@@ -247,4 +250,8 @@ public class IPAddressResponse extends BaseResponse implements ControlledEntityR
public void setAssociatedNetworkName(String associatedNetworkName) {
this.associatedNetworkName = associatedNetworkName;
}
+
+ public void setPortable(Boolean portable) {
+ this.isPortable = portable;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java b/api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
new file mode 100644
index 0000000..e7a15b8
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/PortableIpRangeResponse.java
@@ -0,0 +1,93 @@
+// 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 java.util.List;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.IpAddress;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.region.PortableIpRange;
+
+@EntityReference(value=PortableIpRange.class)
+public class PortableIpRangeResponse extends BaseResponse {
+
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "portable IP range ID")
+ private String id;
+
+ @SerializedName(ApiConstants.REGION_ID)
+ @Param(description = "Region Id in which portable ip range is provisioned")
+ private Integer regionId;
+
+ @SerializedName(ApiConstants.GATEWAY) @Param(description="the gateway of the VLAN IP range")
+ private String gateway;
+
+ @SerializedName(ApiConstants.NETMASK) @Param(description="the netmask of the VLAN IP range")
+ private String netmask;
+
+ @SerializedName(ApiConstants.VLAN) @Param(description="the ID or VID of the VLAN.")
+ private String vlan;
+
+ @SerializedName(ApiConstants.START_IP) @Param(description="the start ip of the portable IP range")
+ private String startIp;
+
+ @SerializedName(ApiConstants.END_IP) @Param(description="the end ip of the portable IP range")
+ private String endIp;
+
+ @SerializedName(ApiConstants.PORTABLE_IP_ADDRESS)
+ @Param(description="List of portable IP and association with zone/network/vpc details that are part of GSLB rule", responseObject = PortableIpResponse.class)
+ private List<PortableIpResponse> portableIpResponses;
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setRegionId(int regionId) {
+ this.regionId = regionId;
+ }
+
+ public void setStartIp(String startIp) {
+ this.startIp = startIp;
+ }
+
+ public void setEndIp(String endIp) {
+ this.endIp = endIp;
+ }
+
+ public void setNetmask(String netmask) {
+ this.netmask = netmask;
+ }
+
+ public void setGateway(String gateway) {
+ this.gateway = gateway;
+ }
+
+ public void setVlan(String vlan) {
+ this.vlan = vlan;
+ }
+
+ public void setPortableIpResponses(List<PortableIpResponse> portableIpResponses) {
+ this.portableIpResponses = portableIpResponses;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/api/response/PortableIpResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/PortableIpResponse.java b/api/src/org/apache/cloudstack/api/response/PortableIpResponse.java
new file mode 100644
index 0000000..0ccbcc3
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/response/PortableIpResponse.java
@@ -0,0 +1,106 @@
+// 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 java.util.List;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.network.IpAddress;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
+
+@EntityReference(value=PortableIp.class)
+public class PortableIpResponse extends BaseResponse {
+
+ @SerializedName(ApiConstants.REGION_ID)
+ @Param(description = "Region Id in which global load balancer is created")
+ private Integer regionId;
+
+ @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="public IP address")
+ private String ipAddress;
+
+ @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the zone the public IP address belongs to")
+ private String zoneId;
+
+ @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the ID of the Network where ip belongs to")
+ private String networkId;
+
+ @SerializedName(ApiConstants.VPC_ID) @Param(description="VPC the ip belongs to")
+ private String vpcId;
+
+ @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to")
+ private String physicalNetworkId;
+
+ @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the account ID the portable IP address is associated with")
+ private String accountId;
+
+ @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID the portable IP address is associated with")
+ private String domainId;
+
+ @SerializedName("allocated") @Param(description="date the portal IP address was acquired")
+ private Date allocated;
+
+ @SerializedName(ApiConstants.STATE) @Param(description="State of the ip address. Can be: Allocatin, Allocated and Releasing")
+ private String state;
+
+ public void setRegionId(Integer regionId) {
+ this.regionId = regionId;
+ }
+
+ public void setAddress(String ipAddress) {
+ this.ipAddress = ipAddress;
+ }
+
+ public void setAssociatedDataCenterId(String zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public void setAssociatedWithNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
+
+ public void setAssociatedWithVpcId(String vpcId) {
+ this.vpcId = vpcId;
+ }
+
+ public void setPhysicalNetworkId(String physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
+ }
+
+ public void setAllocatedToAccountId(String accountId) {
+ this.accountId = accountId;
+ }
+
+ public void setAllocatedInDomainId(String domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setAllocatedTime(Date allocatedTimetime) {
+ this.allocated = allocatedTimetime;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/region/PortableIp.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/PortableIp.java b/api/src/org/apache/cloudstack/region/PortableIp.java
new file mode 100644
index 0000000..b95071e
--- /dev/null
+++ b/api/src/org/apache/cloudstack/region/PortableIp.java
@@ -0,0 +1,58 @@
+// 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.region;
+
+import java.util.Date;
+
+import com.cloud.utils.net.Ip;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface PortableIp extends InternalIdentity {
+
+ enum State {
+ Allocating, // The IP Address is being propagated to other network elements and is not ready for use yet.
+ Allocated, // The IP address is in used.
+ Releasing, // The IP address is being released for other network elements and is not ready for allocation.
+ Free // The IP address is ready to be allocated.
+ }
+
+ Long getAllocatedToAccountId();
+
+ Long getAllocatedInDomainId();
+
+ Date getAllocatedTime();
+
+ State getState();
+
+ int getRegionId();
+
+ Long getAssociatedDataCenterId();
+
+ Long getAssociatedWithNetworkId();
+
+ Long getAssociatedWithVpcId();
+
+ Long getPhysicalNetworkId();
+
+ String getAddress();
+
+ String getVlan();
+
+ String getNetmask();
+
+ String getGateway();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/api/src/org/apache/cloudstack/region/PortableIpRange.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/region/PortableIpRange.java b/api/src/org/apache/cloudstack/region/PortableIpRange.java
new file mode 100644
index 0000000..413a540
--- /dev/null
+++ b/api/src/org/apache/cloudstack/region/PortableIpRange.java
@@ -0,0 +1,38 @@
+// 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.region;
+
+import org.apache.cloudstack.acl.InfrastructureEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+public interface PortableIpRange extends InfrastructureEntity, InternalIdentity, Identity {
+
+ public final static String UNTAGGED = "untagged";
+
+ public String getVlanTag();
+
+ public String getGateway();
+
+ public String getNetmask();
+
+ public int getRegionId();
+
+ public String getIpRange();
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index b500fde..edf83a9 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -271,6 +271,8 @@
<bean id="physicalNetworkTrafficTypeDaoImpl" class="com.cloud.network.dao.PhysicalNetworkTrafficTypeDaoImpl" />
<bean id="podVlanDaoImpl" class="com.cloud.dc.dao.PodVlanDaoImpl" />
<bean id="podVlanMapDaoImpl" class="com.cloud.dc.dao.PodVlanMapDaoImpl" />
+ <bean id="PortableIpDaoImpl" class="org.apache.cloudstack.region.PortableIpDaoImpl" />
+ <bean id="PortableIpRangeDaoImpl" class="org.apache.cloudstack.region.PortableIpRangeDaoImpl" />
<bean id="portForwardingRulesDaoImpl" class="com.cloud.network.rules.dao.PortForwardingRulesDaoImpl" />
<bean id="portProfileDaoImpl" class="com.cloud.network.dao.PortProfileDaoImpl" />
<bean id="primaryDataStoreDaoImpl" class="org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl" />
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 68a7511..fd5479f 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -628,6 +628,11 @@ addCiscoAsa1000vResource=1
deleteCiscoAsa1000vResource=1
listCiscoAsa1000vResources=1
+#### portable public IP commands
+createPortableIpRange=1
+deletePortableIpRange=1
+listPortableIpRanges=1
+
#### Internal LB VM commands
stopInternalLoadBalancerVM=1
startInternalLoadBalancerVM=1
@@ -635,3 +640,4 @@ listInternalLoadBalancerVMs=1
### Network Isolation methods listing
listNetworkIsolationMethods=1
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
index ae27e95..5eb2500 100644
--- a/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressVO.java
@@ -111,6 +111,8 @@ public class IPAddressVO implements IpAddress {
@Column(name="dnat_vmip")
private String vmIp;
+ @Column(name="is_portable")
+ private boolean portable = false;
protected IPAddressVO() {
this.uuid = UUID.randomUUID().toString();
@@ -134,6 +136,19 @@ public class IPAddressVO implements IpAddress {
this.uuid = UUID.randomUUID().toString();
}
+ public IPAddressVO(Ip address, long dataCenterId, Long networkId, Long vpcId, long physicalNetworkId, long sourceNetworkId,
+ long vlanDbId, boolean portable) {
+ this.address = address;
+ this.dataCenterId = dataCenterId;
+ this.associatedWithNetworkId = networkId;
+ this.vpcId = vpcId;
+ this.physicalNetworkId = physicalNetworkId;
+ this.sourceNetworkId = sourceNetworkId;
+ this.vlanId = vlanDbId;
+ this.portable = portable;
+ this.uuid = UUID.randomUUID().toString();
+ }
+
public long getMacAddress() {
return macAddress;
}
@@ -283,6 +298,15 @@ public class IPAddressVO implements IpAddress {
this.system = isSystem;
}
+ @Override
+ public boolean isPortable() {
+ return portable;
+ }
+
+ public void setPortable(boolean portable) {
+ this.portable = portable;
+ }
+
@Override
public Long getVpcId() {
return vpcId;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/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 49e36dc..fc1c6a0 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -49,6 +49,8 @@ import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerInstanceResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
@@ -98,6 +100,8 @@ import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+import org.apache.cloudstack.api.response.PortableIpResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
@@ -722,6 +726,8 @@ public class ApiResponseHelper implements ResponseGenerator {
}
}
+ ipResponse.setPortable(ipAddr.isPortable());
+
//set tag information
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.PublicIpAddress, ipAddr.getId());
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
@@ -3824,6 +3830,69 @@ public class ApiResponseHelper implements ResponseGenerator {
}
}
+ @Override
+ public PortableIpRangeResponse createPortableIPRangeResponse(PortableIpRange ipRange) {
+ PortableIpRangeResponse response = new PortableIpRangeResponse();
+ response.setId(ipRange.getUuid());
+ String ipRangeStr = ipRange.getIpRange();
+ if (ipRangeStr != null) {
+ String[] range = ipRangeStr.split("-");
+ response.setStartIp(range[0]);
+ response.setEndIp(range[1]);
+ }
+ response.setVlan(ipRange.getVlanTag());
+ response.setGateway(ipRange.getGateway());
+ response.setNetmask(ipRange.getNetmask());
+ response.setRegionId(ipRange.getRegionId());
+ return response;
+ }
+
+ @Override
+ public PortableIpResponse createPortableIPResponse(PortableIp portableIp) {
+ PortableIpResponse response = new PortableIpResponse();
+ response.setAddress(portableIp.getAddress());
+ Long accountId = portableIp.getAllocatedInDomainId();
+ if (accountId != null) {
+ Account account = ApiDBUtils.findAccountById(accountId);
+ response.setAllocatedToAccountId(account.getAccountName());
+ Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
+ response.setAllocatedInDomainId(domain.getUuid());
+ }
+
+ response.setAllocatedTime(portableIp.getAllocatedTime());
+
+ if (portableIp.getAssociatedDataCenterId() != null) {
+ DataCenter zone = ApiDBUtils.findZoneById(portableIp.getAssociatedDataCenterId());
+ if (zone != null) {
+ response.setAssociatedDataCenterId(zone.getUuid());
+ }
+ }
+
+ if (portableIp.getPhysicalNetworkId() != null) {
+ PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(portableIp.getPhysicalNetworkId());
+ if (pnw != null) {
+ response.setPhysicalNetworkId(pnw.getUuid());
+ }
+ }
+
+ if (portableIp.getAssociatedWithNetworkId() != null) {
+ Network ntwk = ApiDBUtils.findNetworkById(portableIp.getAssociatedWithNetworkId());
+ if (ntwk != null) {
+ response.setAssociatedWithNetworkId(ntwk.getUuid());
+ }
+ }
+
+ if (portableIp.getAssociatedWithVpcId() != null) {
+ Vpc vpc = ApiDBUtils.findVpcById(portableIp.getAssociatedWithVpcId());
+ if (vpc != null) {
+ response.setAssociatedWithVpcId(vpc.getUuid());
+ }
+ }
+
+ response.setState(portableIp.getState().name());
+
+ return response;
+ }
@Override
public InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result) {
@@ -3842,7 +3911,6 @@ public class ApiResponseHelper implements ResponseGenerator {
return response;
}
-
@Override
public IsolationMethodResponse createIsolationMethodResponse(IsolationType method) {
IsolationMethodResponse response = new IsolationMethodResponse();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 52d6176..47c5482 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -43,6 +43,7 @@ import com.cloud.dc.*;
import com.cloud.dc.dao.*;
import com.cloud.user.*;
import com.cloud.event.UsageEventUtils;
+import com.cloud.utils.db.*;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
@@ -59,6 +60,9 @@ import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+import org.apache.cloudstack.api.command.admin.region.CreatePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.DeletePortableIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.region.ListPortableIpRangesCmd;
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
@@ -67,6 +71,8 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+import org.apache.cloudstack.region.*;
+import org.apache.cloudstack.region.dao.RegionDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
@@ -186,10 +192,6 @@ import com.cloud.utils.NumbersUtil;
import com.cloud.utils.StringUtils;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.crypt.DBEncryptionUtil;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.Filter;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.NicIpAlias;
@@ -332,6 +334,12 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
@Inject
VpcManager _vpcMgr;
@Inject
+ PortableIpRangeDao _portableIpRangeDao;
+ @Inject
+ RegionDao _regionDao;
+ @Inject
+ PortableIpDao _portableIpDao;
+ @Inject
ConfigurationServer _configServer;
@Inject
DcDetailsDao _dcDetailsDao;
@@ -4718,4 +4726,153 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
return null;
}
+
+ @Override
+ @DB
+ @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_RANGE_CREATE, eventDescription = "creating portable ip range", async = false)
+ public PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException {
+ Integer regionId = cmd.getRegionId();
+ String startIP = cmd.getStartIp();
+ String endIP = cmd.getEndIp();
+ String gateway = cmd.getGateway();
+ String netmask = cmd.getNetmask();
+ Long userId = UserContext.current().getCallerUserId();
+ String vlanId = cmd.getVlan();
+
+ Region region = _regionDao.findById(regionId);
+ if (region == null) {
+ throw new InvalidParameterValueException("Invalid region ID: " + regionId);
+ }
+
+ if (!NetUtils.isValidIp(startIP) || !NetUtils.isValidIp(endIP) || !NetUtils.validIpRange(startIP, endIP)) {
+ throw new InvalidParameterValueException("Invalid portable ip range: " + startIP + "-" + endIP);
+ }
+
+ if (!NetUtils.sameSubnet(startIP, gateway, netmask)) {
+ throw new InvalidParameterValueException("Please ensure that your start IP is in the same subnet as " +
+ "your portable IP range's gateway and as per the IP range's netmask.");
+ }
+
+ if (!NetUtils.sameSubnet(endIP, gateway, netmask)) {
+ throw new InvalidParameterValueException("Please ensure that your end IP is in the same subnet as " +
+ "your portable IP range's gateway and as per the IP range's netmask.");
+ }
+
+ if (checkOverlapPortableIpRange(regionId, startIP, endIP)) {
+ throw new InvalidParameterValueException("Ip range: " + startIP + "-" + endIP + " overlaps with a portable" +
+ " IP range already configured in the region " + regionId);
+ }
+
+ if (vlanId == null) {
+ vlanId = Vlan.UNTAGGED;
+ } else {
+ if (!NetUtils.isValidVlan(vlanId)) {
+ throw new InvalidParameterValueException("Invalid vlan id " + vlanId);
+ }
+ }
+ GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange");
+ portableIpLock.lock(5);
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+
+ PortableIpRangeVO portableIpRange = new PortableIpRangeVO(regionId, vlanId, gateway, netmask, startIP, endIP);
+ portableIpRange = _portableIpRangeDao.persist(portableIpRange);
+
+ long startIpLong = NetUtils.ip2Long(startIP);
+ long endIpLong = NetUtils.ip2Long(endIP);
+ while(startIpLong <= endIpLong) {
+ PortableIpVO portableIP = new PortableIpVO(regionId, portableIpRange.getId(), vlanId,
+ gateway, netmask,NetUtils.long2Ip(startIpLong));
+ _portableIpDao.persist(portableIP);
+ startIpLong++;
+ }
+
+ txn.commit();
+ portableIpLock.unlock();
+ return portableIpRange;
+ }
+
+ @Override
+ @DB
+ @ActionEvent(eventType = EventTypes.EVENT_PORTABLE_IP_RANGE_DELETE, eventDescription = "deleting portable ip range", async = false)
+ public boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd) {
+ long rangeId = cmd.getId();
+ PortableIpRangeVO portableIpRange = _portableIpRangeDao.findById(rangeId);
+ if (portableIpRange == null) {
+ throw new InvalidParameterValueException("Please specify a valid portable IP range id.");
+ }
+
+ List<PortableIpVO> fullIpRange = _portableIpDao.listByRangeId(portableIpRange.getId());
+ List<PortableIpVO> freeIpRange = _portableIpDao.listByRangeIdAndState(portableIpRange.getId(), PortableIp.State.Free);
+
+ if (fullIpRange != null && freeIpRange != null) {
+ if (fullIpRange.size() == freeIpRange.size()) {
+ _portableIpRangeDao.expunge(portableIpRange.getId());
+ return true;
+ } else {
+ throw new InvalidParameterValueException("Can't delete portable IP range as there are IP's assigned.");
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public List<? extends PortableIpRange> listPortableIpRanges(ListPortableIpRangesCmd cmd) {
+ Integer regionId = cmd.getRegionIdId();
+ Long rangeId = cmd.getPortableIpRangeId();
+
+ List <PortableIpRangeVO> ranges = new ArrayList<PortableIpRangeVO>();
+ if (regionId != null) {
+ Region region = _regionDao.findById(regionId);
+ if (region == null) {
+ throw new InvalidParameterValueException("Invalid region ID: " + regionId);
+ }
+ return _portableIpRangeDao.listByRegionId(regionId);
+ }
+
+ if (rangeId != null) {
+ PortableIpRangeVO range = _portableIpRangeDao.findById(rangeId);
+ if (range == null) {
+ throw new InvalidParameterValueException("Invalid portable IP range ID: " + regionId);
+ }
+ ranges.add(range);
+ return ranges;
+ }
+
+ return _portableIpRangeDao.listAll();
+ }
+
+ @Override
+ public List<? extends PortableIp> listPortableIps(long id) {
+
+ PortableIpRangeVO portableIpRange = _portableIpRangeDao.findById(id);
+ if (portableIpRange == null) {
+ throw new InvalidParameterValueException("Please specify a valid portable IP range id.");
+ }
+
+ return _portableIpDao.listByRangeId(portableIpRange.getId());
+ }
+
+ private boolean checkOverlapPortableIpRange(int regionId, String newStartIpStr, String newEndIpStr) {
+ long newStartIp = NetUtils.ip2Long(newStartIpStr);
+ long newEndIp = NetUtils.ip2Long(newEndIpStr);
+
+ List<PortableIpRangeVO> existingPortableIPRanges = _portableIpRangeDao.listByRegionId(regionId);
+ for (PortableIpRangeVO portableIpRange : existingPortableIPRanges) {
+ String ipRangeStr = portableIpRange.getIpRange();
+ String[] range = ipRangeStr.split("-");
+ long startip = NetUtils.ip2Long(range[0]);
+ long endIp = NetUtils.ip2Long(range[1]);
+
+ if ((newStartIp >= startip && newStartIp <= endIp) || (newEndIp >= startip && newEndIp <= endIp)) {
+ return true;
+ }
+
+ if ((startip >= newStartIp && startip <= newEndIp) || (endIp >= newStartIp && endIp <= newEndIp)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java
index 08198ee..1e4fb84 100755
--- a/server/src/com/cloud/network/NetworkManager.java
+++ b/server/src/com/cloud/network/NetworkManager.java
@@ -59,6 +59,7 @@ import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineProfile;
+import org.apache.cloudstack.region.PortableIp;
/**
* NetworkManager manages the network for the different end users.
@@ -240,6 +241,16 @@ public interface NetworkManager {
IPAddressVO associateIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
InsufficientAddressCapacityException, ConcurrentOperationException;
+ IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException;
+
+ IPAddressVO disassociatePortableIPToGuestNetwork(long ipAddrId, long networkId) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException;
+
+ boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId);
+
+ void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException;;
/**
* @param network
@@ -325,6 +336,9 @@ public interface NetworkManager {
DataCenter zone) throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException;
+ IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
+ throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException;
+
Map<String, String> finalizeServicesAndProvidersForNetwork(NetworkOffering offering,
Long physicalNetworkId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6452be8/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 40fc3d3..b3df0da 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -105,6 +105,10 @@ import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.dao.*;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpDao;
+import org.apache.cloudstack.region.PortableIpVO;
+import org.apache.cloudstack.region.Region;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -251,6 +255,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
UserIpv6AddressDao _ipv6Dao;
@Inject
Ipv6AddressManager _ipv6Mgr;
+ @Inject
+ PortableIpDao _portableIpDao;
protected StateMachine2<Network.State, Network.Event, Network> _stateMachine;
private final HashMap<String, NetworkOfferingVO> _systemNetworks = new HashMap<String, NetworkOfferingVO>(5);
@@ -702,6 +708,62 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
return ip;
}
+ @Override
+ @DB
+ public IpAddress allocatePortableIp(Account ipOwner, Account caller, long dcId, Long networkId, Long vpcID)
+ throws ConcurrentOperationException, ResourceAllocationException, InsufficientAddressCapacityException {
+
+ Transaction txn = Transaction.currentTxn();
+ GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange");
+ PortableIpVO allocatedPortableIp;
+ IPAddressVO ipaddr;
+
+ try {
+ portableIpLock.lock(5);
+
+ txn.start();
+ //TODO: get the region ID corresponding to running management server
+ List<PortableIpVO> portableIpVOs = _portableIpDao.listByRegionIdAndState(1, PortableIp.State.Free);
+ if (portableIpVOs == null || portableIpVOs.isEmpty()) {
+ InsufficientAddressCapacityException ex = new InsufficientAddressCapacityException
+ ("Unable to find available portable IP addresses", Region.class, new Long(1));
+ throw ex;
+ }
+
+ // allocate first portable IP to the user
+ allocatedPortableIp = portableIpVOs.get(0);
+ allocatedPortableIp.setAllocatedTime(new Date());
+ allocatedPortableIp.setAllocatedToAccountId(ipOwner.getAccountId());
+ allocatedPortableIp.setAllocatedInDomainId(ipOwner.getDomainId());
+ allocatedPortableIp.setState(PortableIp.State.Allocated);
+ _portableIpDao.update(allocatedPortableIp.getId(), allocatedPortableIp);
+
+ // provision portable IP range VLAN
+ long physicalNetworkId = _networkModel.getDefaultPhysicalNetworkByZoneAndTrafficType(dcId, TrafficType.Public).getId();
+ Network network = _networkModel.getNetwork(physicalNetworkId);
+ String range = allocatedPortableIp.getAddress() + "-" + allocatedPortableIp.getAddress();
+ VlanVO vlan = new VlanVO(VlanType.VirtualNetwork, allocatedPortableIp.getVlan(), allocatedPortableIp.getGateway(),
+ allocatedPortableIp.getNetmask(), dcId, range, network.getId(), network.getId(), null, null, null);
+ vlan = _vlanDao.persist(vlan);
+
+ // provision the portable IP in to user_ip_address table
+ ipaddr = new IPAddressVO(new Ip(allocatedPortableIp.getAddress()), dcId, networkId, vpcID, network.getId(),
+ network.getId(), vlan.getId(), true);
+ ipaddr.setState(State.Allocated);
+ ipaddr.setAllocatedTime(new Date());
+ ipaddr.setAllocatedInDomainId(ipOwner.getDomainId());
+ ipaddr.setAllocatedToAccountId(ipOwner.getId());
+ ipaddr= _ipAddressDao.persist(ipaddr);
+
+ txn.commit();
+
+ } finally {
+ portableIpLock.unlock();
+ }
+
+ return ipaddr;
+ }
+
protected IPAddressVO getExistingSourceNatInNetwork(long ownerId, Long networkId) {
List<? extends IpAddress> addrs = _networkModel.listPublicIpsAssignedToGuestNtwk(ownerId, networkId, true);
@@ -741,12 +803,14 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
DataCenter zone = _configMgr.getZone(network.getDataCenterId());
- if (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced) {
- if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
- _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
- } else {
- throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " +
- "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network");
+ if (zone.getNetworkType() == NetworkType.Advanced) {
+ if (network.getGuestType() == Network.GuestType.Shared) {
+ if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+ _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
+ } else {
+ throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " +
+ "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network");
+ }
}
} else {
_accountMgr.checkAccess(caller, null, true, ipToAssoc);
@@ -844,6 +908,162 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
}
+ @Override
+ public IPAddressVO associatePortableIPToGuestNetwork(long ipAddrId, long networkId, boolean releaseOnFailure) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+ return associateIPToGuestNetwork(ipAddrId, networkId, releaseOnFailure);
+ }
+
+ @DB
+ @Override
+ public IPAddressVO disassociatePortableIPToGuestNetwork(long ipId, long networkId)
+ throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+
+ Account caller = UserContext.current().getCaller();
+ Account owner = null;
+
+ Network network = _networksDao.findById(networkId);
+ if (network == null) {
+ throw new InvalidParameterValueException("Invalid network id is given");
+ }
+
+ IPAddressVO ipToAssoc = _ipAddressDao.findById(ipId);
+ if (ipToAssoc != null) {
+
+ if (ipToAssoc.getAssociatedWithNetworkId() == null) {
+ throw new InvalidParameterValueException("IP " + ipToAssoc + " is not associated with any network");
+ }
+
+ if (ipToAssoc.getAssociatedWithNetworkId() != network.getId()) {
+ throw new InvalidParameterValueException("IP " + ipToAssoc + " is not associated with network id" + networkId);
+ }
+
+ DataCenter zone = _configMgr.getZone(network.getDataCenterId());
+ if (zone.getNetworkType() == NetworkType.Advanced) {
+ if (network.getGuestType() == Network.GuestType.Shared) {
+ assert (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()));
+ _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
+ }
+ } else {
+ _accountMgr.checkAccess(caller, null, true, ipToAssoc);
+ }
+ owner = _accountMgr.getAccount(ipToAssoc.getAllocatedToAccountId());
+ } else {
+ s_logger.debug("Unable to find ip address by id: " + ipId);
+ return null;
+ }
+
+ DataCenter zone = _configMgr.getZone(network.getDataCenterId());
+
+ // Check that network belongs to IP owner - skip this check
+ // - if zone is basic zone as there is just one guest network,
+ // - if shared network in Advanced zone
+ // - and it belongs to the system
+ if (network.getAccountId() != owner.getId()) {
+ if (zone.getNetworkType() != NetworkType.Basic && !(zone.getNetworkType() == NetworkType.Advanced && network.getGuestType() == Network.GuestType.Shared)) {
+ throw new InvalidParameterValueException("The owner of the network is not the same as owner of the IP");
+ }
+ }
+
+ // Check if IP has any services (rules) associated in the network
+ List<PublicIpAddress> ipList = new ArrayList<PublicIpAddress>();
+ PublicIp publicIp = PublicIp.createFromAddrAndVlan(ipToAssoc, _vlanDao.findById(ipToAssoc.getVlanId()));
+ ipList.add(publicIp);
+ Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
+ if (ipToServices != null & !ipToServices.isEmpty()) {
+ Set<Service> services = ipToServices.get(publicIp);
+ if (services != null && !services.isEmpty()) {
+ throw new InvalidParameterValueException("IP " + ipToAssoc + " has services and rules associated in the network " + networkId);
+ }
+ }
+
+ IPAddressVO ip = _ipAddressDao.findById(ipId);
+ ip.setAssociatedWithNetworkId(null);
+ _ipAddressDao.update(ipId, ip);
+
+ try {
+ boolean success = applyIpAssociations(network, false);
+ if (success) {
+ s_logger.debug("Successfully associated ip address " + ip.getAddress().addr() + " to network " + network);
+ } else {
+ s_logger.warn("Failed to associate ip address " + ip.getAddress().addr() + " to network " + network);
+ }
+ return ip;
+ } finally {
+
+ }
+ }
+
+ @Override
+ public boolean isPortableIpTransferableFromNetwork(long ipAddrId, long networkId) {
+ Network network = _networksDao.findById(networkId);
+ if (network == null) {
+ throw new InvalidParameterValueException("Invalid network id is given");
+ }
+
+ IPAddressVO ip = _ipAddressDao.findById(ipAddrId);
+ if (ip == null) {
+ throw new InvalidParameterValueException("Invalid network id is given");
+ }
+
+ // Check if IP has any services (rules) associated in the network
+ List<PublicIpAddress> ipList = new ArrayList<PublicIpAddress>();
+ PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId()));
+ ipList.add(publicIp);
+ Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
+ if (ipToServices != null & !ipToServices.isEmpty()) {
+ Set<Service> ipServices = ipToServices.get(publicIp);
+ if (ipServices != null && !ipServices.isEmpty()) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ @DB
+ @Override
+ public void transferPortableIP(long ipAddrId, long currentNetworkId, long newNetworkId) throws ResourceAllocationException, ResourceUnavailableException,
+ InsufficientAddressCapacityException, ConcurrentOperationException {
+
+ Network srcNetwork = _networksDao.findById(currentNetworkId);
+ if (srcNetwork == null) {
+ throw new InvalidParameterValueException("Invalid source network id " + currentNetworkId +" is given");
+ }
+
+ Network dstNetwork = _networksDao.findById(newNetworkId);
+ if (dstNetwork == null) {
+ throw new InvalidParameterValueException("Invalid source network id " + newNetworkId +" is given");
+ }
+
+ IPAddressVO ip = _ipAddressDao.findById(ipAddrId);
+ if (ip == null) {
+ throw new InvalidParameterValueException("Invalid portable ip address id is given");
+ }
+
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+
+ assert(isPortableIpTransferableFromNetwork(ipAddrId, currentNetworkId));
+
+ if (srcNetwork.getVpcId() != null) {
+ _vpcMgr.unassignIPFromVpcNetwork(ipAddrId, currentNetworkId);
+ } else {
+ disassociatePortableIPToGuestNetwork(ipAddrId, currentNetworkId);
+ }
+
+ associatePortableIPToGuestNetwork(ipAddrId, newNetworkId, false);
+
+ if (dstNetwork.getVpcId() != null) {
+ ip.setVpcId(dstNetwork.getVpcId());
+ } else {
+ ip.setVpcId(null);
+ }
+
+ _ipAddressDao.update(ipAddrId, ip);
+ txn.commit();
+ }
@Override
@DB
@@ -884,12 +1104,42 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
if (success) {
+ if (ip.isPortable()) {
+ releasePortableIpAddress(addrId);
+ }
s_logger.debug("Released a public ip id=" + addrId);
}
return success;
}
+ @DB
+ private void releasePortableIpAddress(long addrId) {
+ Transaction txn = Transaction.currentTxn();
+ GlobalLock portableIpLock = GlobalLock.getInternLock("PortablePublicIpRange");
+
+ txn.start();
+ try {
+ portableIpLock.lock(5);
+ IPAddressVO ip = _ipAddressDao.findById(addrId);
+
+ // unassign portable IP
+ PortableIpVO portableIp = _portableIpDao.findByIpAddress(ip.getAddress().addr());
+ _portableIpDao.unassignIpAddress(portableIp.getId());
+
+ // removed the provisioned vlan
+ VlanVO vlan = _vlanDao.findById(ip.getVlanId());
+ _vlanDao.expunge(vlan.getId());
+
+ // remove the provisioned public ip address
+ _ipAddressDao.expunge(ip.getId());
+
+ txn.commit();
+ } finally {
+ portableIpLock.releaseRef();
+ }
+ }
+
@Override
@DB
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
[49/50] [abbrv] git commit: updated refs/heads/master to d893cb4
Posted by ya...@apache.org.
CLOUDSTACK-3643: Automation: Fix test_vpc_network.py
1. Port 80 won't help on ICMP
2. RvR doesn't support VPC now.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a102853f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a102853f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a102853f
Branch: refs/heads/master
Commit: a102853fb9cf7a74fccf80f1ea42513f11316d8e
Parents: 982c0b5
Author: Sheng Yang <sh...@citrix.com>
Authored: Sun Jul 21 20:11:16 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Sun Jul 21 22:24:10 2013 -0700
----------------------------------------------------------------------
test/integration/component/test_vpc_network.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a102853f/test/integration/component/test_vpc_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index d76996a..477c79e 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -148,9 +148,9 @@ class Services:
# Any network (For creating FW rule)
"protocol": "TCP"
},
- "http_rule": {
- "startport": 80,
- "endport": 80,
+ "icmp_rule": {
+ "icmptype": -1,
+ "icmpcode": -1,
"cidrlist": '0.0.0.0/0',
"protocol": "ICMP"
},
@@ -690,6 +690,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.debug("Network creation failed")
return
+ @unittest.skip("skipped - RvR didn't support VPC currently ")
@attr(tags=["advanced", "intervlan"])
def test_06_create_network_with_rvr(self):
""" Test create network with redundant router capability
@@ -1823,7 +1824,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
nwacl_internet_1 = NetworkACL.create(
self.apiclient,
networkid=network_1.id,
- services=self.services["http_rule"],
+ services=self.services["icmp_rule"],
traffictype='Egress'
)
@@ -2212,7 +2213,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.nwacl_internet_1 = NetworkACL.create(
cls.api_client,
networkid=cls.network_1.id,
- services=cls.services["http_rule"],
+ services=cls.services["icmp_rule"],
traffictype='Egress'
)
cls._cleanup = [
[18/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Fixing multiple minor annoyances:
1. Keeping the description consistent - Memory not RAM when referring to
overcommit
2. getters And setters grouped, provided right casing.
3. Removed wildcard imports
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6ea2b06a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6ea2b06a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6ea2b06a
Branch: refs/heads/pvlan
Commit: 6ea2b06aab537f34733872e65041f3499481fb59
Parents: 806aeb9
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Sun May 19 15:56:30 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun May 19 18:34:26 2013 +0530
----------------------------------------------------------------------
.../command/admin/cluster/AddClusterCmd.java | 36 +++++++++-----------
.../command/admin/cluster/UpdateClusterCmd.java | 6 ++--
.../api/response/ClusterResponse.java | 27 ++++++++-------
server/src/com/cloud/api/ApiResponseHelper.java | 10 ++----
.../com/cloud/capacity/CapacityManagerImpl.java | 20 +++++------
.../com/cloud/resource/ResourceManagerImpl.java | 12 +++----
.../com/cloud/vm/VirtualMachineManagerImpl.java | 4 +--
.../com/cloud/vm/VirtualMachineProfileImpl.java | 34 +++++++++---------
8 files changed, 69 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index d55ccd7..c6ca9bc6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -17,13 +17,11 @@
package org.apache.cloudstack.api.command.admin.cluster;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
-
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.org.Cluster;
+import com.cloud.user.Account;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@@ -36,10 +34,8 @@ import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import com.cloud.exception.DiscoveryException;
-import com.cloud.exception.ResourceInUseException;
-import com.cloud.org.Cluster;
-import com.cloud.user.Account;
+import java.util.ArrayList;
+import java.util.List;
@APICommand(name = "addCluster", description="Adds a new cluster", responseObject=ClusterResponse.class)
public class AddClusterCmd extends BaseCmd {
@@ -86,10 +82,10 @@ public class AddClusterCmd extends BaseCmd {
private String vsmipaddress;
@Parameter (name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false , description = "value of the cpu overcommit ratio, defaults to 1")
- private String cpuovercommitRatio;
+ private String cpuOvercommitRatio;
- @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false ,description = "value of the default ram overcommit ratio, defaults to 1")
- private String memoryovercommitratio;
+ @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false, description = "value of the default memory overcommit ratio, defaults to 1")
+ private String memoryOvercommitRatio;
@Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypeGuestTraffic;
@@ -186,15 +182,15 @@ public class AddClusterCmd extends BaseCmd {
}
public Float getCpuOvercommitRatio (){
- if(cpuovercommitRatio != null){
- return Float.parseFloat(cpuovercommitRatio);
+ if(cpuOvercommitRatio != null){
+ return Float.parseFloat(cpuOvercommitRatio);
}
return 1.0f;
}
- public Float getMemoryOvercommitRaito (){
- if (memoryovercommitratio != null){
- return Float.parseFloat(memoryovercommitratio);
+ public Float getMemoryOvercommitRatio(){
+ if (memoryOvercommitRatio != null){
+ return Float.parseFloat(memoryOvercommitRatio);
}
return 1.0f;
}
@@ -202,8 +198,8 @@ public class AddClusterCmd extends BaseCmd {
@Override
public void execute(){
try {
- if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
- throw new InvalidParameterValueException("Cpu and ram overcommit ratios should not be less than 1");
+ if (getMemoryOvercommitRatio().compareTo(1f) < 0 || getCpuOvercommitRatio().compareTo(1f) < 0) {
+ throw new InvalidParameterValueException("cpu and memory overcommit ratios should be greater than or equal to one");
}
List<? extends Cluster> result = _resourceService.discoverCluster(this);
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index c513058..a14f905 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -57,7 +57,7 @@ public class UpdateClusterCmd extends BaseCmd {
@Parameter(name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of cpu overcommit ratio")
private String cpuovercommitratio;
- @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of ram overcommit ratio")
+ @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of memory overcommit ratio")
private String memoryovercommitratio;
@@ -129,13 +129,13 @@ public class UpdateClusterCmd extends BaseCmd {
}
if (getMemoryOvercommitRaito() !=null){
if ((getMemoryOvercommitRaito().compareTo(1f) < 0)) {
- throw new InvalidParameterValueException("Memory overcommit ratio should be greater than or equal to one");
+ throw new InvalidParameterValueException("Memory overcommit ratio should be greater than or equal to one");
}
}
if (getCpuOvercommitRatio() !=null){
if (getCpuOvercommitRatio().compareTo(1f) < 0) {
- throw new InvalidParameterValueException("Cpu overcommit ratio should be greater than or equal to one");
+ throw new InvalidParameterValueException("Cpu overcommit ratio should be greater than or equal to one");
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
index cfd772d..ef8cca6 100644
--- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
@@ -16,16 +16,15 @@
// under the License.
package org.apache.cloudstack.api.response;
-import java.util.ArrayList;
-import java.util.List;
-
+import com.cloud.org.Cluster;
+import com.cloud.serializer.Param;
+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 com.cloud.org.Cluster;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
+import java.util.ArrayList;
+import java.util.List;
@EntityReference(value = Cluster.class)
public class ClusterResponse extends BaseResponse {
@@ -68,7 +67,7 @@ public class ClusterResponse extends BaseResponse {
@SerializedName("cpuovercommitratio") @Param(description = "The cpu overcommit ratio of the cluster")
private String cpuovercommitratio;
- @SerializedName("memoryovercommitratio") @Param (description = "The ram overcommit ratio of the cluster")
+ @SerializedName("memoryovercommitratio") @Param (description = "The memory overcommit ratio of the cluster")
private String memoryovercommitratio;
public String getId() {
@@ -162,18 +161,20 @@ public class ClusterResponse extends BaseResponse {
public void setCapacitites(ArrayList<CapacityResponse> arrayList) {
this.capacitites = arrayList;
}
- public void setCpuovercommitratio(String cpuovercommitratio){
+
+ public void setCpuOvercommitRatio(String cpuovercommitratio){
this.cpuovercommitratio= cpuovercommitratio;
}
- public void setRamovercommitratio (String memoryOvercommitRatio){
- this.memoryovercommitratio= memoryOvercommitRatio;
- }
- public String getCpuovercommitratio (){
+ public String getCpuOvercommitRatio(){
return cpuovercommitratio;
}
- public String getRamovercommitratio (){
+ public void setMemoryOvercommitRatio(String memoryovercommitratio){
+ this.memoryovercommitratio= memoryovercommitratio;
+ }
+
+ public String getMemoryOvercommitRatio(){
return memoryovercommitratio;
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/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 482594d..49e36dc 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -40,12 +40,6 @@ 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.vm.*;
-import com.cloud.network.vpc.NetworkACL;
-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 org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.affinity.AffinityGroup;
@@ -975,8 +969,8 @@ public class ApiResponseHelper implements ResponseGenerator {
clusterResponse.setManagedState(cluster.getManagedState().toString());
String cpuOvercommitRatio=ApiDBUtils.findClusterDetails(cluster.getId(),"cpuOvercommitRatio").getValue();
String memoryOvercommitRatio=ApiDBUtils.findClusterDetails(cluster.getId(),"memoryOvercommitRatio").getValue();
- clusterResponse.setCpuovercommitratio(cpuOvercommitRatio);
- clusterResponse.setRamovercommitratio(memoryOvercommitRatio);
+ clusterResponse.setCpuOvercommitRatio(cpuOvercommitRatio);
+ clusterResponse.setMemoryOvercommitRatio(memoryOvercommitRatio);
if (showCapacities != null && showCapacities) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index 2f82b68..e58ae40 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -177,10 +177,10 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
ServiceOfferingVO svo = _offeringsDao.findById(vm.getServiceOfferingId());
CapacityVO capacityCpu = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_CPU);
CapacityVO capacityMemory = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_MEMORY);
- Long clusterId=null;
+ Long clusterId = null;
if (hostId != null) {
- HostVO host = _hostDao.findById(hostId);
- clusterId= host.getClusterId();
+ HostVO host = _hostDao.findById(hostId);
+ clusterId = host.getClusterId();
}
if (capacityCpu == null || capacityMemory == null || svo == null) {
return false;
@@ -263,8 +263,8 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
long hostId = vm.getHostId();
HostVO host = _hostDao.findById(hostId);
long clusterId = host.getClusterId();
- float cpuOvercommitRatio =Float.parseFloat(_clusterDetailsDao.findDetail(clusterId,"cpuOvercommitRatio").getValue());
- float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId,"memoryOvercommitRatio").getValue());
+ float cpuOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "cpuOvercommitRatio").getValue());
+ float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(clusterId, "memoryOvercommitRatio").getValue());
ServiceOfferingVO svo = _offeringsDao.findById(vm.getServiceOfferingId());
@@ -348,7 +348,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
}
@Override
- public boolean checkIfHostHasCapacity(long hostId, Integer cpu, long ram, boolean checkFromReservedCapacity, float cpuOvercommitRatio,float memoryOvercommitRatio, boolean considerReservedCapacity) {
+ public boolean checkIfHostHasCapacity(long hostId, Integer cpu, long ram, boolean checkFromReservedCapacity, float cpuOvercommitRatio, float memoryOvercommitRatio, boolean considerReservedCapacity) {
boolean hasCapacity = false;
if (s_logger.isDebugEnabled()) {
@@ -381,7 +381,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
long actualTotalCpu = capacityCpu.getTotalCapacity();
long actualTotalMem = capacityMem.getTotalCapacity();
long totalCpu = (long) (actualTotalCpu * cpuOvercommitRatio );
- long totalMem = (long) (actualTotalMem *memoryOvercommitRatio );
+ long totalMem = (long) (actualTotalMem * memoryOvercommitRatio);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Hosts's actual total CPU: " + actualTotalCpu + " and CPU after applying overprovisioning: " + totalCpu);
}
@@ -744,8 +744,8 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
capacityCPU.addAnd("podId", SearchCriteria.Op.EQ, server.getPodId());
capacityCPU.addAnd("capacityType", SearchCriteria.Op.EQ, CapacityVO.CAPACITY_TYPE_CPU);
List<CapacityVO> capacityVOCpus = _capacityDao.search(capacitySC, null);
- Float cpuovercommitratio = Float.parseFloat(_clusterDetailsDao.findDetail(server.getClusterId(),"cpuOvercommitRatio").getValue());
- Float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(server.getClusterId(),"memoryOvercommitRatio").getValue());
+ Float cpuovercommitratio = Float.parseFloat(_clusterDetailsDao.findDetail(server.getClusterId(), "cpuOvercommitRatio").getValue());
+ Float memoryOvercommitRatio = Float.parseFloat(_clusterDetailsDao.findDetail(server.getClusterId(), "memoryOvercommitRatio").getValue());
if (capacityVOCpus != null && !capacityVOCpus.isEmpty()) {
CapacityVO CapacityVOCpu = capacityVOCpus.get(0);
@@ -778,7 +778,7 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
if (capacityVOMems != null && !capacityVOMems.isEmpty()) {
CapacityVO CapacityVOMem = capacityVOMems.get(0);
- long newTotalMem = (long)((server.getTotalMemory())* memoryOvercommitRatio);
+ long newTotalMem = (long) ((server.getTotalMemory()) * memoryOvercommitRatio);
if (CapacityVOMem.getTotalCapacity() <= newTotalMem
|| (CapacityVOMem.getUsedCapacity() + CapacityVOMem.getReservedCapacity() <= newTotalMem)) {
CapacityVOMem.setTotalCapacity(newTotalMem);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index c60f095..25f451e 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -505,10 +505,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
clusterId = cluster.getId();
result.add(cluster);
- ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(clusterId, "cpuOvercommitRatio", Float.toString(cmd.getCpuOvercommitRatio()));
- ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", Float.toString(cmd.getMemoryOvercommitRaito()));
- _clusterDetailsDao.persist(cluster_detail_cpu);
- _clusterDetailsDao.persist(cluster_detail_ram);
+ ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(clusterId, "cpuOvercommitRatio", Float.toString(cmd.getCpuOvercommitRatio()));
+ ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", Float.toString(cmd.getMemoryOvercommitRatio()));
+ _clusterDetailsDao.persist(cluster_detail_cpu);
+ _clusterDetailsDao.persist(cluster_detail_ram);
if (clusterType == Cluster.ClusterType.CloudManaged) {
return result;
@@ -530,8 +530,8 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
}
- if(cmd.getMemoryOvercommitRaito().compareTo(1f) > 0) {
- cluster_detail_ram = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", Float.toString(cmd.getMemoryOvercommitRaito()));
+ if(cmd.getMemoryOvercommitRatio().compareTo(1f) > 0) {
+ cluster_detail_ram = new ClusterDetailsVO(clusterId, "memoryOvercommitRatio", Float.toString(cmd.getMemoryOvercommitRatio()));
_clusterDetailsDao.persist(cluster_detail_ram);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index cea0567..58d95ab 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -824,8 +824,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
Long cluster_id = dest.getCluster().getId();
ClusterDetailsVO cluster_detail_cpu = _clusterDetailsDao.findDetail(cluster_id,"cpuOvercommitRatio");
ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id,"memoryOvercommitRatio");
- vmProfile.setcpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue()));
- vmProfile.setramOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue()));
+ vmProfile.setCpuOvercommitRatio(Float.parseFloat(cluster_detail_cpu.getValue()));
+ vmProfile.setMemoryOvercommitRatio(Float.parseFloat(cluster_detail_ram.getValue()));
try {
if (!changeState(vm, Event.OperationRetry, destHostId, work, Step.Prepare)) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ea2b06a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java b/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
index 24f44cb..e777d5e 100644
--- a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
@@ -16,12 +16,6 @@
// under the License.
package com.cloud.vm;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
@@ -34,6 +28,11 @@ import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.user.Account;
import com.cloud.user.dao.AccountDao;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Implementation of VirtualMachineProfile.
*
@@ -239,28 +238,27 @@ public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements Virtua
return _params;
}
- public void setServiceOffering(ServiceOfferingVO offering) {
- _offering = offering;
- }
+ public void setServiceOffering(ServiceOfferingVO offering) {
+ _offering = offering;
+ }
- public void setcpuOvercommitRatio(Float cpuOvercommitRatio){
- this.cpuOvercommitRatio= cpuOvercommitRatio;
+ public void setCpuOvercommitRatio(Float cpuOvercommitRatio) {
+ this.cpuOvercommitRatio = cpuOvercommitRatio;
}
- public void setramOvercommitRatio(Float memoryOvercommitRatio){
- this.memoryOvercommitRatio= memoryOvercommitRatio;
+ public void setMemoryOvercommitRatio(Float memoryOvercommitRatio) {
+ this.memoryOvercommitRatio = memoryOvercommitRatio;
}
+
@Override
- public Float getCpuOvercommitRatio(){
- return this.cpuOvercommitRatio;
+ public Float getCpuOvercommitRatio() {
+ return this.cpuOvercommitRatio;
}
@Override
- public Float getMemoryOvercommitRatio(){
+ public Float getMemoryOvercommitRatio() {
return this.memoryOvercommitRatio;
}
-
-
}
[26/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2085: DMC enable guest scaling
When dmc is enabled allow cloudstack to scale the VM between dynamic
ranges. This requires a further commit where there is enough memory
available between dynamic-max and static-max for the VM to scale under
memory pressure. See the TODO in Xenserver56FP1Resource.java
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8da7ec05
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8da7ec05
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8da7ec05
Branch: refs/heads/pvlan
Commit: 8da7ec05f1c7dae0aab827ae0568e120111c6579
Parents: 2778486
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 17:48:07 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 17:51:49 2013 +0530
----------------------------------------------------------------------
.../xen/resource/CitrixResourceBase.java | 11 +++
.../xen/resource/XcpServerResource.java | 9 ++-
.../xen/resource/XenServer56FP1Resource.java | 71 +++++++++++++-------
3 files changed, 64 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8da7ec05/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 19444cc..cd49773 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -3523,6 +3523,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
vm.setMemoryLimits(conn, mem_128m, maxMemsize, minMemsize, maxMemsize);
}
+ /**
+ * When Dynamic Memory Control (DMC) is enabled -
+ * xen allows scaling the guest memory while the guest is running
+ *
+ * By default this is disallowed, override the specific xen resource
+ * if this is enabled
+ */
+ protected boolean isDmcEnabled(Connection conn, Host host) throws XenAPIException, XmlRpcException {
+ return false;
+ }
+
protected void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException {
long beginTime = System.currentTimeMillis();
while (task.getStatus(c) == Types.TaskStatusType.PENDING) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8da7ec05/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
index bf0a408..67e37d52 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java
@@ -24,6 +24,7 @@ import com.cloud.resource.ServerResource;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Host;
import com.xensource.xenapi.Types.XenAPIException;
import com.xensource.xenapi.VM;
import org.apache.log4j.Logger;
@@ -38,7 +39,6 @@ import java.util.List;
public class XcpServerResource extends CitrixResourceBase {
private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
private static final long mem_32m = 33554432L;
-
private String version;
public XcpServerResource() {
@@ -148,4 +148,11 @@ public class XcpServerResource extends CitrixResourceBase {
}
vm.setMemoryLimits(conn, mem_32m, maxMemsize, minMemsize, maxMemsize);
}
+
+ @Override
+ protected boolean isDmcEnabled(Connection conn, Host host) {
+ //Dynamic Memory Control (DMC) is a technology provided by Xen Cloud Platform (XCP), starting from the 0.5 release
+ //For the supported XCPs dmc is default enabled, XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x;
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8da7ec05/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index ad412c1..78ad236 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -47,6 +47,7 @@ import java.util.Set;
@Local(value=ServerResource.class)
public class XenServer56FP1Resource extends XenServer56Resource {
+ private static final long mem_128m = 134217728L;
private static final Logger s_logger = Logger.getLogger(XenServer56FP1Resource.class);
public XenServer56FP1Resource() {
@@ -126,41 +127,46 @@ public class XenServer56FP1Resource extends XenServer56Resource {
assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
VM template = templates.iterator().next();
- VM.Record record = template.getRecord(conn);
- record.affinity = host;
- record.otherConfig.remove("disks");
- record.otherConfig.remove("default_template");
- record.otherConfig.remove("mac_seed");
- record.isATemplate = false;
- record.nameLabel = vmSpec.getName();
- record.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
- record.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
- record.memoryDynamicMin = vmSpec.getMinRam();
- record.memoryDynamicMax = vmSpec.getMaxRam();
- Map<String, String> hostParams = new HashMap<String, String>();
- hostParams = host.getLicenseParams(conn);
- if (hostParams.get("restrict_dmc").equalsIgnoreCase("false")) {
- record.memoryStaticMin = vmSpec.getMinRam();
- record.memoryStaticMax = vmSpec.getMaxRam();
+ VM.Record vmr = template.getRecord(conn);
+ vmr.affinity = host;
+ vmr.otherConfig.remove("disks");
+ vmr.otherConfig.remove("default_template");
+ vmr.otherConfig.remove("mac_seed");
+ vmr.isATemplate = false;
+ vmr.nameLabel = vmSpec.getName();
+ vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
+ vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
+
+ if (isDmcEnabled(conn, host)) {
+ //scaling is allowed
+ vmr.memoryStaticMin = mem_128m; //128MB
+ //TODO: Remove hardcoded 8GB and assign proportionate to ServiceOffering and mem overcommit ratio
+ vmr.memoryStaticMax = 8589934592L; //8GB
+ vmr.memoryDynamicMin = vmSpec.getMinRam();
+ vmr.memoryDynamicMax = vmSpec.getMaxRam();
} else {
- s_logger.warn("Host "+ _host.uuid + " does not support Dynamic Memory Control, so we cannot scale up the vm");
- record.memoryStaticMin = 134217728L; //128MB
- record.memoryStaticMax = 8589934592L; //8GB
+ //scaling disallowed, set static memory target
+ if (s_logger.isDebugEnabled()) {
+ s_logger.warn("Host "+ host.getHostname(conn) +" does not support dynamic scaling");
+ }
+ vmr.memoryStaticMin = vmSpec.getMinRam();
+ vmr.memoryStaticMax = vmSpec.getMaxRam();
+ vmr.memoryDynamicMin = vmSpec.getMinRam();
+ vmr.memoryDynamicMax = vmSpec.getMaxRam();
}
if (guestOsTypeName.toLowerCase().contains("windows")) {
- record.VCPUsMax = (long) vmSpec.getCpus();
+ vmr.VCPUsMax = (long) vmSpec.getCpus();
} else {
- record.VCPUsMax = 32L;
+ vmr.VCPUsMax = 32L;
}
- record.VCPUsAtStartup = (long) vmSpec.getCpus();
- record.consoles.clear();
+ vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
+ vmr.consoles.clear();
- VM vm = VM.create(conn, record);
- VM.Record vmr = vm.getRecord(conn);
+ VM vm = VM.create(conn, vmr);
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Created VM " + vmr.uuid + " for " + vmSpec.getName());
+ s_logger.debug("Created VM " + vm.getUuid(conn) + " for " + vmSpec.getName());
}
Map<String, String> vcpuParams = new HashMap<String, String>();
@@ -227,4 +233,17 @@ public class XenServer56FP1Resource extends XenServer56Resource {
return vm;
}
+ /**
+ * When Dynamic Memory Control (DMC) is enabled -
+ * xen allows scaling the guest memory while the guest is running
+ *
+ * This is determined by the 'restrict_dmc' option on the host.
+ * When false, scaling is allowed hence DMC is enabled
+ */
+ @Override
+ protected boolean isDmcEnabled(Connection conn, Host host) throws XenAPIException, XmlRpcException {
+ Map<String, String> hostParams = new HashMap<String, String>();
+ hostParams = host.getLicenseParams(conn);
+ return hostParams.get("restrict_dmc").equalsIgnoreCase("false");
+ }
}
[25/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2287: Tests for the LDAP system
API tests for the LDAP config/remove commands
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2778486c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2778486c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2778486c
Branch: refs/heads/pvlan
Commit: 2778486c34427dbc4e66a7f5db0e3b2364cf9f11
Parents: 8986e16
Author: suresh sadhu <su...@citrix.com>
Authored: Mon May 20 14:48:06 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 17:51:49 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_ldap.py | 365 +++++++++++++++++++++++++++++++
1 file changed, 365 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2778486c/test/integration/smoke/test_ldap.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ldap.py b/test/integration/smoke/test_ldap.py
new file mode 100755
index 0000000..1b933db
--- /dev/null
+++ b/test/integration/smoke/test_ldap.py
@@ -0,0 +1,365 @@
+# 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.
+
+""" P1 for LDAP Config
+"""
+
+
+#!/usr/bin/env python
+
+import marvin
+from marvin import cloudstackTestCase
+from marvin.cloudstackTestCase import *
+import unittest
+import hashlib
+import random
+from marvin.cloudstackAPI import *
+from marvin.cloudstackAPI import login
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from nose.plugins.attrib import attr
+import urllib
+
+
+
+class Services:
+ """Test LDAP Configuration
+ """
+
+ def __init__(self):
+ self.services = {
+ "account": {
+ "email": "test@test.com",
+ "firstname": "test",
+ "lastname": "t",
+ "username": "test",
+ "password": "password",
+ },
+ "ldapCon_1":#valid values&Query filter as email.
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(mail=%e))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_2": ##valid values&Query filter as displayName.
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%u))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_3": #Configuration with missing parameters value(queryfilter)
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+
+ "ldapCon_4": #invalid configuration-wrong query filter
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%p))",
+ "searchbase":"CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_5": #Configuration with invalid ldap credentials
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%u))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa"
+ }
+
+
+
+ }
+
+
+class TestLdap(cloudstackTestCase):
+ """
+ This test perform registering ldap configuration details in CS and create a user[ldap user] in CS
+ and validate user credentials against LDAP server:AD
+ """
+
+ @classmethod
+ def setUpClass(cls):
+
+ cls.api_client = super(
+ TestLdap,
+ cls
+ ).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ cls.account = cls.services["account"]
+ cls._cleanup = []
+
+
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ #Cleanup resources used
+ #print "tear down class"
+ cleanup_resources(cls.api_client, cls._cleanup)
+
+ except Exception as tde:
+ raise Exception("Warning: Exception during cleanup : %s" % tde)
+ return
+
+ def setUp(self):
+
+ self.apiclient = self.testClient.getApiClient()
+
+ self.acct = createAccount.createAccountCmd()
+ self.acct.accounttype = 0 #We need a regular user. admins have accounttype=1
+ self.acct.firstname = self.services["account"]["firstname"]
+ self.acct.lastname = self.services["account"]["lastname"]
+ self.acct.password = self.services["account"]["password"]
+ self.acct.username = self.services["account"]["username"]
+ self.acct.email = self.services["account"]["email"]
+ self.acct.account = self.services["account"]["username"]
+ self.acct.domainid = 1
+ # mapping ldap user by creating same user in cloudstack
+
+ self.acctRes = self.apiclient.createAccount(self.acct)
+
+
+ return
+
+ def tearDown(self):
+
+ try:
+ #Clean up, terminate the created accounts, domains etc
+
+ deleteAcct = deleteAccount.deleteAccountCmd()
+ deleteAcct.id = self.acctRes.id
+
+ acct_name=self.acctRes.name
+
+ self.apiclient.deleteAccount(deleteAcct)
+
+ self.debug("Deleted the the following account name %s:" %acct_name)
+ #delete only if ldapconfig registered in CS
+ if(self.ldapconfRes):
+ deleteldapconfg=ldapRemove.ldapRemoveCmd()
+ res=self.apiclient.ldapRemove(deleteldapconfg)
+
+
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+
+ def test_01_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with valid values.(i.e query fileter as email)
+ '''
+ # 1. This test covers ldapConfig & login API with valid ldap credentials..
+ # require ldap configuration:ldapCon_1
+
+ self.debug("start test")
+
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
+
+ if(self.ldapconfRes==1):
+
+
+ self.debug("configure ldap successful")
+
+ #validating the user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_1"]["ldapusername"], self.services["ldapCon_1"]["ldappasswd"])
+ self.assertEquals(loginRes,1,"ldap Authentication failed")
+
+ else:
+
+ self.debug("LDAP Configuration failed with exception")
+
+ self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
+
+
+ self.debug("end test")
+
+
+ def test_02_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with valid values.(i.e query fileter as displayName)
+ '''
+
+ # 1. This test covers ldapConfig & login API with valid ldap credentials.
+ # 2. require ldap configuration:ldapCon_2
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_2"])
+ self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
+ if(self.ldapconfRes==1):
+ self.debug("configure ldap successful")
+ #validating the user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_2"]["ldapusername"], self.services["ldapCon_2"]["ldappasswd"])
+ self.assertEquals(loginRes,1,"ldap Authentication failed")
+ else:
+ self.debug("LDAP Configuration failed with exception")
+ self.debug("end test")
+
+
+ def test_03_configLDAP(self):
+
+ '''
+ This test is to verify ldapConfig API with missing config parameters value(i.queryfilter)
+ '''
+
+ # 1. Issue ldapConfig API with no ldap config parameter value and check behavior
+ # 2. require ldap configuration:ldapCon_3
+
+ self.debug("start test...")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_3"])
+ self.assertEquals(self.ldapconfRes,0,"LDAP configuration successful with invalid value.API failed")
+ self.debug("end test")
+
+ def test_04_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with invalid configuration values(by passing wrong query filter)
+ '''
+ # 1. calling ldapConfig API with invalid query filter value and check behavior
+ # 2. require ldap configuration:ldapCon_4
+
+ self.debug("start test...")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_4"])
+ self.assertEquals(self.ldapconfRes,0,"API failed")
+
+
+
+ def test_05_configLDAP(self):
+
+ '''
+ This test is to verify login API functionality by passing wrong ldap credentials
+ '''
+ # 1.This script first configure the ldap and validates the user credentials using login API
+ # 2. require ldap configuration:ldapCon_5
+
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_5"])
+ self.assertEquals(self.ldapconfRes,1,"API failed")
+ #validating the cloudstack user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_5"]["ldapusername"], self.services["ldapCon_5"]["ldappasswd"])
+ self.assertNotEqual(loginRes,1,"login API failed")
+ self.debug("end test")
+
+ def test_06_removeLDAP(self):
+ '''
+ This test is to verify ldapRemove API functionality
+ '''
+ # 1. This script fist configures ldap and removes the configured ldap values
+ # 2. require ldap configuration:ldapCon_1
+
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
+ if(self.ldapconfRes==1):
+ self.debug("ldap configured successfully")
+ deleteldapconfg=ldapRemove.ldapRemoveCmd()
+ res=self.apiclient.ldapRemove(deleteldapconfg)
+ self.debug("ldap removed successfully")
+ self.ldapconfRes=0
+ else:
+
+ self.debug("LDAP Configuration failed with exception")
+ self.assertEquals(self.ldapconfRes,0,"ldapconfig API failed")
+ self.debug("end test")
+
+ def _testldapConfig(self,ldapSrvD):
+
+ """
+
+ :param ldapSrvD
+
+
+ """
+ #This Method takes dictionary as parameter,
+ # reads the ldap configuration values from the passed dictionary and
+ # register the ldapconfig detail in cloudstack
+ # & return true or false based on ldapconfig API response
+
+ self.debug("start ldapconfig test")
+ #creating the ldapconfig cmd object
+ lpconfig = ldapConfig.ldapConfigCmd()
+ #Config the ldap server by assigning the ldapconfig dict variable values to ldapConfig object
+ lpconfig.hostname = ldapSrvD["ldapHostname"]
+ lpconfig.port = ldapSrvD["port"]
+ lpconfig.binddn = ldapSrvD["binddn"]
+ lpconfig.bindpass = ldapSrvD["bindpass"]
+ lpconfig.searchbase = ldapSrvD["searchbase"]
+ lpconfig.queryfilter = ldapSrvD["queryfilter"]
+
+ #end of assigning the variables
+
+ #calling the ldapconfig Api
+ self.debug("calling ldapconfig API")
+ try:
+ lpconfig1 = self.apiclient.ldapConfig(lpconfig)
+ self.debug("ldapconfig API succesfful")
+ return 1
+ except Exception, e:
+ self.debug("ldapconfig API failed %s" %e)
+ return 0
+
+ def chkLogin(self, username, password):
+ """
+
+ :param username:
+ :param password:
+
+ """
+ self.debug("login test")
+
+ try:
+ login1 = login.loginCmd()
+ login1.username = username
+ login1.password = password
+ loginRes = self.apiclient.login(login1)
+ self.debug("login response %s" % loginRes)
+ if loginRes is None:
+ self.debug("login not successful")
+ else:
+ self.debug("login successful")
+ return 1
+
+ except Exception, p:
+ self.debug("login operation failed %s" %p)
+ self.debug("end of Login")
[28/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
migrate only when hosts are available
Identify the hosts that are suitable for migration before proceeding
with migrateVM
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e1ad36bc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e1ad36bc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e1ad36bc
Branch: refs/heads/pvlan
Commit: e1ad36bccb70a9f73de1d06b408043a93876195c
Parents: 92e6352
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 17:51:18 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 17:51:50 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_vm_life_cycle.py | 131 +++++++++++-----------
1 file changed, 66 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e1ad36bc/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 21c2635..3f7c17b 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -135,35 +135,34 @@ class TestDeployVM(cloudstackTestCase):
cls.apiclient = super(TestDeployVM, cls).getClsTestClient().getApiClient()
# Get Zone, Domain and templates
domain = get_domain(cls.apiclient, cls.services)
- zone = get_zone(cls.apiclient, cls.services)
- cls.services['mode'] = zone.networktype
+ cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.services['mode'] = cls.zone.networktype
#If local storage is enabled, alter the offerings to use localstorage
#this step is needed for devcloud
- if zone.localstorageenabled == True:
+ if cls.zone.localstorageenabled == True:
cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
cls.services["service_offerings"]["small"]["storagetype"] = 'local'
cls.services["service_offerings"]["medium"]["storagetype"] = 'local'
template = get_template(
cls.apiclient,
- zone.id,
+ cls.zone.id,
cls.services["ostype"]
)
# Set Zones and disk offerings
- cls.services["small"]["zoneid"] = zone.id
+ cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
- cls.services["medium"]["zoneid"] = zone.id
+ cls.services["medium"]["zoneid"] = cls.zone.id
cls.services["medium"]["template"] = template.id
- cls.services["iso"]["zoneid"] = zone.id
+ cls.services["iso"]["zoneid"] = cls.zone.id
cls.account = Account.create(
cls.apiclient,
cls.services["account"],
domainid=domain.id
)
- cls.debug(str("============" ))
cls.debug(cls.account.id)
cls.service_offering = ServiceOffering.create(
@@ -811,68 +810,76 @@ class TestVMLifeCycle(cloudstackTestCase):
"""Test migrate VM
"""
# Validate the following
- # 1. Should be able to login to the VM.
- # 2. listVM command should return this VM.State of this VM
- # should be "Running" and the host should be the host
- # to which the VM was migrated to
+ # 1. Environment has enough hosts for migration
+ # 2. DeployVM on suitable host (with another host in the cluster)
+ # 3. Migrate the VM and assert migration successful
hosts = Host.list(
- self.apiclient,
- zoneid=self.medium_virtual_machine.zoneid,
- type='Routing'
- )
-
+ self.apiclient,
+ zoneid=self.zone.id,
+ type='Routing'
+ )
self.assertEqual(
- isinstance(hosts, list),
- True,
- "Check the number of hosts in the zone"
- )
+ isinstance(hosts, list),
+ True,
+ "Check the number of hosts in the zone"
+ )
self.assertGreaterEqual(
- len(hosts),
- 2,
- "Atleast 2 hosts should be present in a zone for VM migration"
- )
- # Remove the host of current VM from the hosts list
- hosts[:] = [host for host in hosts if host.id != self.medium_virtual_machine.hostid]
+ len(hosts),
+ 2,
+ "Atleast 2 hosts should be present for VM migration"
+ )
- host = hosts[0]
+ #identify suitable host
+ clusters = [h.clusterid for h in hosts]
+ #find hosts withe same clusterid
+ clusters = [cluster for index, cluster in enumerate(clusters) if clusters.count(cluster) > 1]
+
+ if len(clusters) <= 1:
+ self.skipTest("Migration needs a cluster with at least two hosts")
+
+ suitable_hosts = [host for host in hosts if host.clusterid == clusters[0]]
+ target_host = suitable_hosts[0]
+ migrate_host = suitable_hosts[1]
+
+ #deploy VM on target host
+ self.vm_to_migrate = VirtualMachine.create(
+ self.api_client,
+ self.services["small"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.small_offering.id,
+ mode=self.services["mode"],
+ hostid=target_host.id
+ )
self.debug("Migrating VM-ID: %s to Host: %s" % (
- self.medium_virtual_machine.id,
- host.id
+ self.vm_to_migrate.id,
+ migrate_host.id
))
- cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
- cmd.hostid = host.id
- cmd.virtualmachineid = self.medium_virtual_machine.id
- self.apiclient.migrateVirtualMachine(cmd)
+ self.vm_to_migrate.migrate(self.api_client, migrate_host.id)
list_vm_response = list_virtual_machines(
self.apiclient,
- id=self.medium_virtual_machine.id
+ id=self.vm_to_migrate.id
)
- self.assertEqual(
- isinstance(list_vm_response, list),
- True,
- "Check list response returns a valid list"
- )
-
self.assertNotEqual(
list_vm_response,
None,
- "Check virtual machine is listVirtualMachines"
+ "Check virtual machine is listed"
)
vm_response = list_vm_response[0]
self.assertEqual(
vm_response.id,
- self.medium_virtual_machine.id,
+ self.vm_to_migrate.id,
"Check virtual machine ID of migrated VM"
)
self.assertEqual(
vm_response.hostid,
- host.id,
+ migrate_host.id,
"Check destination hostID of migrated VM"
)
return
@@ -964,29 +971,25 @@ class TestVMLifeCycle(cloudstackTestCase):
try:
ssh_client = self.virtual_machine.get_ssh_client()
-
- cmds = [
- "mkdir -p %s" % self.services["mount_dir"],
- "mount -rt iso9660 %s %s" \
- % (
- self.services["diskdevice"],
- self.services["mount_dir"]
- ),
- ]
-
- for c in cmds:
- res = ssh_client.execute(c)
-
- self.assertEqual(res, [], "Check mount is successful or not")
-
- c = "fdisk -l|grep %s|head -1" % self.services["diskdevice"]
- res = ssh_client.execute(c)
- #Disk /dev/xvdd: 4393 MB, 4393723904 bytes
-
except Exception as e:
self.fail("SSH failed for virtual machine: %s - %s" %
(self.virtual_machine.ipaddress, e))
+ cmds = [
+ "mkdir -p %s" % self.services["mount_dir"],
+ "mount -rt iso9660 %s %s" \
+ % (
+ self.services["diskdevice"],
+ self.services["mount_dir"]
+ ),
+ ]
+ for c in cmds:
+ res = ssh_client.execute(c)
+ self.assertEqual(res, [], "Check mount is successful or not")
+ c = "fdisk -l|grep %s|head -1" % self.services["diskdevice"]
+ res = ssh_client.execute(c)
+ #Disk /dev/xvdd: 4393 MB, 4393723904 bytes
+
# Res may contain more than one strings depending on environment
# Split strings to form new list which is used for assertion on ISO size
result = []
@@ -1015,7 +1018,6 @@ class TestVMLifeCycle(cloudstackTestCase):
#Unmount ISO
command = "umount %s" % self.services["mount_dir"]
ssh_client.execute(command)
-
except Exception as e:
self.fail("SSH failed for virtual machine: %s - %s" %
(self.virtual_machine.ipaddress, e))
@@ -1027,7 +1029,6 @@ class TestVMLifeCycle(cloudstackTestCase):
try:
res = ssh_client.execute(c)
-
except Exception as e:
self.fail("SSH failed for virtual machine: %s - %s" %
(self.virtual_machine.ipaddress, e))
[43/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-1638: Introduce NetworkMigrationResponder
The location of the virtual machine is provided by DeployDestination, which will
be passed in NetworkGuru#reserve and NetworkElement#prepare.
During the virtual machine migration, it actually changes DeployDestination and
it looks like that it will tell that event to network components as it has
NetworkManager#prepareNicForMigration. The problem is that althogh the interface
has that method, NetworkManagerImpl does not tell the DeployDestination changes
to network components.
So IMHO, we need to add calls of NetworkGuru#reserve and NetworkElement#prepare
in NetworkManagerImpl#prepareNicForMigration . And then, we also need to add
calls NetworkGuru#release and NetworkElement#release after the migration,
otherwise the network resources that plugin reserved will be kept even when the
vm leaves off.
(Sheng Yang: rebase code, add license header)
Signed-off-by: Sheng Yang <sh...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7260e8d8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7260e8d8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7260e8d8
Branch: refs/heads/pvlan
Commit: 7260e8d83f07d90b48c34adaeb227de265019487
Parents: cf6045f
Author: Hiroaki Kawai <ka...@stratosphere.co.jp>
Authored: Fri May 3 10:43:20 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon May 20 16:43:18 2013 -0700
----------------------------------------------------------------------
.../network/NetworkMigrationResponder.java | 70 +++++++++++++++++++
.../src/com/cloud/network/NetworkManager.java | 29 +++++++-
.../com/cloud/network/NetworkManagerImpl.java | 72 +++++++++++++++++++-
.../com/cloud/vm/VirtualMachineManagerImpl.java | 11 +++
.../cloud/network/MockNetworkManagerImpl.java | 29 ++++++--
.../com/cloud/vpc/MockNetworkManagerImpl.java | 48 +++++++++----
6 files changed, 239 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/api/src/com/cloud/network/NetworkMigrationResponder.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/NetworkMigrationResponder.java b/api/src/com/cloud/network/NetworkMigrationResponder.java
new file mode 100644
index 0000000..6283cc5
--- /dev/null
+++ b/api/src/com/cloud/network/NetworkMigrationResponder.java
@@ -0,0 +1,70 @@
+// 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 com.cloud.network;
+
+import com.cloud.deploy.DeployDestination;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.VirtualMachineProfile;
+
+/**
+ * NetworkGuru and NetworkElements that implement this interface
+ * will be called during Virtual Machine migration.
+ */
+public interface NetworkMigrationResponder {
+ /**
+ * Prepare for migration.
+ *
+ * This method will be called per nic before the vm migration.
+ * @param nic
+ * @param network
+ * @param vm
+ * @param dest
+ * @param context
+ * @return true when operation was successful.
+ */
+ public boolean prepareMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context);
+
+ /**
+ * Cancel for migration preparation.
+ *
+ * This method will be called per nic when the entire vm migration
+ * process failed and need to release the resouces that was
+ * allocated at the migration preparation.
+ * @param nic destination nic
+ * @param network destination network
+ * @param vm destination vm profile
+ * @param src The context nic migrates from.
+ * @param dst The context nic migrates to.
+ */
+ public void rollbackMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
+
+ /**
+ * Commit the migration resource.
+ *
+ * This method will be called per nic when the entire vm migration
+ * process was successful. This is useful to release the resource of
+ * source deployment where vm has left.
+ * @param nic source nic
+ * @param network source network
+ * @param vm source vm profile
+ * @param src the context nic migrates from.
+ * @param dst the context nic migrates to.
+ */
+ public void commitMigration(NicProfile nic, Network network, VirtualMachineProfile<? extends VirtualMachine> vm, ReservationContext src, ReservationContext dst);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManager.java b/server/src/com/cloud/network/NetworkManager.java
index 1e4fb84..05bc26e 100755
--- a/server/src/com/cloud/network/NetworkManager.java
+++ b/server/src/com/cloud/network/NetworkManager.java
@@ -123,7 +123,34 @@ public interface NetworkManager {
Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException;
- <T extends VMInstanceVO> void prepareNicForMigration(VirtualMachineProfile<T> vm, DeployDestination dest);
+ /**
+ * prepares vm nic change for migration
+ *
+ * This method will be called in migration transaction before the vm migration.
+ * @param vm
+ * @param dest
+ */
+ void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest);
+
+ /**
+ * commit vm nic change for migration
+ *
+ * This method will be called in migration transaction after the successful
+ * vm migration.
+ * @param src
+ * @param dst
+ */
+ void commitNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
+
+ /**
+ * rollback vm nic change for migration
+ *
+ * This method will be called in migaration transaction after vm migration
+ * failure.
+ * @param src
+ * @param dst
+ */
+ void rollbackNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> src, VirtualMachineProfile<? extends VMInstanceVO> dst);
boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index b3df0da..0f43b87 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2000,8 +2000,9 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
}
@Override
- public <T extends VMInstanceVO> void prepareNicForMigration(VirtualMachineProfile<T> vm, DeployDestination dest) {
+ public void prepareNicForMigration(VirtualMachineProfile<? extends VMInstanceVO> vm, DeployDestination dest) {
List<NicVO> nics = _nicDao.listByVmId(vm.getId());
+ ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
for (NicVO nic : nics) {
NetworkVO network = _networksDao.findById(nic.getNetworkId());
Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
@@ -2009,11 +2010,80 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate,
_networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vm.getHypervisorType(), network));
+ if(guru instanceof NetworkMigrationResponder){
+ if(!((NetworkMigrationResponder) guru).prepareMigration(profile, network, vm, dest, context)){
+ s_logger.error("NetworkGuru "+guru+" prepareForMigration failed."); // XXX: Transaction error
+ }
+ }
+ for (NetworkElement element : _networkElements) {
+ if(element instanceof NetworkMigrationResponder){
+ if(!((NetworkMigrationResponder) element).prepareMigration(profile, network, vm, dest, context)){
+ s_logger.error("NetworkElement "+element+" prepareForMigration failed."); // XXX: Transaction error
+ }
+ }
+ }
guru.updateNicProfile(profile, network);
vm.addNic(profile);
}
}
+ private NicProfile findNicProfileById(VirtualMachineProfile<? extends VMInstanceVO> vm, long id){
+ for(NicProfile nic: vm.getNics()){
+ if(nic.getId() == id){
+ return nic;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void commitNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ for(NicProfile nicSrc: src.getNics()){
+ NetworkVO network = _networksDao.findById(nicSrc.getNetworkId());
+ NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
+ NicProfile nicDst = findNicProfileById(dst, nicSrc.getId());
+ ReservationContext src_context = new ReservationContextImpl(nicSrc.getReservationId(), null, null);
+ ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null);
+
+ if(guru instanceof NetworkMigrationResponder){
+ ((NetworkMigrationResponder) guru).commitMigration(nicSrc, network, src, src_context, dst_context);
+ }
+ for (NetworkElement element : _networkElements) {
+ if(element instanceof NetworkMigrationResponder){
+ ((NetworkMigrationResponder) element).commitMigration(nicSrc, network, src, src_context, dst_context);
+ }
+ }
+ // update the reservation id
+ NicVO nicVo = _nicDao.findById(nicDst.getId());
+ nicVo.setReservationId(nicDst.getReservationId());
+ _nicDao.persist(nicVo);
+ }
+ }
+
+ @Override
+ public void rollbackNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ for(NicProfile nicDst: dst.getNics()){
+ NetworkVO network = _networksDao.findById(nicDst.getNetworkId());
+ NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName());
+ NicProfile nicSrc = findNicProfileById(src, nicDst.getId());
+ ReservationContext src_context = new ReservationContextImpl(nicSrc.getReservationId(), null, null);
+ ReservationContext dst_context = new ReservationContextImpl(nicDst.getReservationId(), null, null);
+
+ if(guru instanceof NetworkMigrationResponder){
+ ((NetworkMigrationResponder) guru).rollbackMigration(nicDst, network, dst, src_context, dst_context);
+ }
+ for (NetworkElement element : _networkElements) {
+ if(element instanceof NetworkMigrationResponder){
+ ((NetworkMigrationResponder) element).rollbackMigration(nicDst, network, dst, src_context, dst_context);
+ }
+ }
+ }
+ }
+
@Override
@DB
public void release(VirtualMachineProfile<? extends VMInstanceVO> vmProfile, boolean forced) throws
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 58d95ab..f487537 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -1414,6 +1414,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
alertType = AlertManager.ALERT_TYPE_CONSOLE_PROXY_MIGRATE;
}
+ VirtualMachineProfile<VMInstanceVO> vmSrc = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
+ for(NicProfile nic: _networkMgr.getNicProfiles(vm)){
+ vmSrc.addNic(nic);
+ }
+
VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
_networkMgr.prepareNicForMigration(profile, dest);
this.volumeMgr.prepareForMigration(profile, dest);
@@ -1439,6 +1444,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
throw new AgentUnavailableException("Operation timed out", dstHostId);
} finally {
if (pfma == null) {
+ _networkMgr.rollbackNicForMigration(vmSrc, profile);
work.setStep(Step.Done);
_workDao.update(work.getId(), work);
}
@@ -1447,10 +1453,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
vm.setLastHostId(srcHostId);
try {
if (vm == null || vm.getHostId() == null || vm.getHostId() != srcHostId || !changeState(vm, Event.MigrationRequested, dstHostId, work, Step.Migrating)) {
+ _networkMgr.rollbackNicForMigration(vmSrc, profile);
s_logger.info("Migration cancelled because state has changed: " + vm);
throw new ConcurrentOperationException("Migration cancelled because state has changed: " + vm);
}
} catch (NoTransitionException e1) {
+ _networkMgr.rollbackNicForMigration(vmSrc, profile);
s_logger.info("Migration cancelled because " + e1.getMessage());
throw new ConcurrentOperationException("Migration cancelled because " + e1.getMessage());
}
@@ -1502,6 +1510,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
} finally {
if (!migrated) {
s_logger.info("Migration was unsuccessful. Cleaning up: " + vm);
+ _networkMgr.rollbackNicForMigration(vmSrc, profile);
_alertMgr.sendAlert(alertType, fromHost.getDataCenterId(), fromHost.getPodId(), "Unable to migrate vm " + vm.getInstanceName() + " from host " + fromHost.getName() + " in zone "
+ dest.getDataCenter().getName() + " and pod " + dest.getPod().getName(), "Migrate Command failed. Please check logs.");
@@ -1516,6 +1525,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
} catch (NoTransitionException e) {
s_logger.warn(e.getMessage());
}
+ }else{
+ _networkMgr.commitNicForMigration(vmSrc, profile);
}
work.setStep(Step.Done);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockNetworkManagerImpl.java b/server/test/com/cloud/network/MockNetworkManagerImpl.java
index 1ac014d..e5d34fb 100755
--- a/server/test/com/cloud/network/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/network/MockNetworkManagerImpl.java
@@ -278,12 +278,6 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
@Override
- public <T extends VMInstanceVO> void prepareNicForMigration(VirtualMachineProfile<T> vm, DeployDestination dest) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public boolean destroyNetwork(long networkId, ReservationContext context) {
// TODO Auto-generated method stub
return false;
@@ -966,4 +960,27 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
public PublicIp assignPublicIpAddressFromVlans(long dcId, Long podId, Account owner, VlanType type, List<Long> vlanDbIds, Long networkId, String requestedIp, boolean isSystem) throws InsufficientAddressCapacityException {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
+
+ @Override
+ public void prepareNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> vm,
+ DeployDestination dest) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void commitNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void rollbackNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ // TODO Auto-generated method stub
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7260e8d8/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 62599b8..7129273 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -845,18 +845,6 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
- /* (non-Javadoc)
- * @see com.cloud.network.NetworkManager#prepareNicForMigration(com.cloud.vm.VirtualMachineProfile, com.cloud.deploy.DeployDestination)
- */
- @Override
- public <T extends VMInstanceVO> void prepareNicForMigration(VirtualMachineProfile<T> vm, DeployDestination dest) {
- // TODO Auto-generated method stub
-
- }
-
-
-
-
/* (non-Javadoc)
* @see com.cloud.network.NetworkManager#shutdownNetwork(long, com.cloud.vm.ReservationContext, boolean)
@@ -1471,4 +1459,40 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
}
+
+
+
+ @Override
+ public void prepareNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> vm,
+ DeployDestination dest) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+
+
+ @Override
+ public void commitNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+
+
+ @Override
+ public void rollbackNicForMigration(
+ VirtualMachineProfile<? extends VMInstanceVO> src,
+ VirtualMachineProfile<? extends VMInstanceVO> dst) {
+ // TODO Auto-generated method stub
+
+ }
+
+
}
[21/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-1871 : domainId parameter to uploadVolume not working
1. Remove duplicated lines for setting domainId.
2. Set domainId with owner's domain if the owner is specified.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/63e92a4e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/63e92a4e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/63e92a4e
Branch: refs/heads/pvlan
Commit: 63e92a4ea6766212d4450cde3cf205d661a6419d
Parents: 85d54cd
Author: Isaac Chiang <is...@gmail.com>
Authored: Mon May 20 08:54:13 2013 +0800
Committer: Isaac Chiang <is...@gmail.com>
Committed: Mon May 20 08:54:13 2013 +0800
----------------------------------------------------------------------
server/src/com/cloud/storage/VolumeManagerImpl.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/63e92a4e/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index 2f4b2c8..55e20cf 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -708,19 +708,19 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
VolumeVO volume = new VolumeVO(volumeName, zoneId, -1, -1, -1,
new Long(-1), null, null, 0, Volume.Type.DATADISK);
+ Account owner = (caller.getId() == ownerId) ? caller : _accountMgr
+ .getActiveAccountById(ownerId);
volume.setPoolId(null);
volume.setDataCenterId(zoneId);
volume.setPodId(null);
volume.setAccountId(ownerId);
- volume.setDomainId(((caller == null) ? Domain.ROOT_DOMAIN : caller
- .getDomainId()));
long diskOfferingId = _diskOfferingDao.findByUniqueName(
"Cloud.com-Custom").getId();
volume.setDiskOfferingId(diskOfferingId);
// volume.setSize(size);
volume.setInstanceId(null);
volume.setUpdated(new Date());
- volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller
+ volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner
.getDomainId());
volume = _volsDao.persist(volume);
[29/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
LDAP moved to regression suite.
LDAP requires a Directory server which isn't available by default in
most environments. Moving this to the regression suite so it can be run
on demand.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/32e7ba23
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/32e7ba23
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/32e7ba23
Branch: refs/heads/pvlan
Commit: 32e7ba23a3bd514f7b4026b522913def406383c1
Parents: e1ad36b
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 17:59:19 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 17:59:19 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_ldap.py | 365 +++++++++++++++++++++++++++
test/integration/smoke/test_ldap.py | 365 ---------------------------
2 files changed, 365 insertions(+), 365 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32e7ba23/test/integration/component/test_ldap.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ldap.py b/test/integration/component/test_ldap.py
new file mode 100755
index 0000000..1b933db
--- /dev/null
+++ b/test/integration/component/test_ldap.py
@@ -0,0 +1,365 @@
+# 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.
+
+""" P1 for LDAP Config
+"""
+
+
+#!/usr/bin/env python
+
+import marvin
+from marvin import cloudstackTestCase
+from marvin.cloudstackTestCase import *
+import unittest
+import hashlib
+import random
+from marvin.cloudstackAPI import *
+from marvin.cloudstackAPI import login
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from nose.plugins.attrib import attr
+import urllib
+
+
+
+class Services:
+ """Test LDAP Configuration
+ """
+
+ def __init__(self):
+ self.services = {
+ "account": {
+ "email": "test@test.com",
+ "firstname": "test",
+ "lastname": "t",
+ "username": "test",
+ "password": "password",
+ },
+ "ldapCon_1":#valid values&Query filter as email.
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(mail=%e))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_2": ##valid values&Query filter as displayName.
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%u))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_3": #Configuration with missing parameters value(queryfilter)
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+
+ "ldapCon_4": #invalid configuration-wrong query filter
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%p))",
+ "searchbase":"CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa_1111"
+ },
+ "ldapCon_5": #Configuration with invalid ldap credentials
+ {
+ "ldapHostname": "10.147.38.163",
+ "port": "389",
+ "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
+ "bindpass": "aaaa_1111",
+ "queryfilter": "(&(displayName=%u))",
+ "searchbase": "CN=Users,DC=hyd-qa,DC=com",
+ "ldapusername": "test",
+ "ldappasswd": "aaaa"
+ }
+
+
+
+ }
+
+
+class TestLdap(cloudstackTestCase):
+ """
+ This test perform registering ldap configuration details in CS and create a user[ldap user] in CS
+ and validate user credentials against LDAP server:AD
+ """
+
+ @classmethod
+ def setUpClass(cls):
+
+ cls.api_client = super(
+ TestLdap,
+ cls
+ ).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ cls.account = cls.services["account"]
+ cls._cleanup = []
+
+
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ #Cleanup resources used
+ #print "tear down class"
+ cleanup_resources(cls.api_client, cls._cleanup)
+
+ except Exception as tde:
+ raise Exception("Warning: Exception during cleanup : %s" % tde)
+ return
+
+ def setUp(self):
+
+ self.apiclient = self.testClient.getApiClient()
+
+ self.acct = createAccount.createAccountCmd()
+ self.acct.accounttype = 0 #We need a regular user. admins have accounttype=1
+ self.acct.firstname = self.services["account"]["firstname"]
+ self.acct.lastname = self.services["account"]["lastname"]
+ self.acct.password = self.services["account"]["password"]
+ self.acct.username = self.services["account"]["username"]
+ self.acct.email = self.services["account"]["email"]
+ self.acct.account = self.services["account"]["username"]
+ self.acct.domainid = 1
+ # mapping ldap user by creating same user in cloudstack
+
+ self.acctRes = self.apiclient.createAccount(self.acct)
+
+
+ return
+
+ def tearDown(self):
+
+ try:
+ #Clean up, terminate the created accounts, domains etc
+
+ deleteAcct = deleteAccount.deleteAccountCmd()
+ deleteAcct.id = self.acctRes.id
+
+ acct_name=self.acctRes.name
+
+ self.apiclient.deleteAccount(deleteAcct)
+
+ self.debug("Deleted the the following account name %s:" %acct_name)
+ #delete only if ldapconfig registered in CS
+ if(self.ldapconfRes):
+ deleteldapconfg=ldapRemove.ldapRemoveCmd()
+ res=self.apiclient.ldapRemove(deleteldapconfg)
+
+
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+
+ def test_01_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with valid values.(i.e query fileter as email)
+ '''
+ # 1. This test covers ldapConfig & login API with valid ldap credentials..
+ # require ldap configuration:ldapCon_1
+
+ self.debug("start test")
+
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
+
+ if(self.ldapconfRes==1):
+
+
+ self.debug("configure ldap successful")
+
+ #validating the user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_1"]["ldapusername"], self.services["ldapCon_1"]["ldappasswd"])
+ self.assertEquals(loginRes,1,"ldap Authentication failed")
+
+ else:
+
+ self.debug("LDAP Configuration failed with exception")
+
+ self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
+
+
+ self.debug("end test")
+
+
+ def test_02_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with valid values.(i.e query fileter as displayName)
+ '''
+
+ # 1. This test covers ldapConfig & login API with valid ldap credentials.
+ # 2. require ldap configuration:ldapCon_2
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_2"])
+ self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
+ if(self.ldapconfRes==1):
+ self.debug("configure ldap successful")
+ #validating the user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_2"]["ldapusername"], self.services["ldapCon_2"]["ldappasswd"])
+ self.assertEquals(loginRes,1,"ldap Authentication failed")
+ else:
+ self.debug("LDAP Configuration failed with exception")
+ self.debug("end test")
+
+
+ def test_03_configLDAP(self):
+
+ '''
+ This test is to verify ldapConfig API with missing config parameters value(i.queryfilter)
+ '''
+
+ # 1. Issue ldapConfig API with no ldap config parameter value and check behavior
+ # 2. require ldap configuration:ldapCon_3
+
+ self.debug("start test...")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_3"])
+ self.assertEquals(self.ldapconfRes,0,"LDAP configuration successful with invalid value.API failed")
+ self.debug("end test")
+
+ def test_04_configLDAP(self):
+ '''
+ This test is to verify ldapConfig API with invalid configuration values(by passing wrong query filter)
+ '''
+ # 1. calling ldapConfig API with invalid query filter value and check behavior
+ # 2. require ldap configuration:ldapCon_4
+
+ self.debug("start test...")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_4"])
+ self.assertEquals(self.ldapconfRes,0,"API failed")
+
+
+
+ def test_05_configLDAP(self):
+
+ '''
+ This test is to verify login API functionality by passing wrong ldap credentials
+ '''
+ # 1.This script first configure the ldap and validates the user credentials using login API
+ # 2. require ldap configuration:ldapCon_5
+
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_5"])
+ self.assertEquals(self.ldapconfRes,1,"API failed")
+ #validating the cloudstack user credentials with ldap Server
+ loginRes = self.chkLogin(self.services["ldapCon_5"]["ldapusername"], self.services["ldapCon_5"]["ldappasswd"])
+ self.assertNotEqual(loginRes,1,"login API failed")
+ self.debug("end test")
+
+ def test_06_removeLDAP(self):
+ '''
+ This test is to verify ldapRemove API functionality
+ '''
+ # 1. This script fist configures ldap and removes the configured ldap values
+ # 2. require ldap configuration:ldapCon_1
+
+
+ self.debug("start test")
+ self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
+ if(self.ldapconfRes==1):
+ self.debug("ldap configured successfully")
+ deleteldapconfg=ldapRemove.ldapRemoveCmd()
+ res=self.apiclient.ldapRemove(deleteldapconfg)
+ self.debug("ldap removed successfully")
+ self.ldapconfRes=0
+ else:
+
+ self.debug("LDAP Configuration failed with exception")
+ self.assertEquals(self.ldapconfRes,0,"ldapconfig API failed")
+ self.debug("end test")
+
+ def _testldapConfig(self,ldapSrvD):
+
+ """
+
+ :param ldapSrvD
+
+
+ """
+ #This Method takes dictionary as parameter,
+ # reads the ldap configuration values from the passed dictionary and
+ # register the ldapconfig detail in cloudstack
+ # & return true or false based on ldapconfig API response
+
+ self.debug("start ldapconfig test")
+ #creating the ldapconfig cmd object
+ lpconfig = ldapConfig.ldapConfigCmd()
+ #Config the ldap server by assigning the ldapconfig dict variable values to ldapConfig object
+ lpconfig.hostname = ldapSrvD["ldapHostname"]
+ lpconfig.port = ldapSrvD["port"]
+ lpconfig.binddn = ldapSrvD["binddn"]
+ lpconfig.bindpass = ldapSrvD["bindpass"]
+ lpconfig.searchbase = ldapSrvD["searchbase"]
+ lpconfig.queryfilter = ldapSrvD["queryfilter"]
+
+ #end of assigning the variables
+
+ #calling the ldapconfig Api
+ self.debug("calling ldapconfig API")
+ try:
+ lpconfig1 = self.apiclient.ldapConfig(lpconfig)
+ self.debug("ldapconfig API succesfful")
+ return 1
+ except Exception, e:
+ self.debug("ldapconfig API failed %s" %e)
+ return 0
+
+ def chkLogin(self, username, password):
+ """
+
+ :param username:
+ :param password:
+
+ """
+ self.debug("login test")
+
+ try:
+ login1 = login.loginCmd()
+ login1.username = username
+ login1.password = password
+ loginRes = self.apiclient.login(login1)
+ self.debug("login response %s" % loginRes)
+ if loginRes is None:
+ self.debug("login not successful")
+ else:
+ self.debug("login successful")
+ return 1
+
+ except Exception, p:
+ self.debug("login operation failed %s" %p)
+ self.debug("end of Login")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/32e7ba23/test/integration/smoke/test_ldap.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_ldap.py b/test/integration/smoke/test_ldap.py
deleted file mode 100755
index 1b933db..0000000
--- a/test/integration/smoke/test_ldap.py
+++ /dev/null
@@ -1,365 +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.
-
-""" P1 for LDAP Config
-"""
-
-
-#!/usr/bin/env python
-
-import marvin
-from marvin import cloudstackTestCase
-from marvin.cloudstackTestCase import *
-import unittest
-import hashlib
-import random
-from marvin.cloudstackAPI import *
-from marvin.cloudstackAPI import login
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-from nose.plugins.attrib import attr
-import urllib
-
-
-
-class Services:
- """Test LDAP Configuration
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "test",
- "lastname": "t",
- "username": "test",
- "password": "password",
- },
- "ldapCon_1":#valid values&Query filter as email.
- {
- "ldapHostname": "10.147.38.163",
- "port": "389",
- "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
- "bindpass": "aaaa_1111",
- "queryfilter": "(&(mail=%e))",
- "searchbase": "CN=Users,DC=hyd-qa,DC=com",
- "ldapusername": "test",
- "ldappasswd": "aaaa_1111"
- },
- "ldapCon_2": ##valid values&Query filter as displayName.
- {
- "ldapHostname": "10.147.38.163",
- "port": "389",
- "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
- "bindpass": "aaaa_1111",
- "queryfilter": "(&(displayName=%u))",
- "searchbase": "CN=Users,DC=hyd-qa,DC=com",
- "ldapusername": "test",
- "ldappasswd": "aaaa_1111"
- },
- "ldapCon_3": #Configuration with missing parameters value(queryfilter)
- {
- "ldapHostname": "10.147.38.163",
- "port": "389",
- "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
- "bindpass": "aaaa_1111",
- "queryfilter": "",
- "searchbase": "CN=Users,DC=hyd-qa,DC=com",
- "ldapusername": "test",
- "ldappasswd": "aaaa_1111"
- },
-
- "ldapCon_4": #invalid configuration-wrong query filter
- {
- "ldapHostname": "10.147.38.163",
- "port": "389",
- "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
- "bindpass": "aaaa_1111",
- "queryfilter": "(&(displayName=%p))",
- "searchbase":"CN=Users,DC=hyd-qa,DC=com",
- "ldapusername": "test",
- "ldappasswd": "aaaa_1111"
- },
- "ldapCon_5": #Configuration with invalid ldap credentials
- {
- "ldapHostname": "10.147.38.163",
- "port": "389",
- "binddn": "CN=test,CN=Users,DC=hyd-qa,DC=com",
- "bindpass": "aaaa_1111",
- "queryfilter": "(&(displayName=%u))",
- "searchbase": "CN=Users,DC=hyd-qa,DC=com",
- "ldapusername": "test",
- "ldappasswd": "aaaa"
- }
-
-
-
- }
-
-
-class TestLdap(cloudstackTestCase):
- """
- This test perform registering ldap configuration details in CS and create a user[ldap user] in CS
- and validate user credentials against LDAP server:AD
- """
-
- @classmethod
- def setUpClass(cls):
-
- cls.api_client = super(
- TestLdap,
- cls
- ).getClsTestClient().getApiClient()
- cls.services = Services().services
- cls.account = cls.services["account"]
- cls._cleanup = []
-
-
-
- @classmethod
- def tearDownClass(cls):
- try:
- #Cleanup resources used
- #print "tear down class"
- cleanup_resources(cls.api_client, cls._cleanup)
-
- except Exception as tde:
- raise Exception("Warning: Exception during cleanup : %s" % tde)
- return
-
- def setUp(self):
-
- self.apiclient = self.testClient.getApiClient()
-
- self.acct = createAccount.createAccountCmd()
- self.acct.accounttype = 0 #We need a regular user. admins have accounttype=1
- self.acct.firstname = self.services["account"]["firstname"]
- self.acct.lastname = self.services["account"]["lastname"]
- self.acct.password = self.services["account"]["password"]
- self.acct.username = self.services["account"]["username"]
- self.acct.email = self.services["account"]["email"]
- self.acct.account = self.services["account"]["username"]
- self.acct.domainid = 1
- # mapping ldap user by creating same user in cloudstack
-
- self.acctRes = self.apiclient.createAccount(self.acct)
-
-
- return
-
- def tearDown(self):
-
- try:
- #Clean up, terminate the created accounts, domains etc
-
- deleteAcct = deleteAccount.deleteAccountCmd()
- deleteAcct.id = self.acctRes.id
-
- acct_name=self.acctRes.name
-
- self.apiclient.deleteAccount(deleteAcct)
-
- self.debug("Deleted the the following account name %s:" %acct_name)
- #delete only if ldapconfig registered in CS
- if(self.ldapconfRes):
- deleteldapconfg=ldapRemove.ldapRemoveCmd()
- res=self.apiclient.ldapRemove(deleteldapconfg)
-
-
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
-
- def test_01_configLDAP(self):
- '''
- This test is to verify ldapConfig API with valid values.(i.e query fileter as email)
- '''
- # 1. This test covers ldapConfig & login API with valid ldap credentials..
- # require ldap configuration:ldapCon_1
-
- self.debug("start test")
-
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
-
- if(self.ldapconfRes==1):
-
-
- self.debug("configure ldap successful")
-
- #validating the user credentials with ldap Server
- loginRes = self.chkLogin(self.services["ldapCon_1"]["ldapusername"], self.services["ldapCon_1"]["ldappasswd"])
- self.assertEquals(loginRes,1,"ldap Authentication failed")
-
- else:
-
- self.debug("LDAP Configuration failed with exception")
-
- self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
-
-
- self.debug("end test")
-
-
- def test_02_configLDAP(self):
- '''
- This test is to verify ldapConfig API with valid values.(i.e query fileter as displayName)
- '''
-
- # 1. This test covers ldapConfig & login API with valid ldap credentials.
- # 2. require ldap configuration:ldapCon_2
-
- self.debug("start test")
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_2"])
- self.assertEquals(self.ldapconfRes,1,"ldapConfig API failed")
- if(self.ldapconfRes==1):
- self.debug("configure ldap successful")
- #validating the user credentials with ldap Server
- loginRes = self.chkLogin(self.services["ldapCon_2"]["ldapusername"], self.services["ldapCon_2"]["ldappasswd"])
- self.assertEquals(loginRes,1,"ldap Authentication failed")
- else:
- self.debug("LDAP Configuration failed with exception")
- self.debug("end test")
-
-
- def test_03_configLDAP(self):
-
- '''
- This test is to verify ldapConfig API with missing config parameters value(i.queryfilter)
- '''
-
- # 1. Issue ldapConfig API with no ldap config parameter value and check behavior
- # 2. require ldap configuration:ldapCon_3
-
- self.debug("start test...")
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_3"])
- self.assertEquals(self.ldapconfRes,0,"LDAP configuration successful with invalid value.API failed")
- self.debug("end test")
-
- def test_04_configLDAP(self):
- '''
- This test is to verify ldapConfig API with invalid configuration values(by passing wrong query filter)
- '''
- # 1. calling ldapConfig API with invalid query filter value and check behavior
- # 2. require ldap configuration:ldapCon_4
-
- self.debug("start test...")
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_4"])
- self.assertEquals(self.ldapconfRes,0,"API failed")
-
-
-
- def test_05_configLDAP(self):
-
- '''
- This test is to verify login API functionality by passing wrong ldap credentials
- '''
- # 1.This script first configure the ldap and validates the user credentials using login API
- # 2. require ldap configuration:ldapCon_5
-
-
- self.debug("start test")
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_5"])
- self.assertEquals(self.ldapconfRes,1,"API failed")
- #validating the cloudstack user credentials with ldap Server
- loginRes = self.chkLogin(self.services["ldapCon_5"]["ldapusername"], self.services["ldapCon_5"]["ldappasswd"])
- self.assertNotEqual(loginRes,1,"login API failed")
- self.debug("end test")
-
- def test_06_removeLDAP(self):
- '''
- This test is to verify ldapRemove API functionality
- '''
- # 1. This script fist configures ldap and removes the configured ldap values
- # 2. require ldap configuration:ldapCon_1
-
-
- self.debug("start test")
- self.ldapconfRes=self._testldapConfig(self.services["ldapCon_1"])
- if(self.ldapconfRes==1):
- self.debug("ldap configured successfully")
- deleteldapconfg=ldapRemove.ldapRemoveCmd()
- res=self.apiclient.ldapRemove(deleteldapconfg)
- self.debug("ldap removed successfully")
- self.ldapconfRes=0
- else:
-
- self.debug("LDAP Configuration failed with exception")
- self.assertEquals(self.ldapconfRes,0,"ldapconfig API failed")
- self.debug("end test")
-
- def _testldapConfig(self,ldapSrvD):
-
- """
-
- :param ldapSrvD
-
-
- """
- #This Method takes dictionary as parameter,
- # reads the ldap configuration values from the passed dictionary and
- # register the ldapconfig detail in cloudstack
- # & return true or false based on ldapconfig API response
-
- self.debug("start ldapconfig test")
- #creating the ldapconfig cmd object
- lpconfig = ldapConfig.ldapConfigCmd()
- #Config the ldap server by assigning the ldapconfig dict variable values to ldapConfig object
- lpconfig.hostname = ldapSrvD["ldapHostname"]
- lpconfig.port = ldapSrvD["port"]
- lpconfig.binddn = ldapSrvD["binddn"]
- lpconfig.bindpass = ldapSrvD["bindpass"]
- lpconfig.searchbase = ldapSrvD["searchbase"]
- lpconfig.queryfilter = ldapSrvD["queryfilter"]
-
- #end of assigning the variables
-
- #calling the ldapconfig Api
- self.debug("calling ldapconfig API")
- try:
- lpconfig1 = self.apiclient.ldapConfig(lpconfig)
- self.debug("ldapconfig API succesfful")
- return 1
- except Exception, e:
- self.debug("ldapconfig API failed %s" %e)
- return 0
-
- def chkLogin(self, username, password):
- """
-
- :param username:
- :param password:
-
- """
- self.debug("login test")
-
- try:
- login1 = login.loginCmd()
- login1.username = username
- login1.password = password
- loginRes = self.apiclient.login(login1)
- self.debug("login response %s" % loginRes)
- if loginRes is None:
- self.debug("login not successful")
- else:
- self.debug("login successful")
- return 1
-
- except Exception, p:
- self.debug("login operation failed %s" %p)
- self.debug("end of Login")
[37/50] [abbrv] Fix all occurrences of account.account
Posted by ya...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_network.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network.py b/test/integration/component/test_vpc_network.py
index 0adf9d7..dc53585 100644
--- a/test/integration/component/test_vpc_network.py
+++ b/test/integration/component/test_vpc_network.py
@@ -333,7 +333,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -353,7 +353,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -426,7 +426,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -451,7 +451,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -497,7 +497,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -517,7 +517,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -588,7 +588,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -608,7 +608,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -646,7 +646,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -693,7 +693,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -744,7 +744,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -772,7 +772,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -821,7 +821,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -842,7 +842,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -890,7 +890,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -952,7 +952,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -976,7 +976,7 @@ class TestVPCNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1022,7 +1022,7 @@ class TestVPCNetwork(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1193,7 +1193,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1215,7 +1215,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.2.1.1',
@@ -1255,7 +1255,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1277,7 +1277,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.2.1.1',
@@ -1317,7 +1317,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1342,7 +1342,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1384,7 +1384,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1406,7 +1406,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1447,7 +1447,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1465,7 +1465,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1505,7 +1505,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1540,7 +1540,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=account.name,
- domainid=account.account.domainid,
+ domainid=account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1710,7 +1710,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1751,7 +1751,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off_no_pf.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1765,7 +1765,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1774,7 +1774,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1785,7 +1785,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1804,7 +1804,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
accountid=self.account.name,
networkid=network_1.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (
@@ -1816,7 +1816,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1845,7 +1845,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -1934,7 +1934,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -2059,7 +2059,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -2099,7 +2099,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -2113,7 +2113,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -2182,7 +2182,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -2197,7 +2197,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -2208,7 +2208,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -2216,7 +2216,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -2224,7 +2224,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -2235,7 +2235,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.lb_rule.assign(cls.api_client, [cls.vm_1, cls.vm_2])
@@ -2243,7 +2243,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -2289,7 +2289,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
for vm in vms:
@@ -2305,7 +2305,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
for vm in vms:
@@ -2396,7 +2396,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -2515,7 +2515,7 @@ class TestVPCNetworkGc(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index a24e813..b4a6607 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -244,7 +244,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return
@@ -264,7 +264,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
def get_Router_For_VPC(self):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -287,7 +287,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -308,7 +308,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
zoneid=self.zone.id
)
self.assertEqual(isinstance(routers, list),
@@ -391,7 +391,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
public_ip = PublicIPAddress.create(self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=None, #network.id,
vpcid=self.vpc.id
)
@@ -420,7 +420,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return vpc
@@ -442,7 +442,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
obj_network = Network.create(self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -460,7 +460,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)],
hostid=host_id
@@ -487,7 +487,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
accountid=self.account.name,
networkid=network.id,
vpcid=self.vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
lb_rule.assign(self.apiclient, vmarray)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index aac9568..56792f4 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -243,7 +243,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return
@@ -262,7 +262,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
def get_Router_For_VPC(self):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -285,7 +285,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -306,7 +306,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
zoneid=self.zone.id
)
self.assertEqual(isinstance(routers, list),
@@ -391,7 +391,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
public_ip = PublicIPAddress.create(self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=None, #network.id,
vpcid=self.vpc.id
)
@@ -420,7 +420,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return vpc
@@ -442,7 +442,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
obj_network = Network.create(self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -460,7 +460,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)],
hostid=host_id
@@ -487,7 +487,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
accountid=self.account.name,
networkid=network.id,
vpcid=self.vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
lb_rule.assign(self.apiclient, vmarray)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_network_staticnatrule.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_staticnatrule.py b/test/integration/component/test_vpc_network_staticnatrule.py
index 842d20a..aceca62 100644
--- a/test/integration/component/test_vpc_network_staticnatrule.py
+++ b/test/integration/component/test_vpc_network_staticnatrule.py
@@ -243,7 +243,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return
@@ -262,7 +262,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
def get_Router_For_VPC(self):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -285,7 +285,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
)
self.assertEqual(isinstance(routers, list),
True,
@@ -306,7 +306,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
routers = list_routers(self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
zoneid=self.zone.id
)
self.assertEqual(isinstance(routers, list),
@@ -391,7 +391,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
public_ip = PublicIPAddress.create(self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=None, #network.id,
vpcid=self.vpc.id
)
@@ -420,7 +420,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
return vpc
@@ -442,7 +442,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
obj_network = Network.create(self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=nw_off.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -460,7 +460,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)],
hostid=host_id
@@ -487,7 +487,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
accountid=self.account.name,
networkid=network.id,
vpcid=self.vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (vmarray))
lb_rule.assign(self.apiclient, vmarray)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_offerings.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_offerings.py b/test/integration/component/test_vpc_offerings.py
index 033a905..4b98775 100644
--- a/test/integration/component/test_vpc_offerings.py
+++ b/test/integration/component/test_vpc_offerings.py
@@ -315,7 +315,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -340,7 +340,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -352,7 +352,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -363,7 +363,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -382,7 +382,7 @@ class TestVPCOffering(cloudstackTestCase):
accountid=self.account.name,
networkid=network.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Associating public IP for network: %s" % vpc.name)
@@ -390,7 +390,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -438,7 +438,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -467,7 +467,7 @@ class TestVPCOffering(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -485,7 +485,7 @@ class TestVPCOffering(cloudstackTestCase):
# self.apiclient,
# accountid=self.account.name,
# zoneid=self.zone.id,
-# domainid=self.account.account.domainid,
+# domainid=self.account.domainid,
# networkid=network.id,
# vpcid=vpc.id
# )
@@ -502,7 +502,7 @@ class TestVPCOffering(cloudstackTestCase):
# self.apiclient,
# publicipid=public_ip_4.ipaddress.id,
# account=self.account.name,
-# domainid=self.account.account.domainid,
+# domainid=self.account.domainid,
# networkid=network.id,
# vpcid=vpc.id
# )
@@ -516,7 +516,7 @@ class TestVPCOffering(cloudstackTestCase):
# username="root",
# password="password",
# account=self.account.name,
-# domainid=self.account.account.domainid
+# domainid=self.account.domainid
# )
# except Exception as e:
# self.fail("Failed to create VPN user: %s" % e)
@@ -525,7 +525,7 @@ class TestVPCOffering(cloudstackTestCase):
# remote_vpns = Vpn.list(
# self.apiclient,
# account=self.account.name,
-# domainid=self.account.account.domainid,
+# domainid=self.account.domainid,
# publicipid=public_ip_4.ipaddress.id,
# listall=True
# )
@@ -596,7 +596,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -612,7 +612,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -626,7 +626,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -637,7 +637,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -715,7 +715,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -731,7 +731,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -745,7 +745,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -756,7 +756,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -836,7 +836,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -852,7 +852,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -864,7 +864,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -875,7 +875,7 @@ class TestVPCOffering(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -975,7 +975,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("VPC network creation failed! (Test succeeded)")
self.debug("Enabling the VPC offering created")
@@ -989,7 +989,7 @@ class TestVPCOffering(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_routers.py b/test/integration/component/test_vpc_routers.py
index 55cb513..763a4cb 100644
--- a/test/integration/component/test_vpc_routers.py
+++ b/test/integration/component/test_vpc_routers.py
@@ -214,7 +214,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls._cleanup.append(cls.service_offering)
@@ -361,7 +361,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -436,7 +436,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -483,7 +483,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -499,7 +499,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -520,7 +520,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -548,7 +548,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -581,7 +581,7 @@ class TestVPCRoutersBasic(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
router = routers[0]
@@ -639,7 +639,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -656,7 +656,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -668,7 +668,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -676,7 +676,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -686,7 +686,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network_1.id)]
)
@@ -694,14 +694,14 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
vms = VirtualMachine.list(
cls.apiclient,
account=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
listall=True
)
public_ip_1 = PublicIPAddress.create(
cls.apiclient,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -727,7 +727,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -748,7 +748,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
# cls.assertEqual(
# isinstance(public_ips, list),
@@ -766,7 +766,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
cls.apiclient,
accountid=cls.account.name,
zoneid=cls.zone.id,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkid=cls.network_1.id,
vpcid=cls.vpc.id
)
@@ -779,7 +779,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
accountid=cls.account.name,
networkid=cls.network_1.id,
vpcid=cls.vpc.id,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
lb_rule.assign(cls.apiclient, [vm_3])
@@ -961,13 +961,13 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
public_ips = PublicIPAddress.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
for vm, public_ip in zip(vms, public_ips):
@@ -1086,7 +1086,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1180,7 +1180,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1247,7 +1247,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1263,7 +1263,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1306,7 +1306,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1351,7 +1351,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1384,7 +1384,7 @@ class TestVPCRouterOneNetwork(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
router = routers[0]
[24/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2576. AWS API not returning values in CFSimpleXML Object format.
PHP SDK calls the CFSimpleXML parser class to parse the response body into CFSimpleXML Object format.
In AWSAPI added an XML declaration during serialization of Axis beans to XML output
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8986e16e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8986e16e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8986e16e
Branch: refs/heads/pvlan
Commit: 8986e16e5f9f59fdf222704ec9716b9b821bdea8
Parents: a2fea4d
Author: Likitha Shetty <li...@citrix.com>
Authored: Mon May 20 14:51:20 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Mon May 20 15:01:57 2013 +0530
----------------------------------------------------------------------
awsapi/src/com/cloud/bridge/service/EC2RestServlet.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8986e16e/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index 630e16f..6dd7a8c 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -2043,8 +2043,9 @@ public class EC2RestServlet extends HttpServlet {
throws ADBException, XMLStreamException, IOException {
OutputStream os = response.getOutputStream();
response.setStatus(200);
- response.setContentType("text/xml; charset=UTF-8");
+ response.setContentType("text/xml");
XMLStreamWriter xmlWriter = xmlOutFactory.createXMLStreamWriter( os );
+ xmlWriter.writeStartDocument("UTF-8","1.0");
MTOMAwareXMLSerializer MTOMWriter = new MTOMAwareXMLSerializer( xmlWriter );
MTOMWriter.setDefaultNamespace("http://ec2.amazonaws.com/doc/" + wsdlVersion + "/");
EC2Response.serialize( null, factory, MTOMWriter );
[30/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2553: Made ACL item action case-insensitive
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/612afbd1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/612afbd1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/612afbd1
Branch: refs/heads/pvlan
Commit: 612afbd17941ee840b1bba3e5951f89cafeea243
Parents: 32e7ba2
Author: Kishan Kavala <ki...@cloud.com>
Authored: Mon May 20 17:58:14 2013 +0530
Committer: Kishan Kavala <ki...@cloud.com>
Committed: Mon May 20 18:06:12 2013 +0530
----------------------------------------------------------------------
server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/612afbd1/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
index 4d5d981..2b02a88 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
@@ -342,9 +342,7 @@ public class NetworkACLServiceImpl extends ManagerBase implements NetworkACLServ
//Check ofr valid action Allow/Deny
if(action != null){
- try {
- NetworkACLItem.Action.valueOf(action);
- } catch (IllegalArgumentException ex) {
+ if(!("Allow".equalsIgnoreCase(action) || "Deny".equalsIgnoreCase(action))){
throw new InvalidParameterValueException("Invalid action. Allowed actions are Allow and Deny");
}
}
[03/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2513: VPN tests refer to invalid connection.user in cloudConnection
cloudConnection object should always have "user" and "passwd" attributes.
And they are "None" while creating userAPIClient. As we already
have "user" and "password" for mgmt server.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4d0cea66
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4d0cea66
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4d0cea66
Branch: refs/heads/pvlan
Commit: 4d0cea6626923a24a432c25eee8d93da4e4f504b
Parents: 046580f
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed May 15 17:50:43 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri May 17 14:05:04 2013 +0530
----------------------------------------------------------------------
tools/marvin/marvin/cloudstackConnection.py | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4d0cea66/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index b5ff5bf..e3977dc 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -43,10 +43,8 @@ class cloudConnection(object):
self.securityKey = securityKey
self.mgtSvr = mgtSvr
self.port = port
- if user:
- self.user = user
- if passwd:
- self.passwd = passwd
+ self.user = user
+ self.passwd = passwd
self.logging = logging
self.path = path
self.retries = 5
[50/50] [abbrv] git commit: updated refs/heads/master to d893cb4
Posted by ya...@apache.org.
CLOUDSTACK-3699: Fix ARP broadcast of VPC router
Every new public IP should be send out ARP broadcast.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d893cb48
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d893cb48
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d893cb48
Branch: refs/heads/master
Commit: d893cb48a51ffe08236dcfafaedf882af2ee9a5e
Parents: a102853
Author: Sheng Yang <sh...@citrix.com>
Authored: Sun Jul 21 22:15:22 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Sun Jul 21 22:24:16 2013 -0700
----------------------------------------------------------------------
patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d893cb48/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
index f2f8a49..a5b0239 100755
--- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
+++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_ipassoc.sh
@@ -76,8 +76,9 @@ add_an_ip () {
if [ $old_state -eq 0 ]
then
sudo ip link set $ethDev up
- sudo arping -c 3 -I $ethDev -A -U -s $pubIp $pubIp
fi
+ sudo arping -c 1 -I $ethDev -A -U -s $pubIp $pubIp
+ sudo arping -c 1 -I $ethDev -A -U -s $pubIp $pubIp
local tableNo=${ethDev:3}
sudo iptables-save -t mangle | grep "PREROUTING -i $ethDev -m state --state NEW -j CONNMARK --set-xmark" 2>/dev/null
if [ $? -gt 0 ]
[41/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Adding a name to the framework/jobs/pom.xml file
Signed-off-by: Chip Childers <ch...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0365d555
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0365d555
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0365d555
Branch: refs/heads/pvlan
Commit: 0365d555cf50ad551427ebe2c5634b807bd6a9c0
Parents: cede6c1
Author: Chip Childers <ch...@gmail.com>
Authored: Mon May 20 19:17:33 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon May 20 19:17:33 2013 +0100
----------------------------------------------------------------------
framework/jobs/pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0365d555/framework/jobs/pom.xml
----------------------------------------------------------------------
diff --git a/framework/jobs/pom.xml b/framework/jobs/pom.xml
index 5ae63af..cf1fdd5 100644
--- a/framework/jobs/pom.xml
+++ b/framework/jobs/pom.xml
@@ -19,6 +19,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-framework-jobs</artifactId>
+ <name>Apache CloudStack Framework - Jobs</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
[31/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2379: Fix for issue destroy vm causing NPE. Made the following changes.
1. Made a fix to make sure a null object is added to the exception.
2. Also fixed the marvin test cases for the feature. Account cleanup will remove the vms deployed for the account. There is no need to explicitly delete the vms for the account.
3. Fixed the assertion checks for the vm created for an account. If there are multiple vms for an account, the test script needs to compare the ids with the correct instance.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f5c8e386
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f5c8e386
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f5c8e386
Branch: refs/heads/pvlan
Commit: f5c8e386e5881c1d7aad1f85922752621bb96c1a
Parents: 612afbd
Author: Devdeep Singh <de...@gmail.com>
Authored: Mon May 20 18:26:50 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Mon May 20 18:26:50 2013 +0530
----------------------------------------------------------------------
server/src/com/cloud/vm/UserVmManagerImpl.java | 1 -
test/integration/smoke/test_deploy_vm_with_userdata.py | 8 ++++----
2 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5c8e386/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 05ff6aa..86150a2 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3228,7 +3228,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
if (vm == null || vm.getRemoved() != null) {
InvalidParameterValueException ex = new InvalidParameterValueException(
"Unable to find a virtual machine with specified vmId");
- ex.addProxyObject(vm, vmId, "vmId");
throw ex;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f5c8e386/test/integration/smoke/test_deploy_vm_with_userdata.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm_with_userdata.py b/test/integration/smoke/test_deploy_vm_with_userdata.py
index 8ca9bd0..260106c 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -105,13 +105,13 @@ class TestDeployVmWithUserData(cloudstackTestCase):
vms = list_virtual_machines(
self.apiClient,
account=self.account.name,
- domainid=self.account.domainid
+ domainid=self.account.domainid,
+ id=deployVmResponse.id
)
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state")
- self.cleanup.append(deployVmResponse)
@attr(tags=["simulator", "devcloud", "basic", "advanced"])
def test_deployvm_userdata(self):
@@ -129,13 +129,13 @@ class TestDeployVmWithUserData(cloudstackTestCase):
vms = list_virtual_machines(
self.apiClient,
account=self.account.name,
- domainid=self.account.domainid
+ domainid=self.account.domainid,
+ id=deployVmResponse.id
)
self.assert_(len(vms) > 0, "There are no Vms deployed in the account %s" % self.account.name)
vm = vms[0]
self.assert_(vm.id == str(deployVmResponse.id), "Vm deployed is different from the test")
self.assert_(vm.state == "Running", "VM is not in Running state")
- self.cleanup.append(deployVmResponse)
@classmethod
def tearDownClass(cls):
[09/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
iCLOUDSTACK-2321
Fix the response of scaleVMCmd
Add Scale System vm command
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4eb310e9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4eb310e9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4eb310e9
Branch: refs/heads/pvlan
Commit: 4eb310e926771c30515034bb056f71f52afe1a19
Parents: e520ff4
Author: Nitin Mehta <ni...@citrix.com>
Authored: Fri May 17 17:38:21 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Fri May 17 17:43:43 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/event/EventTypes.java | 3 +
api/src/com/cloud/server/ManagementService.java | 12 +-
api/src/com/cloud/vm/UserVmService.java | 2 +-
.../admin/systemvm/ScaleSystemVMCmd.java | 131 +++++++++++++++++++
.../api/command/user/vm/ScaleVMCmd.java | 23 +++-
.../api/command/test/ScaleVMCmdTest.java | 30 ++++-
client/tomcatconf/commands.properties.in | 1 +
.../src/com/cloud/server/ManagementServer.java | 6 +
.../com/cloud/server/ManagementServerImpl.java | 47 +++----
server/src/com/cloud/vm/UserVmManager.java | 6 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 17 ++-
.../com/cloud/vm/MockUserVmManagerImpl.java | 9 +-
12 files changed, 238 insertions(+), 49 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index ee7f5b7..9c83f13 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -92,6 +92,8 @@ public class EventTypes {
public static final String EVENT_PROXY_STOP = "PROXY.STOP";
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
public static final String EVENT_PROXY_HA = "PROXY.HA";
+ public static final String EVENT_PROXY_SCALE = "PROXY.SCALE";
+
// VNC Console Events
public static final String EVENT_VNC_CONNECT = "VNC.CONNECT";
@@ -213,6 +215,7 @@ public class EventTypes {
public static final String EVENT_SSVM_STOP = "SSVM.STOP";
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
public static final String EVENT_SSVM_HA = "SSVM.HA";
+ public static final String EVENT_SSVM_SCALE = "SSVM.SCALE";
// Service Offerings
public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE";
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index 59b83c9..24d33d5 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.cloud.exception.*;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
@@ -34,11 +35,7 @@ import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.*;
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
@@ -64,10 +61,6 @@ import com.cloud.configuration.Configuration;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InternalErrorException;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.exception.ResourceUnavailableException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
@@ -422,4 +415,5 @@ public interface ManagementService {
List<String> listDeploymentPlanners();
+ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException, ConcurrentOperationException;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/src/com/cloud/vm/UserVmService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index 0a0660a..7d459b9 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -461,6 +461,6 @@ public interface UserVmService {
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
- boolean upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
new file mode 100644
index 0000000..a077e24
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ScaleSystemVMCmd.java
@@ -0,0 +1,131 @@
+// 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.command.admin.systemvm;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.*;
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SystemVmResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.offering.ServiceOffering;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.VirtualMachine;
+
+@APICommand(name = "scaleSystemVm", responseObject=SystemVmResponse.class, description="Scale the service offering for a system vm (console proxy or secondary storage). " +
+ "The system vm must be in a \"Stopped\" state for " +
+ "this command to take effect.")
+public class ScaleSystemVMCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
+ private static final String s_name = "changeserviceforsystemvmresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=SystemVmResponse.class,
+ required=true, description="The ID of the system vm")
+ private Long id;
+
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
+ required=true, description="the service offering ID to apply to the system vm")
+ private Long serviceOfferingId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ public Long getServiceOfferingId() {
+ return serviceOfferingId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+ if (account != null) {
+ return account.getId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("SystemVm Id: "+getId());
+
+ ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId);
+ if (serviceOffering == null) {
+ throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
+ }
+
+ VirtualMachine result = null;
+ try {
+ result = _mgr.upgradeSystemVM(this);
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ } catch (ConcurrentOperationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (ManagementServerException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (VirtualMachineMigrationException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ }
+ if (result != null) {
+ SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale system vm");
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId());
+ if(type == VirtualMachine.Type.ConsoleProxy){
+ return EventTypes.EVENT_PROXY_SCALE;
+ }
+ else{
+ return EventTypes.EVENT_SSVM_SCALE;
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "scaling system vm: " + getId() + " to service offering: " + getServiceOfferingId();
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index 4f2ac75..758d9c1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
+import com.cloud.event.EventTypes;
import com.cloud.exception.*;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -26,9 +27,11 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
+import java.util.List;
+
@APICommand(name = "scaleVirtualMachine", description="Scales the virtual machine to a new service offering.", responseObject=SuccessResponse.class)
-public class ScaleVMCmd extends BaseCmd {
+public class ScaleVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ScaleVMCmd.class.getName());
private static final String s_name = "scalevirtualmachineresponse";
@@ -84,7 +87,7 @@ public class ScaleVMCmd extends BaseCmd {
@Override
public void execute(){
//UserContext.current().setEventDetails("Vm Id: "+getId());
- boolean result;
+ UserVm result;
try {
result = _userVmService.upgradeVirtualMachine(this);
} catch (ResourceUnavailableException ex) {
@@ -100,11 +103,23 @@ public class ScaleVMCmd extends BaseCmd {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
- if (result){
- SuccessResponse response = new SuccessResponse(getCommandName());
+ if (result != null){
+ List<UserVmResponse> responseList = _responseGenerator.createUserVmResponse("virtualmachine", result);
+ UserVmResponse response = responseList.get(0);
+ response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
}
}
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SCALE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "scaling volume: " + getId() + " to service offering: " + getServiceOfferingId();
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
----------------------------------------------------------------------
diff --git a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
index 8a28290..bb02298 100644
--- a/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
+++ b/api/test/org/apache/cloudstack/api/command/test/ScaleVMCmdTest.java
@@ -24,11 +24,18 @@ import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
+import org.apache.cloudstack.api.response.SwiftResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.Mockito;
+import static org.mockito.Matchers.anyInt;
+
+
+import java.util.LinkedList;
+import java.util.List;
public class ScaleVMCmdTest extends TestCase{
@@ -58,19 +65,34 @@ public class ScaleVMCmdTest extends TestCase{
public void testCreateSuccess() {
UserVmService userVmService = Mockito.mock(UserVmService.class);
+ UserVm userVm = Mockito.mock(UserVm.class);
+
try {
Mockito.when(
userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(true);
+ .thenReturn(userVm);
}catch (Exception e){
Assert.fail("Received exception when success expected " +e.getMessage());
}
+ ResponseGenerator responseGenerator = Mockito.mock(ResponseGenerator.class);
+ scaleVMCmd._responseGenerator = responseGenerator;
+
+ UserVmResponse userVmResponse = Mockito.mock(UserVmResponse.class);
+ //List<UserVmResponse> list = Mockito.mock(UserVmResponse.class);
+ //list.add(userVmResponse);
+ //LinkedList<UserVmResponse> mockedList = Mockito.mock(LinkedList.class);
+ //Mockito.when(mockedList.get(0)).thenReturn(userVmResponse);
+
+ List<UserVmResponse> list = new LinkedList<UserVmResponse>();
+ list.add(userVmResponse);
+
+ Mockito.when(responseGenerator.createUserVmResponse("virtualmachine", userVm)).thenReturn(
+ list);
+
scaleVMCmd._userVmService = userVmService;
- responseGenerator = Mockito.mock(ResponseGenerator.class);
- scaleVMCmd._responseGenerator = responseGenerator;
scaleVMCmd.execute();
}
@@ -83,7 +105,7 @@ public class ScaleVMCmdTest extends TestCase{
try {
Mockito.when(
userVmService.upgradeVirtualMachine(scaleVMCmd))
- .thenReturn(false);
+ .thenReturn(null);
}catch (Exception e){
Assert.fail("Received exception when success expected " +e.getMessage());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 4cd9065..68a7511 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -205,6 +205,7 @@ destroySystemVm=1
listSystemVms=3
migrateSystemVm=1
changeServiceForSystemVm=1
+scaleSystemVm=1
#### configuration commands
updateConfiguration=1
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/server/src/com/cloud/server/ManagementServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServer.java b/server/src/com/cloud/server/ManagementServer.java
index 240464e..969bc65 100755
--- a/server/src/com/cloud/server/ManagementServer.java
+++ b/server/src/com/cloud/server/ManagementServer.java
@@ -19,6 +19,11 @@ package com.cloud.server;
import java.util.Date;
import java.util.List;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.ManagementServerException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.VirtualMachineMigrationException;
+import org.apache.cloudstack.api.command.admin.systemvm.ScaleSystemVMCmd;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import com.cloud.event.EventVO;
@@ -100,4 +105,5 @@ public interface ManagementServer extends ManagementService, PluggableService {
void resetEncryptionKeyIV();
public void enableAdminUser(String password);
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/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 06c0f96..8b3eea4 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -43,6 +43,8 @@ import javax.crypto.spec.SecretKeySpec;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.exception.*;
+import com.cloud.vm.*;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
@@ -151,13 +153,7 @@ import org.apache.cloudstack.api.command.admin.storage.PreparePrimaryStorageForM
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.MigrateSystemVMCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.StartSystemVMCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.*;
import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd;
import org.apache.cloudstack.api.command.admin.usage.AddTrafficTypeCmd;
@@ -472,12 +468,6 @@ import com.cloud.event.ActionEventUtils;
import com.cloud.event.EventTypes;
import com.cloud.event.EventVO;
import com.cloud.event.dao.EventDao;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.OperationTimedoutException;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.exception.StorageUnavailableException;
import com.cloud.ha.HighAvailabilityManager;
import com.cloud.host.DetailVO;
import com.cloud.host.Host;
@@ -571,17 +561,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.MacAddress;
import com.cloud.utils.net.NetUtils;
import com.cloud.utils.ssh.SSHKeysHelper;
-import com.cloud.vm.ConsoleProxyVO;
-import com.cloud.vm.DiskProfile;
-import com.cloud.vm.InstanceGroupVO;
-import com.cloud.vm.SecondaryStorageVmVO;
-import com.cloud.vm.UserVmVO;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.State;
-import com.cloud.vm.VirtualMachineManager;
-import com.cloud.vm.VirtualMachineProfile;
-import com.cloud.vm.VirtualMachineProfileImpl;
import com.cloud.vm.dao.ConsoleProxyDao;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.InstanceGroupDao;
@@ -717,6 +697,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
ConfigurationServer _configServer;
+ @Inject
+ UserVmManager _userVmMgr;
private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker"));
private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker"));
@@ -2917,6 +2899,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
cmdList.add(ListAffinityGroupTypesCmd.class);
cmdList.add(ListDeploymentPlannersCmd.class);
cmdList.add(ReleaseHostReservationCmd.class);
+ cmdList.add(ScaleSystemVMCmd.class);
cmdList.add(AddResourceDetailCmd.class);
cmdList.add(RemoveResourceDetailCmd.class);
cmdList.add(ListResourceDetailsCmd.class);
@@ -4021,9 +4004,27 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
}
@Override
+ public VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableException, ManagementServerException, VirtualMachineMigrationException, ConcurrentOperationException {
+
+ boolean result = _userVmMgr.upgradeVirtualMachine(cmd.getId(), cmd.getServiceOfferingId());
+ if(result){
+ VirtualMachine vm = _vmInstanceDao.findById(cmd.getId());
+ return vm;
+ }else{
+ return null;
+ }
+ }
+
+
+ @Override
public VirtualMachine upgradeSystemVM(UpgradeSystemVMCmd cmd) {
Long systemVmId = cmd.getId();
Long serviceOfferingId = cmd.getServiceOfferingId();
+ return upgradeStoppedSystemVm(systemVmId, serviceOfferingId);
+
+ }
+
+ private VirtualMachine upgradeStoppedSystemVm(Long systemVmId, Long serviceOfferingId){
Account caller = UserContext.current().getCaller();
VMInstanceVO systemVm = _vmInstanceDao.findByIdTypes(systemVmId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.SecondaryStorageVm);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/server/src/com/cloud/vm/UserVmManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java
index cc1fffd..0f8e368 100755
--- a/server/src/com/cloud/vm/UserVmManager.java
+++ b/server/src/com/cloud/vm/UserVmManager.java
@@ -22,9 +22,7 @@ import java.util.Map;
import com.cloud.agent.api.VmStatsEntry;
import com.cloud.api.query.vo.UserVmJoinVO;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.*;
import com.cloud.projects.Project.ListProjectResourcesCriteria;
import com.cloud.server.Criteria;
import com.cloud.user.Account;
@@ -94,4 +92,6 @@ public interface UserVmManager extends VirtualMachineGuru<UserVmVO>, UserVmServi
Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
+ boolean upgradeVirtualMachine(Long id, Long serviceOfferingId) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index a3b731a..860daaf 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1076,11 +1076,22 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
@Override
@ActionEvent(eventType = EventTypes.EVENT_VM_SCALE, eventDescription = "scaling Vm")
- public boolean
- upgradeVirtualMachine(ScaleVMCmd cmd) throws InvalidParameterValueException, ResourceAllocationException {
+ public UserVm
+ upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException{
Long vmId = cmd.getId();
Long newServiceOfferingId = cmd.getServiceOfferingId();
+ boolean result = upgradeVirtualMachine(vmId, newServiceOfferingId);
+ if(result){
+ return _vmDao.findById(vmId);
+ }else{
+ return null;
+ }
+
+ }
+
+ @Override
+ public boolean upgradeVirtualMachine(Long vmId, Long newServiceOfferingId) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException{
Account caller = UserContext.current().getCaller();
// Verify input parameters
@@ -1147,9 +1158,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
}
return success;
-
}
+
@Override
public HashMap<Long, VmStatsEntry> getVirtualMachineStatistics(long hostId,
String hostName, List<Long> vmIds) throws CloudRuntimeException {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4eb310e9/server/test/com/cloud/vm/MockUserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
index a88625a..50a90f2 100644
--- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java
+++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java
@@ -409,8 +409,8 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
}
@Override
- public boolean upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ public UserVm upgradeVirtualMachine(ScaleVMCmd scaleVMCmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
}
@@ -421,6 +421,11 @@ public class MockUserVmManagerImpl extends ManagerBase implements UserVmManager,
}
@Override
+ public boolean upgradeVirtualMachine(Long id, Long serviceOfferingId) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ @Override
public void prepareStop(VirtualMachineProfile<UserVmVO> profile) {
// TODO Auto-generated method stub
[39/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Fix all occurrences of account.account
Fixes the dereference of account objects with account.account. This is
to conform to recent library changes in Marvin
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54ac779b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54ac779b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54ac779b
Branch: refs/heads/pvlan
Commit: 54ac779b8f3a520a391902ae4163b922e2078061
Parents: 145a116
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 22:59:52 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 22:59:52 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_accounts.py | 2 +-
.../component/test_high_availability.py | 28 ++--
.../component/test_host_high_availability.py | 14 +-
test/integration/component/test_ldap.py | 0
test/integration/component/test_projects.py | 34 ++--
.../component/test_redundant_router.py | 120 +++++++--------
test/integration/component/test_stopped_vm.py | 70 ++++-----
test/integration/component/test_tags.py | 110 ++++++-------
test/integration/component/test_vpc.py | 124 +++++++--------
.../component/test_vpc_host_maintenance.py | 44 +++---
test/integration/component/test_vpc_network.py | 106 ++++++-------
.../component/test_vpc_network_lbrules.py | 18 +--
.../component/test_vpc_network_pfrules.py | 18 +--
.../component/test_vpc_network_staticnatrule.py | 18 +--
.../integration/component/test_vpc_offerings.py | 52 +++----
test/integration/component/test_vpc_routers.py | 56 +++----
.../component/test_vpc_vm_life_cycle.py | 98 ++++++------
.../component/test_vpc_vms_deployment.py | 154 +++++++++----------
test/integration/component/test_vpn_users.py | 4 +-
19 files changed, 535 insertions(+), 535 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index b2038a9..a25e636 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -561,7 +561,7 @@ class TestNonRootAdminsPrivileges(cloudstackTestCase):
self.apiclient,
self.services["account"]
)
- self.debug("Created account: %s" % account_1.account.name)
+ self.debug("Created account: %s" % account_1.name)
self.cleanup.append(account_1)
account_2 = Account.create(
self.apiclient,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_high_availability.py b/test/integration/component/test_high_availability.py
index 12753c1..cd2dfce 100644
--- a/test/integration/component/test_high_availability.py
+++ b/test/integration/component/test_high_availability.py
@@ -220,7 +220,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
@@ -248,7 +248,7 @@ class TestHighAvailability(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -264,7 +264,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
@@ -372,7 +372,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
@@ -424,7 +424,7 @@ class TestHighAvailability(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -464,7 +464,7 @@ class TestHighAvailability(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -513,7 +513,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
@@ -615,7 +615,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
@@ -643,7 +643,7 @@ class TestHighAvailability(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -659,7 +659,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
@@ -833,7 +833,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
@@ -952,7 +952,7 @@ class TestHighAvailability(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -990,7 +990,7 @@ class TestHighAvailability(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1037,7 +1037,7 @@ class TestHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id
)
vms = VirtualMachine.list(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_host_high_availability.py b/test/integration/component/test_host_high_availability.py
index 7a3f62a..8c66d17 100644
--- a/test/integration/component/test_host_high_availability.py
+++ b/test/integration/component/test_host_high_availability.py
@@ -190,7 +190,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_with_ha.id
)
vms = VirtualMachine.list(
@@ -235,7 +235,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_with_ha.id
)
@@ -289,7 +289,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_without_ha.id
)
@@ -358,7 +358,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_with_ha.id
)
@@ -464,7 +464,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_with_ha.id
)
@@ -573,7 +573,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_with_ha.id
)
@@ -705,7 +705,7 @@ class TestHostHighAvailability(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering_without_ha.id
)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_ldap.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_ldap.py b/test/integration/component/test_ldap.py
old mode 100755
new mode 100644
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_projects.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py
index f013e99..e1975cf 100644
--- a/test/integration/component/test_projects.py
+++ b/test/integration/component/test_projects.py
@@ -782,8 +782,8 @@ class TestProjectOwners(cloudstackTestCase):
project = Project.create(
self.apiclient,
self.services["project"],
- account=self.admin.account.name,
- domainid=self.admin.account.domainid
+ account=self.admin.name,
+ domainid=self.admin.domainid
)
self.cleanup.append(project)
# Cleanup created project at end of test
@@ -815,20 +815,20 @@ class TestProjectOwners(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.new_admin.account.name,
+ self.new_admin.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.new_admin.account.name,
+ self.new_admin.name,
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.new_admin.account.name,
+ account=self.new_admin.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -853,14 +853,14 @@ class TestProjectOwners(cloudstackTestCase):
# Update the project with new admin
project.update(
self.apiclient,
- account=self.new_admin.account.name
+ account=self.new_admin.name
)
# listProjectAccount to verify the user is new admin of the project
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.new_admin.account.name,
+ account=self.new_admin.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -886,7 +886,7 @@ class TestProjectOwners(cloudstackTestCase):
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.admin.account.name,
+ account=self.admin.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -923,8 +923,8 @@ class TestProjectOwners(cloudstackTestCase):
project = Project.create(
self.apiclient,
self.services["project"],
- account=self.admin.account.name,
- domainid=self.admin.account.domainid
+ account=self.admin.name,
+ domainid=self.admin.domainid
)
# Cleanup created project at end of test
self.cleanup.append(project)
@@ -965,20 +965,20 @@ class TestProjectOwners(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.new_admin.account.name,
+ self.new_admin.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.new_admin.account.name,
+ self.new_admin.name,
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.new_admin.account.name,
+ account=self.new_admin.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -1000,18 +1000,18 @@ class TestProjectOwners(cloudstackTestCase):
"Newly added user is not added as a regular user"
)
self.debug("Updating project with new Admin: %s" %
- self.new_admin.account.name)
+ self.new_admin.name)
# Update the project with new admin
project.update(
self.apiclient,
- account=self.new_admin.account.name
+ account=self.new_admin.name
)
# listProjectAccount to verify the user is new admin of the project
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.new_admin.account.name,
+ account=self.new_admin.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1106,7 +1106,7 @@ class TestProjectOwners(cloudstackTestCase):
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.new_admin.account.name,
+ account=self.new_admin.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_redundant_router.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_redundant_router.py b/test/integration/component/test_redundant_router.py
index 8885241..a87818a 100644
--- a/test/integration/component/test_redundant_router.py
+++ b/test/integration/component/test_redundant_router.py
@@ -331,7 +331,7 @@ class TestCreateRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -375,7 +375,7 @@ class TestCreateRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -538,7 +538,7 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
guestcidr=' 192.168.2.0/23'
@@ -593,7 +593,7 @@ class TestCreateRvRNetworkNonDefaultGuestCidr(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -760,7 +760,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -804,7 +804,7 @@ class TestRVRInternals(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -1019,7 +1019,7 @@ class TestRedundancy(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -1031,7 +1031,7 @@ class TestRedundancy(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@@ -1572,7 +1572,7 @@ class TestRedundancy(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@@ -1712,7 +1712,7 @@ class TestApplyAndDeleteNetworkRulesOnRvR(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -1756,7 +1756,7 @@ class TestApplyAndDeleteNetworkRulesOnRvR(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -1801,7 +1801,7 @@ class TestApplyAndDeleteNetworkRulesOnRvR(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -1870,7 +1870,7 @@ class TestApplyAndDeleteNetworkRulesOnRvR(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -1902,7 +1902,7 @@ class TestApplyAndDeleteNetworkRulesOnRvR(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2037,7 +2037,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -2081,7 +2081,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -2126,7 +2126,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2142,7 +2142,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
self.apiclient,
publicipid=public_ip.ipaddress.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
except Exception as e:
self.fail("Failed to create VPN for account: %s - %s" % (
@@ -2154,7 +2154,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
username="root",
password="password",
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
except Exception as e:
self.fail("Failed to create VPN user: %s" % e)
@@ -2163,7 +2163,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
remote_vpns = Vpn.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
publicipid=public_ip.ipaddress.id,
listall=True
)
@@ -2184,7 +2184,7 @@ class TestEnableVPNOverRvR(cloudstackTestCase):
remote_vpns = Vpn.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
publicipid=public_ip.ipaddress.id,
listall=True
)
@@ -2306,7 +2306,7 @@ class TestNetworkRulesMasterDownDeleteNetworkRules(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -2350,7 +2350,7 @@ class TestNetworkRulesMasterDownDeleteNetworkRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -2412,7 +2412,7 @@ class TestNetworkRulesMasterDownDeleteNetworkRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2481,7 +2481,7 @@ class TestNetworkRulesMasterDownDeleteNetworkRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2513,7 +2513,7 @@ class TestNetworkRulesMasterDownDeleteNetworkRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2694,7 +2694,7 @@ class TestApplyDeleteNetworkRulesRebootRouter(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -2738,7 +2738,7 @@ class TestApplyDeleteNetworkRulesRebootRouter(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -2790,7 +2790,7 @@ class TestApplyDeleteNetworkRulesRebootRouter(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2851,7 +2851,7 @@ class TestApplyDeleteNetworkRulesRebootRouter(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -2872,7 +2872,7 @@ class TestApplyDeleteNetworkRulesRebootRouter(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -3058,7 +3058,7 @@ class TestRestartRvRNetworkWithoutCleanup(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -3102,7 +3102,7 @@ class TestRestartRvRNetworkWithoutCleanup(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -3279,7 +3279,7 @@ class TestRestartRvRNetworkWithCleanup(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -3323,7 +3323,7 @@ class TestRestartRvRNetworkWithCleanup(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -3500,7 +3500,7 @@ class TestDeleteRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -3544,7 +3544,7 @@ class TestDeleteRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -3719,7 +3719,7 @@ class TestNetworkGCRvR(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -3763,7 +3763,7 @@ class TestNetworkGCRvR(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -3999,7 +3999,7 @@ class TestApplyRulesRestartRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -4043,7 +4043,7 @@ class TestApplyRulesRestartRvRNetwork(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -4095,7 +4095,7 @@ class TestApplyRulesRestartRvRNetwork(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -4156,7 +4156,7 @@ class TestApplyRulesRestartRvRNetwork(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -4177,7 +4177,7 @@ class TestApplyRulesRestartRvRNetwork(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.debug("Associated %s with network %s" % (
@@ -4439,7 +4439,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=network_off_vr.id,
zoneid=self.zone.id
)
@@ -4471,7 +4471,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -4500,7 +4500,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -4528,7 +4528,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -4574,7 +4574,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -4606,7 +4606,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -4635,7 +4635,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -4676,7 +4676,7 @@ class TestUpgradeDowngradeRVR(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -4808,7 +4808,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -4852,7 +4852,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -4972,7 +4972,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -5016,7 +5016,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -5208,7 +5208,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -5265,7 +5265,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)],
hostid=host.id
@@ -5449,7 +5449,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@@ -5506,7 +5506,7 @@ class TestRVRWithDiffEnvs(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)],
hostid=host.id
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_stopped_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_stopped_vm.py b/test/integration/component/test_stopped_vm.py
index 10e3d4d..f109691 100644
--- a/test/integration/component/test_stopped_vm.py
+++ b/test/integration/component/test_stopped_vm.py
@@ -188,7 +188,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
mode=self.zone.networktype
@@ -242,7 +242,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=True,
diskofferingid=self.disk_offering.id,
@@ -299,7 +299,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
diskofferingid=self.disk_offering.id,
@@ -332,7 +332,7 @@ class TestDeployVM(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -389,7 +389,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
diskofferingid=self.disk_offering.id,
@@ -426,7 +426,7 @@ class TestDeployVM(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Created volume in account: %s" % self.account.name)
@@ -457,7 +457,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
diskofferingid=self.disk_offering.id,
@@ -494,7 +494,7 @@ class TestDeployVM(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Created volume in account: %s" % self.account.name)
@@ -570,7 +570,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
diskofferingid=self.disk_offering.id,
@@ -607,7 +607,7 @@ class TestDeployVM(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Created volume in account: %s" % self.account.name)
@@ -653,7 +653,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
diskofferingid=self.disk_offering.id,
@@ -689,7 +689,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["iso"],
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Successfully created ISO with ID: %s" % iso.id)
@@ -746,7 +746,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
)
@@ -782,7 +782,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id
)
@@ -819,7 +819,7 @@ class TestDeployVM(cloudstackTestCase):
self.apiclient,
type='DATADISK',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -943,7 +943,7 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
startvm=False
@@ -990,7 +990,7 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
self.apiclient,
self.services["iso"],
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
try:
# Dowanload the ISO
@@ -1007,7 +1007,7 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
templateid=self.iso.id,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
@@ -1057,7 +1057,7 @@ class TestDeployHaEnabledVM(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
startvm=False
@@ -1175,7 +1175,7 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
startvm=False
@@ -1210,7 +1210,7 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1225,7 +1225,7 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
diskofferingid=self.disk_offering.id,
startvm=True
@@ -1260,7 +1260,7 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1295,7 +1295,7 @@ class TestRouterStateAfterDeploy(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertNotEqual(
@@ -1397,7 +1397,7 @@ class TestDeployVMBasicZone(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=True,
diskofferingid=self.disk_offering.id,
@@ -1455,7 +1455,7 @@ class TestDeployVMBasicZone(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False,
mode=self.zone.networktype
@@ -1570,7 +1570,7 @@ class TestDeployVMFromTemplate(cloudstackTestCase):
self.services["template"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
try:
self.template.download(self.apiclient)
@@ -1606,7 +1606,7 @@ class TestDeployVMFromTemplate(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
templateid=self.template.id,
startvm=False,
@@ -1744,7 +1744,7 @@ class TestVMAccountLimit(cloudstackTestCase):
self.apiclient,
0, # Instance
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
max=1
)
self.debug(
@@ -1756,7 +1756,7 @@ class TestVMAccountLimit(cloudstackTestCase):
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False
)
@@ -1775,7 +1775,7 @@ class TestVMAccountLimit(cloudstackTestCase):
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False
)
@@ -1861,7 +1861,7 @@ class TestUploadAttachVolume(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Uploading the volume: %s" % volume.name)
volume.wait_for_upload(self.apiclient)
@@ -1878,7 +1878,7 @@ class TestUploadAttachVolume(cloudstackTestCase):
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
startvm=False
)
@@ -1999,7 +1999,7 @@ class TestDeployOnSpecificHost(cloudstackTestCase):
self.services["virtual_machine"],
templateid=self.template.id,
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
hostid=host.id
)
@@ -2013,7 +2013,7 @@ class TestDeployOnSpecificHost(cloudstackTestCase):
id=vm.id,
listall=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
[46/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
PVLAN: Fix NPE when VM are in allocated state
If vlan is not assigned for VM, nic.getBroadcastUri() would be null. Then just
ignore it.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ce299da1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ce299da1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ce299da1
Branch: refs/heads/pvlan
Commit: ce299da11af719ab07a925700a5e3123b8f819a4
Parents: 8ee4f6c
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue May 21 14:46:31 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Tue May 21 14:46:31 2013 -0700
----------------------------------------------------------------------
.../cloud/network/router/VirtualNetworkApplianceManagerImpl.java | 2 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce299da1/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 64e412a..b969be2 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2609,7 +2609,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
for (Nic nic : routerNics) {
Network network = _networkModel.getNetwork(nic.getNetworkId());
- if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce299da1/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 71b4e3f..5e20656 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3059,7 +3059,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
for (NicVO nic : nics) {
NetworkVO network = _networkDao.findById(nic.getNetworkId());
if (network.getTrafficType() == TrafficType.Guest) {
- if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ if (nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
setupVmForPvlan(false, vm.getHostId(), nicProfile);
}
[12/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2102: Anti-Affinity - Even after reserved capacity has been released for a Vm in "Stopped" state , we are not allowed to deploy new Vms as part of same anti-affinity group in the last_host_id where the stopped Vm was running.
Changes:
Do not add the last_host_id of a Stopped VM to avoid set, if the VM has been stopped for more that capacity.skip.counting.hours time limit
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/55c1e282
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/55c1e282
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/55c1e282
Branch: refs/heads/pvlan
Commit: 55c1e282e390e95a2639df28e1cfd743772ee001
Parents: 5646f5e
Author: Prachi Damle <pr...@cloud.com>
Authored: Fri May 17 11:39:20 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Fri May 17 11:40:00 2013 -0700
----------------------------------------------------------------------
.../affinity/HostAntiAffinityProcessor.java | 31 ++++++++++++++++----
1 file changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/55c1e282/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
index 4c2c7f1..6c3f57f 100644
--- a/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
+++ b/plugins/affinity-group-processors/host-anti-affinity/src/org/apache/cloudstack/affinity/HostAntiAffinityProcessor.java
@@ -17,17 +17,24 @@
package org.apache.cloudstack.affinity;
import java.util.List;
+import java.util.Map;
import javax.ejb.Local;
import javax.inject.Inject;
+import javax.naming.ConfigurationException;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
+import org.apache.cloudstack.framework.messagebus.MessageSubscriber;
import org.apache.log4j.Logger;
+import com.cloud.configuration.Config;
+import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
+import com.cloud.utils.DateUtil;
+import com.cloud.utils.NumbersUtil;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@@ -46,7 +53,10 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
protected AffinityGroupDao _affinityGroupDao;
@Inject
protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
-
+ private int _vmCapacityReleaseInterval;
+ @Inject
+ protected ConfigurationDao _configDao;
+
@Override
public void process(VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan,
ExcludeList avoid)
@@ -76,12 +86,14 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
}
} else if (VirtualMachine.State.Stopped.equals(groupVM.getState())
&& groupVM.getLastHostId() != null) {
- avoid.addHost(groupVM.getLastHostId());
- if (s_logger.isDebugEnabled()) {
- s_logger.debug("Added host " + groupVM.getLastHostId() + " to avoid set, since VM "
- + groupVM.getId() + " is present on the host, in Stopped state");
+ long secondsSinceLastUpdate = (DateUtil.currentGMTTime().getTime() - groupVM.getUpdateTime().getTime()) / 1000;
+ if (secondsSinceLastUpdate < _vmCapacityReleaseInterval) {
+ avoid.addHost(groupVM.getLastHostId());
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Added host " + groupVM.getLastHostId() + " to avoid set, since VM "
+ + groupVM.getId() + " is present on the host, in Stopped state but has reserved capacity");
+ }
}
-
}
}
}
@@ -89,5 +101,12 @@ public class HostAntiAffinityProcessor extends AffinityProcessorBase implements
}
}
+
+ @Override
+ public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
+ super.configure(name, params);
+ _vmCapacityReleaseInterval = NumbersUtil.parseInt(_configDao.getValue(Config.CapacitySkipcountingHours.key()),3600);
+ return true;
+ }
}
[10/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
portable IP
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b3e9b2a5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3e9b2a5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3e9b2a5
Branch: refs/heads/pvlan
Commit: b3e9b2a5dc0439cad60058d693cba9d3c714af70
Parents: 4eb310e
Author: radhikap <ra...@citrix.com>
Authored: Fri May 17 18:57:59 2013 +0530
Committer: radhikap <ra...@citrix.com>
Committed: Fri May 17 18:58:32 2013 +0530
----------------------------------------------------------------------
docs/en-US/elastic-ip.xml | 161 ++++++++++++++++++++++-------------------
1 file changed, 87 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3e9b2a5/docs/en-US/elastic-ip.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/elastic-ip.xml b/docs/en-US/elastic-ip.xml
index 8ecbd75..672fc5a 100644
--- a/docs/en-US/elastic-ip.xml
+++ b/docs/en-US/elastic-ip.xml
@@ -26,78 +26,91 @@
choice from the EIP pool of your account. Later if required you can reassign the IP address to a
different VM. This feature is extremely helpful during VM failure. Instead of replacing the VM
which is down, the IP address can be reassigned to a new VM in your account. </para>
- <para>Similar to the public IP address, Elastic IP addresses are mapped to their associated
- private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
- service in an EIP-enabled basic zone. The default network offering,
- DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
- services if a NetScaler device is deployed in your zone. Consider the following illustration for
- more details.</para>
- <mediaobject>
- <imageobject>
- <imagedata fileref="./images/eip-ns-basiczone.png"/>
- </imageobject>
- <textobject>
- <phrase>eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.</phrase>
- </textobject>
- </mediaobject>
- <para>In the illustration, a NetScaler appliance is the default entry or exit point for the
- &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
- center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
- traffic in the pods and the Management Server are on different subnets / VLANs. The policy-based
- routing in the data center core switch sends the public traffic through the NetScaler, whereas
- the rest of the data center goes through the firewall. </para>
- <para>The EIP work flow is as follows:</para>
- <itemizedlist>
- <listitem>
- <para>When a user VM is deployed, a public IP is automatically acquired from the pool of
- public IPs configured in the zone. This IP is owned by the VM's account.</para>
- </listitem>
- <listitem>
- <para>Each VM will have its own private IP. When the user VM starts, Static NAT is provisioned
- on the NetScaler device by using the Inbound Network Address Translation (INAT) and Reverse
- NAT (RNAT) rules between the public IP and the private IP.</para>
- <note>
- <para>Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
- IP address is replaced in the packets from the public network, such as the Internet, with
- the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type of NAT
- supported by NetScaler, in which the source IP address is replaced in the packets
- generated by a VM in the private network with the public IP address.</para>
- </note>
- </listitem>
- <listitem>
- <para>This default public IP will be released in two cases:</para>
- <itemizedlist>
- <listitem>
- <para>When the VM is stopped. When the VM starts, it again receives a new public IP, not
- necessarily the same one allocated initially, from the pool of Public IPs.</para>
- </listitem>
- <listitem>
- <para>The user acquires a public IP (Elastic IP). This public IP is associated with the
- account, but will not be mapped to any private IP. However, the user can enable Static
- NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
- for the public IP can be disabled at any time. When Static NAT is disabled, a new public
- IP is allocated from the pool, which is not necessarily be the same one allocated
- initially.</para>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- <para>For the deployments where public IPs are limited resources, you have the flexibility to
- choose not to allocate a public IP by default. You can use the Associate Public IP option to
- turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
- off the automatic public IP assignment while creating a network offering, only a private IP is
- assigned to a VM when the VM is deployed with that network offering. Later, the user can acquire
- an IP for the VM and enable static NAT.</para>
- <para condition="admin">For more information on the Associate Public IP option, see <xref
- linkend="creating-network-offerings"/>.</para>
- <para condition="install">For more information on the Associate Public IP option, see the
- Administration Guide.</para>
- <note>
- <para>The Associate Public IP feature is designed only for use with user VMs. The System VMs
- continue to get both public IP and private by default, irrespective of the network offering
- configuration.</para>
- </note>
- <para>New deployments which use the default shared network offering with EIP and ELB services to
- create a shared network in the Basic zone will continue allocating public IPs to each user
- VM.</para>
+ <section id="about-eip">
+ <title>Elastic IPs in Basic Zone</title>
+ <para>Similar to the public IP address, Elastic IP addresses are mapped to their associated
+ private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
+ service in an EIP-enabled basic zone. The default network offering,
+ DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
+ services if a NetScaler device is deployed in your zone. Consider the following illustration
+ for more details.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/eip-ns-basiczone.png"/>
+ </imageobject>
+ <textobject>
+ <phrase>eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.</phrase>
+ </textobject>
+ </mediaobject>
+ <para>In the illustration, a NetScaler appliance is the default entry or exit point for the
+ &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
+ center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
+ traffic in the pods and the Management Server are on different subnets / VLANs. The
+ policy-based routing in the data center core switch sends the public traffic through the
+ NetScaler, whereas the rest of the data center goes through the firewall. </para>
+ <para>The EIP work flow is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para>When a user VM is deployed, a public IP is automatically acquired from the pool of
+ public IPs configured in the zone. This IP is owned by the VM's account.</para>
+ </listitem>
+ <listitem>
+ <para>Each VM will have its own private IP. When the user VM starts, Static NAT is
+ provisioned on the NetScaler device by using the Inbound Network Address Translation
+ (INAT) and Reverse NAT (RNAT) rules between the public IP and the private IP.</para>
+ <note>
+ <para>Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
+ IP address is replaced in the packets from the public network, such as the Internet,
+ with the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type
+ of NAT supported by NetScaler, in which the source IP address is replaced in the packets
+ generated by a VM in the private network with the public IP address.</para>
+ </note>
+ </listitem>
+ <listitem>
+ <para>This default public IP will be released in two cases:</para>
+ <itemizedlist>
+ <listitem>
+ <para>When the VM is stopped. When the VM starts, it again receives a new public IP, not
+ necessarily the same one allocated initially, from the pool of Public IPs.</para>
+ </listitem>
+ <listitem>
+ <para>The user acquires a public IP (Elastic IP). This public IP is associated with the
+ account, but will not be mapped to any private IP. However, the user can enable Static
+ NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
+ for the public IP can be disabled at any time. When Static NAT is disabled, a new
+ public IP is allocated from the pool, which is not necessarily be the same one
+ allocated initially.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <para>For the deployments where public IPs are limited resources, you have the flexibility to
+ choose not to allocate a public IP by default. You can use the Associate Public IP option to
+ turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
+ off the automatic public IP assignment while creating a network offering, only a private IP is
+ assigned to a VM when the VM is deployed with that network offering. Later, the user can
+ acquire an IP for the VM and enable static NAT.</para>
+ <para condition="admin">For more information on the Associate Public IP option, see <xref
+ linkend="creating-network-offerings"/>.</para>
+ <para condition="install">For more information on the Associate Public IP option, see the
+ Administration Guide.</para>
+ <note>
+ <para>The Associate Public IP feature is designed only for use with user VMs. The System VMs
+ continue to get both public IP and private by default, irrespective of the network offering
+ configuration.</para>
+ </note>
+ <para>New deployments which use the default shared network offering with EIP and ELB services to
+ create a shared network in the Basic zone will continue allocating public IPs to each user
+ VM.</para>
+ </section>
+ <section id="portable-ip">
+ <title>About Portable IP</title>
+ <para>Portable IPs in &PRODUCT; are nothing but elastic IPs that can be transferred across
+ geographically separated zones. As an administrator, you can provision a pool of portable IPs
+ at region level and are available for user consumption. The users can acquire portable IPs if
+ admin has provisioned portable public IPs at the region level they are part of. These IPs can
+ be use for any service within an advanced zone. You can also use portable IPs for EIP service
+ in basic zones. Additionally, a portable IP can be transferred from one network to another
+ network.</para>
+ </section>
</section>
[35/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Fixing TestVMLifeCycle class
Missed the reference to zone listed in setUpClass()
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/145a116c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/145a116c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/145a116c
Branch: refs/heads/pvlan
Commit: 145a116c9bbe69e3c5cb026ce9d659f449137d30
Parents: aa60105
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 22:05:07 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 22:05:53 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_vm_life_cycle.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/145a116c/test/integration/smoke/test_vm_life_cycle.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py
index 3f7c17b..d52ed9b 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -292,28 +292,28 @@ class TestVMLifeCycle(cloudstackTestCase):
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(cls.api_client, cls.services)
- cls.services['mode'] = zone.networktype
+ cls.zone = get_zone(cls.api_client, cls.services)
+ cls.services['mode'] = cls.zone.networktype
#if local storage is enabled, alter the offerings to use localstorage
#this step is needed for devcloud
- if zone.localstorageenabled == True:
+ if cls.zone.localstorageenabled == True:
cls.services["service_offerings"]["tiny"]["storagetype"] = 'local'
cls.services["service_offerings"]["small"]["storagetype"] = 'local'
cls.services["service_offerings"]["medium"]["storagetype"] = 'local'
template = get_template(
cls.api_client,
- zone.id,
+ cls.zone.id,
cls.services["ostype"]
)
# Set Zones and disk offerings
- cls.services["small"]["zoneid"] = zone.id
+ cls.services["small"]["zoneid"] = cls.zone.id
cls.services["small"]["template"] = template.id
- cls.services["medium"]["zoneid"] = zone.id
+ cls.services["medium"]["zoneid"] = cls.zone.id
cls.services["medium"]["template"] = template.id
- cls.services["iso"]["zoneid"] = zone.id
+ cls.services["iso"]["zoneid"] = cls.zone.id
# Create VMs, NAT Rules etc
cls.account = Account.create(
[08/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2122. Virtual machine id should be a required parameter for findHostsForMigration api. Fixing it.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e520ff45
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e520ff45
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e520ff45
Branch: refs/heads/pvlan
Commit: e520ff456801e9a7b57fe56ee78f4f649675c082
Parents: 107f492
Author: Devdeep Singh <de...@gmail.com>
Authored: Fri May 17 17:01:17 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Fri May 17 17:01:17 2013 +0530
----------------------------------------------------------------------
.../api/command/admin/host/FindHostsForMigrationCmd.java | 2 +-
server/src/com/cloud/server/ManagementServerImpl.java | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e520ff45/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
index e6e45cc..b2d77b8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java
@@ -45,7 +45,7 @@ public class FindHostsForMigrationCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
- required=false, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
+ required=true, description="find hosts to which this VM can be migrated and flag the hosts with enough " +
"CPU/RAM to host the VM")
private Long virtualMachineId;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e520ff45/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 f74b7ad..06c0f96 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1086,17 +1086,16 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
VMInstanceVO vm = _vmInstanceDao.findById(vmId);
if (vm == null) {
- InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the VM with specified id");
- ex.addProxyObject(vm, vmId, "vmId");
+ InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find the VM with given id");
throw ex;
}
if (vm.getState() != State.Running) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("VM is not Running, unable to migrate the vm" + vm);
+ s_logger.debug("VM is not running, cannot migrate the vm" + vm);
}
- InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, unable to" +
- " migrate the vm with specified id");
+ InvalidParameterValueException ex = new InvalidParameterValueException("VM is not Running, cannot " +
+ "migrate the vm with specified id");
ex.addProxyObject(vm, vmId, "vmId");
throw ex;
}
[45/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
PVLAN: Check BroadcastDomainType before extract pvlan tag
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8ee4f6c0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8ee4f6c0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8ee4f6c0
Branch: refs/heads/pvlan
Commit: 8ee4f6c080062632473c214b6fe896148e3d56e3
Parents: eb7c321
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue May 7 14:49:50 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Mon May 20 17:38:09 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/configuration/ConfigurationManagerImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8ee4f6c0/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 47c5482..7bd90b2 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2689,8 +2689,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
if (uri != null) {
String[] vlan = uri.toString().split("vlan:\\/\\/");
networkVlanId = vlan[1];
- //For pvlan
- networkVlanId = networkVlanId.split("-")[0];
+ if (network.getBroadcastDomainType() == BroadcastDomainType.Pvlan) {
+ networkVlanId = networkVlanId.split("-")[0];
+ }
}
if (vlanId != null) {
[27/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
Detect the second zone for copyImage operation
When copying templates and ISOs detect that a second zone is available.
Else skip the test.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92e63522
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92e63522
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92e63522
Branch: refs/heads/pvlan
Commit: 92e635228731fb72461e757f523cd20fefcd370b
Parents: 8da7ec0
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon May 20 17:50:32 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon May 20 17:51:49 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_iso.py | 10 ++++++----
test/integration/smoke/test_templates.py | 11 +++++++----
2 files changed, 13 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e63522/test/integration/smoke/test_iso.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py
index ad4a8f2..c645d3b 100644
--- a/test/integration/smoke/test_iso.py
+++ b/test/integration/smoke/test_iso.py
@@ -202,11 +202,9 @@ class TestISO(cloudstackTestCase):
cls.services["sourcezoneid"] = cls.zone.id
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
- zones = cls.api_client.listZones(cmd)
- if not isinstance(zones, list):
+ cls.zones = cls.api_client.listZones(cmd)
+ if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
- if len(zones) >= 2:
- cls.services["destzoneid"] = zones[1].id
#Create an account, ISOs etc.
cls.account = Account.create(
@@ -484,6 +482,10 @@ class TestISO(cloudstackTestCase):
#Validate the following
#1. copy ISO should be successful and secondary storage
# should contain new copied ISO.
+ if len(self.zones) <= 1:
+ self.skipTest("Not enough zones available to perform copy template")
+
+ self.services["destzoneid"] = filter(lambda z: z.id != self.zone.id, self.zones)[0]
self.debug("Copy ISO from %s to %s" % (
self.zone.id,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92e63522/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index 382f56f..8b83f5e 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -295,11 +295,9 @@ class TestTemplates(cloudstackTestCase):
cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
- zones = cls.api_client.listZones(cmd)
- if not isinstance(zones, list):
+ cls.zones = cls.api_client.listZones(cmd)
+ if not isinstance(cls.zones, list):
raise Exception("Failed to find zones.")
- if len(zones) >= 2:
- cls.services["destzoneid"] = zones[1].id
cls.disk_offering = DiskOffering.create(
cls.api_client,
@@ -664,6 +662,11 @@ class TestTemplates(cloudstackTestCase):
# 1. copy template should be successful and
# secondary storage should contain new copied template.
+ if len(self.zones) <= 1:
+ self.skipTest("Not enough zones available to perform copy template")
+
+ self.services["destzoneid"] = filter(lambda z: z.id != self.services["sourcezoneid"], self.zones)[0]
+
self.debug("Copy template from Zone: %s to %s" % (
self.services["sourcezoneid"],
self.services["destzoneid"]
[15/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2365: Anti-Affinity - As admin , we are allowed to deploy a Vm in an affinity group that belongs to different user.
CLOUDSTACK-2349: Anti-Affinity - As admin user , using updateVMAffinityGroup() , we are allowed to update the affinity group of a Vm (that belongs to a regular user) to be set to admin's affinity group.
Changes:
- Even for root-admin make sure that the affinity group and the VM belong to same account
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1851f7f7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1851f7f7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1851f7f7
Branch: refs/heads/pvlan
Commit: 1851f7f7f6bb4bcf3521ea44c51e9506cb86a72d
Parents: 7cae8ca
Author: Prachi Damle <pr...@cloud.com>
Authored: Fri May 17 15:32:21 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Fri May 17 15:33:01 2013 -0700
----------------------------------------------------------------------
server/src/com/cloud/vm/UserVmManagerImpl.java | 8 ++++++++
.../cloudstack/affinity/AffinityGroupServiceImpl.java | 9 +++++++++
2 files changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1851f7f7/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 860daaf..05ff6aa 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2366,6 +2366,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
} else {
// verify permissions
_accountMgr.checkAccess(caller, null, true, owner, ag);
+ // Root admin has access to both VM and AG by default, but
+ // make sure the owner of these entities is same
+ if (caller.getId() == Account.ACCOUNT_ID_SYSTEM || _accountMgr.isRootAdmin(caller.getType())) {
+ if (ag.getAccountId() != owner.getAccountId()) {
+ throw new PermissionDeniedException("Affinity Group " + ag
+ + " does not belong to the VM's account");
+ }
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1851f7f7/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
index fc2cfcf..efe18c3 100644
--- a/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
+++ b/server/src/org/apache/cloudstack/affinity/AffinityGroupServiceImpl.java
@@ -36,6 +36,7 @@ import com.cloud.deploy.DeploymentPlanner;
import com.cloud.event.ActionEvent;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.network.security.SecurityGroup;
import com.cloud.user.Account;
@@ -332,6 +333,14 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
} else {
// verify permissions
_accountMgr.checkAccess(caller, null, true, owner, ag);
+ // Root admin has access to both VM and AG by default, but make sure the
+ // owner of these entities is same
+ if (caller.getId() == Account.ACCOUNT_ID_SYSTEM || _accountMgr.isRootAdmin(caller.getType())) {
+ if (ag.getAccountId() != owner.getAccountId()) {
+ throw new PermissionDeniedException("Affinity Group " + ag
+ + " does not belong to the VM's account");
+ }
+ }
}
}
_affinityGroupVMMapDao.updateMap(vmId, affinityGroupIds);
[11/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
rbd: Allow RBD disks to be attached to a Instance
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5646f5e9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5646f5e9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5646f5e9
Branch: refs/heads/pvlan
Commit: 5646f5e9772380cc91a8ccb9894c8ed05ffc891f
Parents: b3e9b2a
Author: Wido den Hollander <wi...@widodh.nl>
Authored: Fri May 17 17:03:21 2013 +0200
Committer: Wido den Hollander <wi...@widodh.nl>
Committed: Fri May 17 17:34:05 2013 +0200
----------------------------------------------------------------------
.../hypervisor/kvm/resource/LibvirtComputingResource.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5646f5e9/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index c3140d3..b31fb5d 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -3581,6 +3581,7 @@ ServerResource {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
+ KVMStoragePool attachingPool = attachingDisk.getPool();
try {
if (!attach) {
dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
@@ -3605,7 +3606,12 @@ ServerResource {
}
} else {
diskdef = new DiskDef();
- if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
+ if (attachingPool.getType() == StoragePoolType.RBD) {
+ diskdef.defNetworkBasedDisk(attachingDisk.getPath(),
+ attachingPool.getSourceHost(), attachingPool.getSourcePort(),
+ attachingPool.getAuthUserName(), attachingPool.getUuid(), devId,
+ DiskDef.diskBus.VIRTIO, diskProtocol.RBD);
+ } else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId,
DiskDef.diskBus.VIRTIO, DiskDef.diskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
[38/50] [abbrv] Fix all occurrences of account.account
Posted by ya...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_tags.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py
index ab5ab31..12a5863 100644
--- a/test/integration/component/test_tags.py
+++ b/test/integration/component/test_tags.py
@@ -224,7 +224,7 @@ class TestResourceTags(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
mode=cls.zone.networktype
)
@@ -280,7 +280,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -297,7 +297,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.cleanup.append(public_ip)
@@ -346,7 +346,7 @@ class TestResourceTags(cloudstackTestCase):
resourceType='LoadBalancer',
key='LB',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
value=40
)
@@ -393,7 +393,7 @@ class TestResourceTags(cloudstackTestCase):
resourceType='LoadBalancer',
key='LB',
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
@@ -423,7 +423,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -440,7 +440,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.cleanup.append(public_ip)
@@ -484,7 +484,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='portForwardingRule',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='PF',
value=40
)
@@ -529,7 +529,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='portForwardingRule',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='PF',
value=40
)
@@ -560,7 +560,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -577,7 +577,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.cleanup.append(public_ip)
@@ -626,7 +626,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='FirewallRule',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='FW',
value='40'
)
@@ -671,7 +671,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='FirewallRule',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='FW',
value='40'
)
@@ -704,7 +704,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -721,7 +721,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id
)
self.cleanup.append(public_ip)
@@ -754,7 +754,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
public_ip.ipaddress.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
except Exception as e:
@@ -792,7 +792,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='VPN',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='protocol',
value='L2TP'
)
@@ -823,7 +823,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='VPN',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='protocol',
value='L2TP'
)
@@ -863,7 +863,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -907,7 +907,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -978,7 +978,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='Template',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='OS',
value='CentOS'
)
@@ -1019,7 +1019,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='Template',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='OS',
value='CentOS'
)
@@ -1042,7 +1042,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
self.services["iso"],
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("ISO created with ID: %s" % iso.id)
@@ -1070,7 +1070,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='ISO',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='OS',
value='CentOS'
)
@@ -1115,7 +1115,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='ISO',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='OS',
value='CentOS'
)
@@ -1141,7 +1141,7 @@ class TestResourceTags(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
diskofferingid=self.disk_offering.id
)
self.cleanup.append(volume)
@@ -1162,7 +1162,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='volume',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1205,7 +1205,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='volume',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region'
)
self.assertEqual(
@@ -1262,7 +1262,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='snapshot',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='type',
value='manual'
)
@@ -1312,7 +1312,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='snapshot',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='type',
value='manual'
)
@@ -1337,7 +1337,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1363,7 +1363,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='Network',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1381,7 +1381,7 @@ class TestResourceTags(cloudstackTestCase):
networks = Network.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True,
key='region',
value='India'
@@ -1409,7 +1409,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='Network',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1479,7 +1479,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1516,7 +1516,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1550,7 +1550,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1596,7 +1596,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1642,7 +1642,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1691,7 +1691,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
self.services["project"],
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
# Cleanup created project at end of test
self.cleanup.append(project)
@@ -1758,7 +1758,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='project',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -1799,7 +1799,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
self.services["iso"],
account=user_account.name,
- domainid=user_account.account.domainid
+ domainid=user_account.domainid
)
self.debug("ISO created with ID: %s" % iso.id)
@@ -1827,7 +1827,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='ISO',
account=user_account.name,
- domainid=user_account.account.domainid,
+ domainid=user_account.domainid,
key='region',
)
@@ -1849,7 +1849,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='ISO',
account=other_user_account.name,
- domainid=other_user_account.account.domainid,
+ domainid=other_user_account.domainid,
key='region',
)
@@ -1884,7 +1884,7 @@ class TestResourceTags(cloudstackTestCase):
self.apiclient,
self.services["iso"],
account=user_account.name,
- domainid=user_account.account.domainid
+ domainid=user_account.domainid
)
self.debug("ISO created with ID: %s" % iso.id)
@@ -1912,7 +1912,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='ISO',
account=user_account.name,
- domainid=user_account.account.domainid,
+ domainid=user_account.domainid,
key='region',
)
@@ -2009,7 +2009,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2042,7 +2042,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2065,7 +2065,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2103,7 +2103,7 @@ class TestResourceTags(cloudstackTestCase):
self.services["volume"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
diskofferingid=self.disk_offering.id
)
self.cleanup.append(volume)
@@ -2124,7 +2124,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='volume',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
)
self.assertEqual(
@@ -2152,7 +2152,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2185,7 +2185,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2246,7 +2246,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
@@ -2295,7 +2295,7 @@ class TestResourceTags(cloudstackTestCase):
listall=True,
resourceType='userVM',
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
key='region',
value='India'
)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 83b913a..7dbe7c4 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -316,7 +316,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -348,7 +348,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -373,7 +373,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -397,7 +397,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering_no_lb.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -432,7 +432,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -475,7 +475,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -500,7 +500,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -524,7 +524,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering_no_lb.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -575,7 +575,7 @@ class TestVPC(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -613,7 +613,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc_1)
@@ -624,7 +624,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc_2)
@@ -714,7 +714,7 @@ class TestVPC(cloudstackTestCase):
supportedservices='Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
listall=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(vpcs, list),
@@ -733,7 +733,7 @@ class TestVPC(cloudstackTestCase):
restartrequired=True,
listall=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
if vpcs is not None:
for vpc in vpcs:
@@ -748,7 +748,7 @@ class TestVPC(cloudstackTestCase):
restartrequired=False,
listall=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(vpcs, list),
@@ -789,7 +789,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc_1)
@@ -869,7 +869,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -898,7 +898,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -913,7 +913,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -927,7 +927,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -937,7 +937,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -949,7 +949,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -959,7 +959,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -970,7 +970,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1002,7 +1002,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1031,7 +1031,7 @@ class TestVPC(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -1049,7 +1049,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -1068,7 +1068,7 @@ class TestVPC(cloudstackTestCase):
accountid=self.account.name,
networkid=network_2.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (
@@ -1214,7 +1214,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1243,7 +1243,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering_no_lb.id,
zoneid=self.zone.id,
gateway='10.1.1.1',
@@ -1258,7 +1258,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway='10.1.2.1',
@@ -1272,7 +1272,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1282,7 +1282,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_1.id)]
)
@@ -1294,7 +1294,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1304,7 +1304,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network_2.id)]
)
@@ -1315,7 +1315,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1347,7 +1347,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_1.id,
vpcid=vpc.id
)
@@ -1376,7 +1376,7 @@ class TestVPC(cloudstackTestCase):
listall=True,
isstaticnat=True,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.assertEqual(
isinstance(public_ips, list),
@@ -1394,7 +1394,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network_2.id,
vpcid=vpc.id
)
@@ -1413,7 +1413,7 @@ class TestVPC(cloudstackTestCase):
accountid=self.account.name,
networkid=network_2.id,
vpcid=vpc.id,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("Adding virtual machines %s and %s to LB rule" % (
@@ -1558,7 +1558,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1574,7 +1574,7 @@ class TestVPC(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -1590,7 +1590,7 @@ class TestVPC(cloudstackTestCase):
src_nat_list = PublicIPAddress.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True,
issourcenat=True,
vpcid=vpc.id
@@ -1614,7 +1614,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc_1)
@@ -1628,7 +1628,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc_2)
@@ -1642,7 +1642,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.debug("%s" % vpc_3)
except Exception as e:
@@ -1677,7 +1677,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
self.network_offering = NetworkOffering.create(
@@ -1701,7 +1701,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1714,7 +1714,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -1729,7 +1729,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
zoneid=self.zone.id,
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=network.id,
vpcid=vpc.id
)
@@ -1823,7 +1823,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -1852,7 +1852,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1879,7 +1879,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkDomain=netdomain
)
self.validate_vpc_network(vpc)
@@ -1904,7 +1904,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -1917,7 +1917,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(network.id)]
)
@@ -2355,7 +2355,7 @@ class TestVPC(cloudstackTestCase):
self.services["vpc"],
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.services["vpc_no_name"]["cidr"] = "10.1.1.1/16"
@@ -2367,7 +2367,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
# Create VPC without zoneid param
@@ -2377,7 +2377,7 @@ class TestVPC(cloudstackTestCase):
self.services["vpc"],
vpcofferingid=self.vpc_off.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
vpc_wo_cidr = {"name": "TestVPC_WO_CIDR",
@@ -2392,7 +2392,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
@attr(tags=["advanced", "intervlan"])
@@ -2414,7 +2414,7 @@ class TestVPC(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc)
@@ -2439,7 +2439,7 @@ class TestVPC(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id,
gateway=gateway,
@@ -2671,7 +2671,7 @@ class TestVPCHostMaintenance(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc, state='Disabled')
return
@@ -2697,7 +2697,7 @@ class TestVPCHostMaintenance(cloudstackTestCase):
vpcofferingid=self.vpc_off.id,
zoneid=self.zone.id,
account=self.account.name,
- domainid=self.account.account.domainid
+ domainid=self.account.domainid
)
self.validate_vpc_network(vpc, state='Disabled')
interval = list_configurations(
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54ac779b/test/integration/component/test_vpc_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_host_maintenance.py b/test/integration/component/test_vpc_host_maintenance.py
index 4c14f99..1cce276 100644
--- a/test/integration/component/test_vpc_host_maintenance.py
+++ b/test/integration/component/test_vpc_host_maintenance.py
@@ -242,7 +242,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -258,7 +258,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -277,7 +277,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -288,7 +288,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_1.id)]
)
@@ -297,7 +297,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_1.id)]
)
@@ -305,14 +305,14 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_2.id,
networkids=[str(cls.network_2.id)]
)
routers = Router.list(
cls.api_client,
account=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
listall=True
)
if isinstance(routers, list):
@@ -376,7 +376,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_1.id,
listall=True
)
@@ -391,7 +391,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_2.id,
listall=True
)
@@ -441,7 +441,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
routers = Router.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -458,7 +458,7 @@ class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
listall=True
)
self.assertEqual(
@@ -618,7 +618,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
vpcofferingid=cls.vpc_off.id,
zoneid=cls.zone.id,
account=cls.account.name,
- domainid=cls.account.account.domainid
+ domainid=cls.account.domainid
)
cls.nw_off = NetworkOffering.create(
@@ -634,7 +634,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off.id,
zoneid=cls.zone.id,
gateway='10.1.1.1',
@@ -653,7 +653,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
networkofferingid=cls.nw_off_no_lb.id,
zoneid=cls.zone.id,
gateway='10.1.2.1',
@@ -664,7 +664,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_1.id)]
)
@@ -673,7 +673,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_2.id,
networkids=[str(cls.network_1.id)]
)
@@ -681,7 +681,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_1.id,
networkids=[str(cls.network_2.id)]
)
@@ -689,7 +689,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
- domainid=cls.account.account.domainid,
+ domainid=cls.account.domainid,
serviceofferingid=cls.service_offering_2.id,
networkids=[str(cls.network_2.id)]
)
@@ -739,7 +739,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_1.id,
listall=True
)
@@ -754,7 +754,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
vms = VirtualMachine.list(
self.apiclient,
account=self.account.name,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_2.id,
listall=True
)
@@ -800,7 +800,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_1.id,
vpcid=self.vpc.id
)
@@ -825,7 +825,7 @@ class TestVPCNetworkRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
- domainid=self.account.account.domainid,
+ domainid=self.account.domainid,
networkid=self.network_2.id,
vpcid=self.vpc.id
)
[05/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2542: Fix router test for basic zone
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2867c6a6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2867c6a6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2867c6a6
Branch: refs/heads/pvlan
Commit: 2867c6a6df6fe552cd8cf1f8bb7447bf8084d859
Parents: 55d304a
Author: SrikanteswaraRao Talluri <sr...@citrix.com>
Authored: Thu May 16 17:29:12 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Fri May 17 14:05:58 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_routers.py | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2867c6a6/test/integration/smoke/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_routers.py b/test/integration/smoke/test_routers.py
index 9ec2e91..f6ca279 100644
--- a/test/integration/smoke/test_routers.py
+++ b/test/integration/smoke/test_routers.py
@@ -141,11 +141,17 @@ class TestRouterServices(cloudstackTestCase):
# by checking status of dnsmasq process
# Find router associated with user account
- list_router_response = list_routers(
- self.apiclient,
- account=self.account.name,
- domainid=self.account.domainid
- )
+ if self.zone.networktype == "Basic":
+ list_router_response = list_routers(
+ self.apiclient,
+ listall="true"
+ )
+ else:
+ list_router_response = list_routers(
+ self.apiclient,
+ account=self.account.name,
+ domainid=self.account.domainid
+ )
self.assertEqual(
isinstance(list_router_response, list),
True,
[34/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2543: [Multiple_IP_Ranges] Failed to create IP alias on router vm
createipAlias.sh/deleteipAlias.sh won't be copied to XenServer host.
The directory of the scripts should be ".." rather "../../.." in all the xenserver patches file.
Corrected the path to ".." because the scripts are located at scripts/vm/hypervisor/xenserver/xenserver56/patch
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aa60105a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aa60105a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aa60105a
Branch: refs/heads/pvlan
Commit: aa60105a84e1260ec9687759a069a0c9cf0c46bf
Parents: d6452be
Author: Sanjeev Neelarapu <sa...@citrix.com>
Authored: Mon May 20 20:36:00 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Mon May 20 20:40:59 2013 +0530
----------------------------------------------------------------------
scripts/vm/hypervisor/xenserver/xcposs/patch | 2 ++
scripts/vm/hypervisor/xenserver/xcpserver/patch | 4 ++--
scripts/vm/hypervisor/xenserver/xenserver56/patch | 4 ++--
scripts/vm/hypervisor/xenserver/xenserver56fp1/patch | 4 ++--
scripts/vm/hypervisor/xenserver/xenserver60/patch | 4 ++--
5 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa60105a/scripts/vm/hypervisor/xenserver/xcposs/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcposs/patch b/scripts/vm/hypervisor/xenserver/xcposs/patch
index 6dc3baa..4d07c76 100644
--- a/scripts/vm/hypervisor/xenserver/xcposs/patch
+++ b/scripts/vm/hypervisor/xenserver/xcposs/patch
@@ -65,3 +65,5 @@ getRouterStatus.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
bumpUpPriority.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
getDomRVersion.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
router_proxy.sh=../../../../network/domr/,0755,/usr/lib/xcp/bin
+createipAlias.sh=..,0755,/usr/lib/xcp/bin
+deleteipAlias.sh=..,0755,/usr/lib/xcp/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa60105a/scripts/vm/hypervisor/xenserver/xcpserver/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xcpserver/patch b/scripts/vm/hypervisor/xenserver/xcpserver/patch
index a275df4..7e92d5a 100644
--- a/scripts/vm/hypervisor/xenserver/xcpserver/patch
+++ b/scripts/vm/hypervisor/xenserver/xcpserver/patch
@@ -40,8 +40,8 @@ make_migratable.sh=..,0755,/opt/xensource/bin
setup_iscsi.sh=..,0755,/opt/xensource/bin
pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
-createipAlias.sh=../../..,0755,/opt/xensource/bin
-deleteipAlias.sh=../../..,0755,/opt/xensource/bin
+createipAlias.sh=..,0755,/opt/xensource/bin
+deleteipAlias.sh=..,0755,/opt/xensource/bin
router_proxy.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa60105a/scripts/vm/hypervisor/xenserver/xenserver56/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56/patch b/scripts/vm/hypervisor/xenserver/xenserver56/patch
index 5c4673d..8abd6b2 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56/patch
@@ -38,8 +38,8 @@ make_migratable.sh=..,0755,/opt/xensource/bin
setup_iscsi.sh=..,0755,/opt/xensource/bin
cloud-setup-bonding.sh=..,0755,/opt/xensource/bin
pingtest.sh=../../..,0755,/opt/xensource/bin
-createipAlias.sh=../../..,0755,/opt/xensource/bin
-deleteipAlias.sh=../../..,0755,/opt/xensource/bin
+createipAlias.sh=..,0755,/opt/xensource/bin
+deleteipAlias.sh=..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa60105a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
index c7c58b9..901f6de 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver56fp1/patch
@@ -37,8 +37,8 @@ setupxenserver.sh=..,0755,/opt/xensource/bin
make_migratable.sh=..,0755,/opt/xensource/bin
setup_iscsi.sh=..,0755,/opt/xensource/bin
pingtest.sh=../../..,0755,/opt/xensource/bin
-createipAlias.sh=../../..,0755,/opt/xensource/bin
-deleteipAlias.sh=../../..,0755,/opt/xensource/bin
+createipAlias.sh=..,0755,/opt/xensource/bin
+deleteipAlias.sh=..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
vm_data.sh=../../../../network/domr/,0755,/opt/xensource/bin
save_password_to_domr.sh=../../../../network/domr/,0755,/opt/xensource/bin
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aa60105a/scripts/vm/hypervisor/xenserver/xenserver60/patch
----------------------------------------------------------------------
diff --git a/scripts/vm/hypervisor/xenserver/xenserver60/patch b/scripts/vm/hypervisor/xenserver/xenserver60/patch
index 26205f2..d7da374 100644
--- a/scripts/vm/hypervisor/xenserver/xenserver60/patch
+++ b/scripts/vm/hypervisor/xenserver/xenserver60/patch
@@ -40,8 +40,8 @@ id_rsa.cloud=../../../systemvm,0600,/root/.ssh
network_info.sh=..,0755,/opt/xensource/bin
setupxenserver.sh=..,0755,/opt/xensource/bin
make_migratable.sh=..,0755,/opt/xensource/bin
-createipAlias.sh=../../..,0755,/opt/xensource/bin
-deleteipAlias.sh=../../..,0755,/opt/xensource/bin
+createipAlias.sh=..,0755,/opt/xensource/bin
+deleteipAlias.sh=..,0755,/opt/xensource/bin
setup_iscsi.sh=..,0755,/opt/xensource/bin
pingtest.sh=../../..,0755,/opt/xensource/bin
dhcp_entry.sh=../../../../network/domr/,0755,/opt/xensource/bin
[23/50] [abbrv] git commit: updated refs/heads/pvlan to ce299da
Posted by ya...@apache.org.
CLOUDSTACK-2297 : Delete Account/Domain is not updating the resources usage of the parent domain
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a2fea4d4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a2fea4d4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a2fea4d4
Branch: refs/heads/pvlan
Commit: a2fea4d4499a963a7bb5aed73b4ee03016684529
Parents: e7332b7
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Mon May 13 10:54:52 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Mon May 20 14:08:31 2013 +0530
----------------------------------------------------------------------
.../cloud/configuration/dao/ResourceCountDao.java | 2 ++
.../configuration/dao/ResourceCountDaoImpl.java | 16 ++++++++++++++++
.../cloud/configuration/dao/ResourceLimitDao.java | 2 ++
.../configuration/dao/ResourceLimitDaoImpl.java | 14 ++++++++++++++
server/src/com/cloud/user/AccountManagerImpl.java | 17 +++++++++++++++++
server/src/com/cloud/user/DomainManagerImpl.java | 15 ++++++++++++---
6 files changed, 63 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
index 111bcb1..dc5a65c 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDao.java
@@ -55,4 +55,6 @@ public interface ResourceCountDao extends GenericDao<ResourceCountVO, Long> {
Set<Long> listAllRowsToUpdate(long ownerId, ResourceOwnerType ownerType, ResourceType type);
Set<Long> listRowsToUpdateForDomain(long domainId, ResourceType type);
+
+ long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
index 52bc746..cfd2137 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceCountDaoImpl.java
@@ -219,4 +219,20 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long>
return super.persist(resourceCountVO);
}
+
+
+ @Override
+ public long removeEntriesByOwner(long ownerId, ResourceOwnerType ownerType) {
+ SearchCriteria<ResourceCountVO> sc = TypeSearch.create();
+
+ if (ownerType == ResourceOwnerType.Account) {
+ sc.setParameters("accountId", ownerId);
+ return remove(sc);
+ } else if (ownerType == ResourceOwnerType.Domain) {
+ sc.setParameters("domainId", ownerId);
+ return remove(sc);
+ }
+ return 0;
+ }
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
index 5fd79b3..e47b383 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDao.java
@@ -32,4 +32,6 @@ public interface ResourceLimitDao extends GenericDao<ResourceLimitVO, Long> {
ResourceCount.ResourceType getLimitType(String type);
ResourceLimitVO findByOwnerIdAndType(long ownerId, ResourceOwnerType ownerType, ResourceCount.ResourceType type);
+
+ long removeEntriesByOwner(Long ownerId, ResourceOwnerType ownerType);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
index d337070..bb67f6b 100644
--- a/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
+++ b/engine/schema/src/com/cloud/configuration/dao/ResourceLimitDaoImpl.java
@@ -97,4 +97,18 @@ public class ResourceLimitDaoImpl extends GenericDaoBase<ResourceLimitVO, Long>
return null;
}
}
+
+ @Override
+ public long removeEntriesByOwner(Long ownerId, ResourceOwnerType ownerType) {
+ SearchCriteria<ResourceLimitVO> sc = IdTypeSearch.create();
+
+ if (ownerType == ResourceOwnerType.Account) {
+ sc.setParameters("accountId", ownerId);
+ return remove(sc);
+ } else if (ownerType == ResourceOwnerType.Domain) {
+ sc.setParameters("domainId", ownerId);
+ return remove(sc);
+ }
+ return 0;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index 4088f64..aac8d19 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -54,9 +54,12 @@ import com.cloud.api.query.dao.UserAccountJoinDao;
import com.cloud.api.query.vo.ControlledViewEntity;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
+import com.cloud.configuration.ResourceCountVO;
import com.cloud.configuration.ResourceLimit;
+import com.cloud.configuration.Resource.ResourceOwnerType;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.configuration.dao.ResourceCountDao;
+import com.cloud.configuration.dao.ResourceLimitDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.DataCenterVnetDao;
@@ -229,6 +232,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
private AccountGuestVlanMapDao _accountGuestVlanMapDao;
@Inject
private DataCenterVnetDao _dataCenterVnetDao;
+ @Inject
+ private ResourceLimitService _resourceLimitMgr;
+ @Inject
+ private ResourceLimitDao _resourceLimitDao;
private List<UserAuthenticator> _userAuthenticators;
List<UserAuthenticator> _userPasswordEncoders;
@@ -714,6 +721,16 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
int vlansReleased = _accountGuestVlanMapDao.removeByAccountId(accountId);
s_logger.info("deleteAccount: Released " + vlansReleased + " dedicated guest vlan ranges from account " + accountId);
+ // Update resource count for this account and for parent domains.
+ List<ResourceCountVO> resourceCounts = _resourceCountDao.listByOwnerId(accountId, ResourceOwnerType.Account);
+ for (ResourceCountVO resourceCount : resourceCounts) {
+ _resourceLimitMgr.decrementResourceCount(accountId, resourceCount.getType(), resourceCount.getCount());
+ }
+
+ // Delete resource count and resource limits entries set for this account (if there are any).
+ _resourceCountDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
+ _resourceLimitDao.removeEntriesByOwner(accountId, ResourceOwnerType.Account);
+
return true;
} catch (Exception ex) {
s_logger.warn("Failed to cleanup account " + account + " due to ", ex);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2fea4d4/server/src/com/cloud/user/DomainManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/DomainManagerImpl.java b/server/src/com/cloud/user/DomainManagerImpl.java
index dbcbe4e..c451041 100644
--- a/server/src/com/cloud/user/DomainManagerImpl.java
+++ b/server/src/com/cloud/user/DomainManagerImpl.java
@@ -16,11 +16,13 @@
// under the License.
package com.cloud.user;
-import java.util.*;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
import javax.ejb.Local;
import javax.inject.Inject;
-import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
@@ -29,8 +31,10 @@ import org.apache.cloudstack.region.RegionManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import com.cloud.configuration.Resource.ResourceOwnerType;
import com.cloud.configuration.ResourceLimit;
import com.cloud.configuration.dao.ResourceCountDao;
+import com.cloud.configuration.dao.ResourceLimitDao;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
@@ -49,7 +53,6 @@ import com.cloud.storage.DiskOfferingVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.user.dao.AccountDao;
import com.cloud.utils.Pair;
-import com.cloud.utils.component.Manager;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.Filter;
@@ -82,6 +85,8 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
private ProjectManager _projectMgr;
@Inject
private RegionManager _regionMgr;
+ @Inject
+ private ResourceLimitDao _resourceLimitDao;
@Override
public Domain getDomain(long domainId) {
@@ -329,6 +334,10 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
List<AccountVO> accountsForCleanup = _accountDao.findCleanupsForRemovedAccounts(domainId);
if (accountsForCleanup.isEmpty()) {
deleteDomainSuccess = _domainDao.remove(domainId);
+
+ // Delete resource count and resource limits entries set for this domain (if there are any).
+ _resourceCountDao.removeEntriesByOwner(domainId, ResourceOwnerType.Domain);
+ _resourceLimitDao.removeEntriesByOwner(domainId, ResourceOwnerType.Domain);
} else {
s_logger.debug("Can't delete the domain yet because it has " + accountsForCleanup.size() + "accounts that need a cleanup");
}