You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/05/09 20:01:16 UTC
[01/50] [abbrv] Fixed up unit testing to use only an in class
TestConfiguration
Updated Branches:
refs/heads/vmware-datamodel 91e382592 -> 57444fcb6
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/vpc/VpcTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/VpcTestConfiguration.java b/server/test/com/cloud/vpc/VpcTestConfiguration.java
index b1f2f80..7ae83f3 100644
--- a/server/test/com/cloud/vpc/VpcTestConfiguration.java
+++ b/server/test/com/cloud/vpc/VpcTestConfiguration.java
@@ -19,6 +19,7 @@ package com.cloud.vpc;
import java.io.IOException;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -91,7 +92,6 @@ import com.cloud.tags.dao.ResourceTagsDaoImpl;
import com.cloud.user.AccountManager;
import com.cloud.user.dao.AccountDaoImpl;
import com.cloud.user.dao.UserStatisticsDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.dao.DomainRouterDaoImpl;
import com.cloud.vm.dao.NicDaoImpl;
@@ -236,7 +236,7 @@ public class VpcTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = VpcTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
index f9c5728..484b044 100644
--- a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
+++ b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
@@ -24,6 +24,7 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -32,13 +33,23 @@ import javax.naming.ConfigurationException;
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
+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.event.EventUtils;
import com.cloud.event.EventVO;
@@ -48,6 +59,7 @@ import com.cloud.exception.ResourceInUseException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
+import com.cloud.user.AccountService;
import com.cloud.user.AccountVO;
import com.cloud.user.UserContext;
import com.cloud.user.dao.AccountDao;
@@ -57,7 +69,7 @@ import com.cloud.vm.VirtualMachine;
import com.cloud.vm.dao.UserVmDao;
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(locations = "classpath:/affinityContext.xml")
+@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class AffinityApiUnitTest {
@Inject
@@ -188,4 +200,57 @@ public class AffinityApiUnitTest {
_affinityService.updateVMAffinityGroups(10L, affinityGroupIds);
}
+ @Configuration
+ @ComponentScan(basePackageClasses = {AffinityGroupServiceImpl.class, EventUtils.class}, includeFilters = {@Filter(value = TestConfiguration.Library.class, type = FilterType.CUSTOM)}, useDefaultFilters = false)
+ public static class TestConfiguration extends SpringUtils.CloudStackTestConfiguration {
+
+ @Bean
+ public AccountDao accountDao() {
+ return Mockito.mock(AccountDao.class);
+ }
+
+ @Bean
+ public AccountService accountService() {
+ return Mockito.mock(AccountService.class);
+ }
+
+ @Bean
+ public AffinityGroupProcessor affinityGroupProcessor() {
+ return Mockito.mock(AffinityGroupProcessor.class);
+ }
+
+ @Bean
+ public AffinityGroupDao affinityGroupDao() {
+ return Mockito.mock(AffinityGroupDao.class);
+ }
+
+ @Bean
+ public AffinityGroupVMMapDao affinityGroupVMMapDao() {
+ return Mockito.mock(AffinityGroupVMMapDao.class);
+ }
+
+ @Bean
+ public AccountManager accountManager() {
+ return Mockito.mock(AccountManager.class);
+ }
+
+ @Bean
+ public EventDao eventDao() {
+ return Mockito.mock(EventDao.class);
+ }
+
+ @Bean
+ public UserVmDao userVMDao() {
+ return Mockito.mock(UserVmDao.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);
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/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 d47deaa..6f52397 100644
--- a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@ -27,6 +27,7 @@ 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;
import org.springframework.context.annotation.ComponentScan;
@@ -94,7 +95,6 @@ import com.cloud.storage.swift.SwiftManager;
import com.cloud.tags.dao.ResourceTagsDaoImpl;
import com.cloud.user.dao.AccountDaoImpl;
import com.cloud.user.dao.UserDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.dao.InstanceGroupDaoImpl;
import com.cloud.vm.dao.NicDaoImpl;
import com.cloud.vm.dao.NicSecondaryIpDaoImpl;
@@ -338,7 +338,7 @@ public class ChildTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = ChildTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/resources/affinityContext.xml
----------------------------------------------------------------------
diff --git a/server/test/resources/affinityContext.xml b/server/test/resources/affinityContext.xml
deleted file mode 100644
index d41a63d..0000000
--- a/server/test/resources/affinityContext.xml
+++ /dev/null
@@ -1,42 +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="componentContext" class="com.cloud.utils.component.ComponentContext" />
-
- <bean id="transactionContextBuilder" class="com.cloud.utils.db.TransactionContextBuilder" />
- <bean id="actionEventInterceptor" class="com.cloud.event.ActionEventInterceptor" />
- <bean id="instantiatePostProcessor" class="com.cloud.utils.component.ComponentInstantiationPostProcessor">
- <property name="Interceptors">
- <list>
- <ref bean="transactionContextBuilder" />
- <ref bean="actionEventInterceptor" />
- </list>
- </property>
- </bean>
-
- <bean class="org.apache.cloudstack.affinity.AffinityApiTestConfiguration" />
-
-
-</beans>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/services/console-proxy/pom.xml
----------------------------------------------------------------------
diff --git a/services/console-proxy/pom.xml b/services/console-proxy/pom.xml
index 2c9e2e6..3aac7b2 100644
--- a/services/console-proxy/pom.xml
+++ b/services/console-proxy/pom.xml
@@ -23,9 +23,9 @@
<packaging>pom</packaging>
<parent>
<groupId>org.apache.cloudstack</groupId>
- <artifactId>cloudstack</artifactId>
+ <artifactId>cloudstack-services</artifactId>
<version>4.2.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
+ <relativePath>../pom.xml</relativePath>
</parent>
<build>
<defaultGoal>install</defaultGoal>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/services/secondary-storage/pom.xml
----------------------------------------------------------------------
diff --git a/services/secondary-storage/pom.xml b/services/secondary-storage/pom.xml
index 0797c98..eb6c0ee 100644
--- a/services/secondary-storage/pom.xml
+++ b/services/secondary-storage/pom.xml
@@ -18,13 +18,13 @@
-->
<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>cloudstack-service-secondary-storage</artifactId>
+ <artifactId>cloud-secondary-storage</artifactId>
<name>Apache CloudStack Secondary Storage Service</name>
<parent>
<groupId>org.apache.cloudstack</groupId>
- <artifactId>cloudstack</artifactId>
+ <artifactId>cloudstack-services</artifactId>
<version>4.2.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
+ <relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index c050566..25134a8 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -1,15 +1,14 @@
<!-- 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. -->
+ 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">
+ 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-marvin</artifactId>
<name>Apache CloudStack marvin</name>
@@ -35,7 +34,7 @@
</goals>
<configuration>
<target>
- <delete dir="marvin/cloudstackAPI"/>
+ <delete dir="marvin/cloudstackAPI" />
<echo>Deleting ${project.artifactId} API sources</echo>
</target>
</configuration>
@@ -83,7 +82,7 @@
</plugin>
</plugins>
</build>
- <!-- Custom profiles for sync and integration tests-->
+ <!-- Custom profiles for sync and integration tests -->
<profiles>
<profile>
<id>marvin.sync</id>
@@ -161,6 +160,26 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>setproperty</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ pom.properties['resolved.basedir']=project.basedir.absolutePath.replace('\','/').replace('D:','/cyg/d');
+ pom.properties['resolved.userdir']='${user.dir}'.replace('\','/').replace('D:','/cyg/d');
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
@@ -177,18 +196,18 @@
<arguments>
<argument>deployAndRun.py</argument>
<argument>-c</argument>
- <argument>${user.dir}/${marvin.config}</argument>
+ <argument>${resolved.userdir}/${marvin.config}</argument>
<argument>-t</argument>
<argument>/tmp/t.log</argument>
<argument>-r</argument>
<argument>/tmp/r.log</argument>
<argument>-f</argument>
- <argument>${basedir}/marvin/testSetupSuccess.py</argument>
+ <argument>${resolved.basedir}/marvin/testSetupSuccess.py</argument>
</arguments>
</configuration>
</execution>
- </executions>
- </plugin>
+ </executions>
+ </plugin>
</plugins>
</build>
</profile>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/usage/test/com/cloud/usage/UsageManagerTestConfiguration.java
----------------------------------------------------------------------
diff --git a/usage/test/com/cloud/usage/UsageManagerTestConfiguration.java b/usage/test/com/cloud/usage/UsageManagerTestConfiguration.java
index d7cf046..1d3ed7b 100644
--- a/usage/test/com/cloud/usage/UsageManagerTestConfiguration.java
+++ b/usage/test/com/cloud/usage/UsageManagerTestConfiguration.java
@@ -25,7 +25,8 @@ import com.cloud.usage.dao.*;
import com.cloud.usage.parser.*;
import com.cloud.user.dao.AccountDaoImpl;
import com.cloud.user.dao.UserStatisticsDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
+
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -87,7 +88,7 @@ public class UsageManagerTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = UsageManagerTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/utils/src/com/cloud/utils/AnnotationHelper.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/AnnotationHelper.java b/utils/src/com/cloud/utils/AnnotationHelper.java
index 954b870..e7a6166 100755
--- a/utils/src/com/cloud/utils/AnnotationHelper.java
+++ b/utils/src/com/cloud/utils/AnnotationHelper.java
@@ -20,40 +20,38 @@ import javax.persistence.Table;
import org.apache.log4j.Logger;
-import com.cloud.utils.exception.CSExceptionErrorCode;
-
public class AnnotationHelper extends Object {
// This class contains routines to help query annotation elements of objects.
-
+
public static final Logger s_logger = Logger.getLogger(AnnotationHelper.class.getName());
-
+
public static String getTableName(Object proxyObj) {
// The cglib class is generated by cglib during runtime.
-
+
Class<?> curClass = proxyObj.getClass();
if (curClass == null) {
- s_logger.info("\nCould not retrieve class information for proxy object\n");
+ s_logger.trace("Could not retrieve class information for proxy object");
return null;
}
-
+
while (curClass.getSuperclass() != null && curClass.getSuperclass().getName() != "java.lang.Object") {
curClass = curClass.getSuperclass();
}
// At this point, curClass is the root base class of proxyObj's class, and curClass is not java.lang.Object.
- Table tabObj = (Table)curClass.getAnnotation(Table.class);
+ Table tabObj = curClass.getAnnotation(Table.class);
if (tabObj == null) {
- s_logger.info("\n" + curClass + "does not have a Table annotation\n");
+ s_logger.trace(curClass + "does not have a Table annotation");
return null;
}
-
+
return tabObj.name();
}
-
+
}
-
-
-
-
+
+
+
+
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/utils/src/com/cloud/utils/component/SpringComponentScanUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/component/SpringComponentScanUtils.java b/utils/src/com/cloud/utils/component/SpringComponentScanUtils.java
deleted file mode 100644
index 28b84e6..0000000
--- a/utils/src/com/cloud/utils/component/SpringComponentScanUtils.java
+++ /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
-// 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.utils.component;
-
-import org.springframework.context.annotation.ComponentScan;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-public class SpringComponentScanUtils {
-
- public static boolean includedInBasePackageClasses(String clazzName, ComponentScan cs) {
- Class<?> clazzToCheck;
- try {
- clazzToCheck = Class.forName(clazzName);
- } catch (ClassNotFoundException e) {
- throw new CloudRuntimeException("Unable to find " + clazzName);
- }
- Class<?>[] clazzes = cs.basePackageClasses();
- for (Class<?> clazz : clazzes) {
- if (clazzToCheck.isAssignableFrom(clazz)) {
- return true;
- }
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/utils/src/org/apache/cloudstack/test/utils/SpringUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/test/utils/SpringUtils.java b/utils/src/org/apache/cloudstack/test/utils/SpringUtils.java
new file mode 100644
index 0000000..220bd80
--- /dev/null
+++ b/utils/src/org/apache/cloudstack/test/utils/SpringUtils.java
@@ -0,0 +1,113 @@
+// 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
+// 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.test.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.utils.component.ComponentInstantiationPostProcessor;
+import com.cloud.utils.component.ComponentMethodInterceptor;
+import com.cloud.utils.db.TransactionContextBuilder;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+public class SpringUtils {
+
+ /**
+ * This method allows you to use @ComponentScan for your unit testing but
+ * it limits the scope of the classes found to the class specified in
+ * the @ComponentScan annotation.
+ *
+ * Without using this method, the default behavior of @ComponentScan is
+ * to actually scan in the package of the class specified rather than
+ * only the class. This can cause extra classes to be loaded which causes
+ * the classes these extra classes depend on to be loaded. The end effect
+ * is often most of the project gets loaded.
+ *
+ * In order to use this method properly, you must do the following: <li>
+ * - Specify @ComponentScan with basePackageClasses, includeFilters, and
+ * useDefaultFilters=true. See the following example.
+ *
+ * <pre>
+ * @ComponentScan(basePackageClasses={AffinityGroupServiceImpl.class, EventUtils.class},
+ * includeFilters={@Filter(value=TestConfiguration.Library.class, type=FilterType.CUSTOM)},
+ * useDefaultFilters=false)
+ * </pre>
+ *
+ * - Create a Library class and use that to call this method. See the
+ * following example. The Library class you define here is the Library
+ * class being added in the filter above.
+ *
+ * <pre>
+ * 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);
+ * }
+ * }
+ * </pre>
+ *
+ * @param clazzName name of the class that should be included in the Spring components
+ * @param cs ComponentScan annotation that was declared on the configuration
+ *
+ * @return
+ */
+ public static boolean includedInBasePackageClasses(String clazzName, ComponentScan cs) {
+ Class<?> clazzToCheck;
+ try {
+ clazzToCheck = Class.forName(clazzName);
+ } catch (ClassNotFoundException e) {
+ throw new CloudRuntimeException("Unable to find " + clazzName);
+ }
+ Class<?>[] clazzes = cs.basePackageClasses();
+ for (Class<?> clazz : clazzes) {
+ if (clazzToCheck.isAssignableFrom(clazz)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static class CloudStackTestConfiguration {
+
+ @Bean
+ public ComponentContext componentContext() {
+ return new ComponentContext();
+ }
+
+ @Bean
+ public TransactionContextBuilder transactionContextBuilder() {
+ return new TransactionContextBuilder();
+ }
+
+ @Bean
+ public ComponentInstantiationPostProcessor instantiatePostProcessor() {
+ ComponentInstantiationPostProcessor processor = new ComponentInstantiationPostProcessor();
+
+ List<ComponentMethodInterceptor> interceptors = new ArrayList<ComponentMethodInterceptor>();
+ interceptors.add(new TransactionContextBuilder());
+ processor.setInterceptors(interceptors);
+
+ return processor;
+ }
+ }
+}
[09/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
moving test data to top level dictionary
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/64522b6b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/64522b6b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/64522b6b
Branch: refs/heads/vmware-datamodel
Commit: 64522b6bd582f55eb4ca6a5e4850e39847beda34
Parents: 26d637a
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 13:51:34 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 13:52:12 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_guest_vlan_range.py | 18 ++++++++++++------
tools/marvin/marvin/cloudstackConnection.py | 2 +-
2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64522b6b/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index eca0e61..01cd68c 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -43,7 +43,8 @@ class Services:
"username": "test",
"password": "password",
},
- "name": "testphysicalnetwork"
+ "name": "testphysicalnetwork",
+ "vlan": "2118-2120",
}
@@ -64,7 +65,7 @@ class TesDedicateGuestVlanRange(cloudstackTestCase):
domainid=cls.domain.id
)
cls._cleanup = [
- #cls.account,
+ cls.account,
]
return
@@ -72,6 +73,13 @@ class TesDedicateGuestVlanRange(cloudstackTestCase):
def tearDownClass(cls):
try:
# Cleanup resources used
+ list_physical_network_response = PhysicalNetwork.list(cls.api_client)
+ if list_physical_network_response is not None and len(list_physical_network_response) > 0:
+ physical_network = list_physical_network_response[0]
+ removeGuestVlanRangeResponse = \
+ physical_network.update(cls.api_client,
+ id=physical_network.id,
+ removevlan=cls.services["vlan"])
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -119,12 +127,12 @@ class TesDedicateGuestVlanRange(cloudstackTestCase):
physical_network_response = list_physical_network_response[0]
self.debug("Adding guest vlan range")
- addGuestVlanRangeResponse = physical_network_response.update(self.apiclient, id=physical_network_response.id, vlan="387-390")
+ addGuestVlanRangeResponse = physical_network_response.update(self.apiclient, id=physical_network_response.id, vlan=self.services["vlan"])
self.debug("Dedicating guest vlan range");
dedicate_guest_vlan_range_response = PhysicalNetwork.dedicate(
self.apiclient,
- "387-390",
+ self.services["vlan"],
physicalnetworkid=physical_network_response.id,
account=self.account.name,
domainid=self.account.domainid
@@ -153,5 +161,3 @@ class TesDedicateGuestVlanRange(cloudstackTestCase):
"Check account name is system account in listDedicatedGuestVlanRanges"
)
- self.debug("Removing guest vlan range")
- removeGuestVlanRangeResponse = physical_network_response.update(self.apiclient, id=physical_network_response.id, removevlan="387-390")
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64522b6b/tools/marvin/marvin/cloudstackConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py
index 9a4c387..8039117 100644
--- a/tools/marvin/marvin/cloudstackConnection.py
+++ b/tools/marvin/marvin/cloudstackConnection.py
@@ -113,7 +113,7 @@ class cloudConnection(object):
)
signature = base64.encodestring(hmac.new(
self.securityKey, hashStr, hashlib.sha1).digest()).strip()
- self.logging.info("Computed Signature by Marvin: %s" % signature)
+ self.logging.debug("Computed Signature by Marvin: %s" % signature)
return signature
def request(self, command, auth=True, payload={}, method='GET'):
[14/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Renaming TesDedicateVlanRange -> TestDedicateVlanRange
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/887f405c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/887f405c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/887f405c
Branch: refs/heads/vmware-datamodel
Commit: 887f405ce3b02abef807e7dc8b40cbc4f33ae5bd
Parents: 808b49b
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 15:28:43 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 15:29:10 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_guest_vlan_range.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/887f405c/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 01cd68c..1723477 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -44,15 +44,15 @@ class Services:
"password": "password",
},
"name": "testphysicalnetwork",
- "vlan": "2118-2120",
+ "vlan": "118-120",
}
-class TesDedicateGuestVlanRange(cloudstackTestCase):
+class TestDedicateGuestVlanRange(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.api_client = super(TesDedicateGuestVlanRange, cls).getClsTestClient().getApiClient()
+ cls.api_client = super(TestDedicateGuestVlanRange, cls).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain
cls.domain = get_domain(cls.api_client, cls.services)
[39/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Made a cast so we don't get warnings
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3c597476
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3c597476
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3c597476
Branch: refs/heads/vmware-datamodel
Commit: 3c59747635bd859bc0db6aa1f4ede6a37732237f
Parents: 738d35a
Author: Alex Huang <al...@gmail.com>
Authored: Wed May 8 15:37:29 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Wed May 8 15:38:00 2013 -0700
----------------------------------------------------------------------
.../com/cloud/resource/ResourceManagerImpl.java | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c597476/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 c9c3f9c..0ab35dd 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -30,7 +30,6 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import com.cloud.dc.*;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
@@ -74,6 +73,13 @@ import com.cloud.cluster.ManagementServerNode;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
+import com.cloud.dc.ClusterVO;
+import com.cloud.dc.DataCenterIpAddressVO;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.HostPodVO;
+import com.cloud.dc.PodCluster;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.ClusterVSMMapDao;
import com.cloud.dc.dao.DataCenterDao;
@@ -1638,10 +1644,10 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
private Object dispatchToStateAdapters(ResourceStateAdapter.Event event,
boolean singleTaker, Object... args) {
synchronized (_resourceStateAdapters) {
- Iterator it = _resourceStateAdapters.entrySet().iterator();
+ Iterator<Map.Entry<String, ResourceStateAdapter>> it = _resourceStateAdapters.entrySet().iterator();
Object result = null;
while (it.hasNext()) {
- Map.Entry<String, ResourceStateAdapter> item = (Map.Entry<String, ResourceStateAdapter>) it
+ Map.Entry<String, ResourceStateAdapter> item = it
.next();
ResourceStateAdapter adapter = item.getValue();
[28/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2359: fix missing network type in the test scripts test_volumes.py and test_templates.py
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/93db64fc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/93db64fc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/93db64fc
Branch: refs/heads/vmware-datamodel
Commit: 93db64fc2531d72713c6b26d9e749f9aa6fd6640
Parents: 548a8d8
Author: Talluri <Sr...@citrix.com>
Authored: Wed May 8 00:57:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:26:40 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_guest_vlan_range.py | 2 +-
test/integration/smoke/test_templates.py | 1 +
test/integration/smoke/test_volumes.py | 1 +
3 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93db64fc/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 13cf335..bd53343 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -44,7 +44,7 @@ class Services:
"password": "password",
},
"name": "testphysicalnetwork",
- "vlan": "118-120",
+ "vlan": "2118-2120",
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93db64fc/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index fa4bc40..b2ad4ca 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -292,6 +292,7 @@ class TestTemplates(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
+ cls.services['mode'] = cls.zone.networktype
#populate second zone id for iso copy
cmd = listZones.listZonesCmd()
zones = cls.api_client.listZones(cmd)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93db64fc/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_volumes.py b/test/integration/smoke/test_volumes.py
index ecac8c9..4bf8203 100644
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@ -287,6 +287,7 @@ class TestVolumes(cloudstackTestCase):
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
+ cls.services['mode'] = cls.zone.networktype
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"]
[44/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2408: Object name is Null with list VNMC/List ASA API response
Setting object name correctly in response
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bde9ad3c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bde9ad3c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bde9ad3c
Branch: refs/heads/vmware-datamodel
Commit: bde9ad3c13397758cce0b69414c0a70904947d11
Parents: 2e21060
Author: Koushik Das <ko...@citrix.com>
Authored: Thu May 9 15:49:36 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Thu May 9 15:49:36 2013 +0530
----------------------------------------------------------------------
.../commands/ListCiscoAsa1000vResourcesCmd.java | 1 +
.../api/commands/ListCiscoVnmcResourcesCmd.java | 15 +++--
.../response/CiscoAsa1000vResourceResponse.java | 45 +++++++++------
.../api/response/CiscoVnmcResourceResponse.java | 42 ++++++++-----
4 files changed, 62 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bde9ad3c/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
index 509d39f..7a4db69 100755
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
@@ -89,6 +89,7 @@ public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
if (ciscoAsa1000vDevices != null && !ciscoAsa1000vDevices.isEmpty()) {
for (CiscoAsa1000vDevice ciscoAsa1000vDeviceVO : ciscoAsa1000vDevices) {
CiscoAsa1000vResourceResponse ciscoAsa1000vResourceResponse = _ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000vDeviceVO);
+ ciscoAsa1000vResourceResponse.setObjectName("asa1000v");
ciscoAsa1000vResourcesResponse.add(ciscoAsa1000vResourceResponse);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bde9ad3c/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
index ab553ee..b15c4e1 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
@@ -77,18 +77,19 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
try {
- List<CiscoVnmcControllerVO> CiscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
+ List<CiscoVnmcControllerVO> ciscoVnmcResources = _ciscoVnmcElementService.listCiscoVnmcResources(this);
ListResponse<CiscoVnmcResourceResponse> response = new ListResponse<CiscoVnmcResourceResponse>();
- List<CiscoVnmcResourceResponse> CiscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
+ List<CiscoVnmcResourceResponse> ciscoVnmcResourcesResponse = new ArrayList<CiscoVnmcResourceResponse>();
- if (CiscoVnmcResources != null && !CiscoVnmcResources.isEmpty()) {
- for (CiscoVnmcController CiscoVnmcResourceVO : CiscoVnmcResources) {
- CiscoVnmcResourceResponse CiscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(CiscoVnmcResourceVO);
- CiscoVnmcResourcesResponse.add(CiscoVnmcResourceResponse);
+ if (ciscoVnmcResources != null && !ciscoVnmcResources.isEmpty()) {
+ for (CiscoVnmcController ciscoVnmcResourceVO : ciscoVnmcResources) {
+ CiscoVnmcResourceResponse ciscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(ciscoVnmcResourceVO);
+ ciscoVnmcResourceResponse.setObjectName("vnmc");
+ ciscoVnmcResourcesResponse.add(ciscoVnmcResourceResponse);
}
}
- response.setResponses(CiscoVnmcResourcesResponse);
+ response.setResponses(ciscoVnmcResourcesResponse);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException invalidParamExcp) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bde9ad3c/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
index 9cd87da..f857b35 100755
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoAsa1000vResourceResponse.java
@@ -29,60 +29,69 @@ import com.google.gson.annotations.SerializedName;
@EntityReference(value = CiscoAsa1000vDevice.class)
public class CiscoAsa1000vResourceResponse extends BaseResponse {
- public static final String RESOURCE_NAME = "resourcename";
- @SerializedName(ApiConstants.RESOURCE_ID) @Parameter(description="resource id of the Cisco ASA 1000v appliance")
+ @SerializedName(ApiConstants.RESOURCE_ID)
+ @Parameter(description="resource id of the Cisco ASA 1000v appliance")
private String id;
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
@Parameter(description="the physical network to which this ASA 1000v belongs to", entityType = PhysicalNetworkResponse.class)
- private Long physicalNetworkId ;
-
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
+ private Long physicalNetworkId;
@SerializedName(ApiConstants.HOST_NAME)
@Parameter(description="management ip address of ASA 1000v")
private String managementIp;
- public String getManagementIp() {
- return managementIp;
- }
-
@SerializedName(ApiConstants.ASA_INSIDE_PORT_PROFILE)
- @Parameter(description="management ip address of ASA 1000v")
+ @Parameter(description="port profile associated with inside interface of ASA 1000v")
private String inPortProfile;
- public String getInPortProfile() {
- return inPortProfile;
- }
-
@SerializedName(ApiConstants.NETWORK_ID)
@Parameter(description="the guest network to which ASA 1000v is associated", entityType = NetworkResponse.class)
private Long guestNetworkId;
- public Long getGuestNetworkId() {
- return guestNetworkId;
+ public String getId() {
+ return id;
}
public void setId(String ciscoAsa1000vResourceId) {
this.id = ciscoAsa1000vResourceId;
}
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
+ public String getManagementIp() {
+ return managementIp;
+ }
+
public void setManagementIp(String managementIp) {
this.managementIp = managementIp;
}
+ public String getInPortProfile() {
+ return inPortProfile;
+ }
+
public void setInPortProfile(String inPortProfile) {
this.inPortProfile = inPortProfile;
}
+ public Long getGuestNetworkId() {
+ return guestNetworkId;
+ }
+
public void setGuestNetworkId(Long guestNetworkId) {
this.guestNetworkId = guestNetworkId;
}
+
+ @Override
+ public String getObjectId() {
+ return this.getId();
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bde9ad3c/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
index f5c9b72..92a766d 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/response/CiscoVnmcResourceResponse.java
@@ -25,6 +25,7 @@ import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import com.cloud.network.cisco.CiscoVnmcController;
import com.google.gson.annotations.SerializedName;
+
@EntityReference(value = CiscoVnmcController.class)
public class CiscoVnmcResourceResponse extends BaseResponse {
public static final String RESOURCE_NAME = "resourcename";
@@ -33,43 +34,52 @@ public class CiscoVnmcResourceResponse extends BaseResponse {
@Parameter(description="resource id of the Cisco VNMC controller")
private String id;
- @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
+ @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
@Parameter(description="the physical network to which this VNMC belongs to", entityType = PhysicalNetworkResponse.class)
private Long physicalNetworkId;
- public Long getPhysicalNetworkId() {
- return physicalNetworkId;
- }
-
- public String getProviderName() {
- return providerName;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- @SerializedName(ApiConstants.PROVIDER) @Parameter(description="name of the provider")
+ @SerializedName(ApiConstants.PROVIDER)
+ @Parameter(description="name of the provider")
private String providerName;
- @SerializedName(RESOURCE_NAME)
+ @SerializedName(RESOURCE_NAME)
@Parameter(description="Cisco VNMC resource name")
private String resourceName;
+ public String getId() {
+ return id;
+ }
+
public void setId(String ciscoVnmcResourceId) {
this.id = ciscoVnmcResourceId;
}
+ public Long getPhysicalNetworkId() {
+ return physicalNetworkId;
+ }
+
public void setPhysicalNetworkId(Long physicalNetworkId) {
this.physicalNetworkId = physicalNetworkId;
}
+ public String getProviderName() {
+ return providerName;
+ }
+
public void setProviderName(String providerName) {
this.providerName = providerName;
}
+ public String getResourceName() {
+ return resourceName;
+ }
+
public void setResourceName(String resourceName) {
this.resourceName = resourceName;
- }
+ }
+ @Override
+ public String getObjectId() {
+ return this.getId();
+ }
}
[13/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
commit e0d8f01ecd92a1a7b74558d02a28be3b2f20a10d enabled all tests. Fix
AWSAPI build by removing broken tests and excluding failing tests.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9ee85331
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9ee85331
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9ee85331
Branch: refs/heads/vmware-datamodel
Commit: 9ee853313439a2cb4c3cbd9ae2a650ed6b44274a
Parents: 8b965c5
Author: Hugo Trippaers <tr...@gmail.com>
Authored: Tue May 7 11:44:23 2013 +0200
Committer: Hugo Trippaers <tr...@gmail.com>
Committed: Tue May 7 11:44:23 2013 +0200
----------------------------------------------------------------------
awsapi/pom.xml | 33 +-
.../test/com/cloud/gate/model/ModelTestCase.java | 368 ---------------
.../com/cloud/gate/persist/PersitTestCase.java | 73 ---
3 files changed, 11 insertions(+), 463 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ee85331/awsapi/pom.xml
----------------------------------------------------------------------
diff --git a/awsapi/pom.xml b/awsapi/pom.xml
index f19a713..d457349 100644
--- a/awsapi/pom.xml
+++ b/awsapi/pom.xml
@@ -286,12 +286,6 @@
</dependency>
</dependencies>
<build>
- <defaultGoal>install</defaultGoal>
- <sourceDirectory>src</sourceDirectory>
- <!-- Tests still depend on hibernate,
- so thats not going to work
- <testSourceDirectory>test</testSourceDirectory>
- -->
<resources>
<resource>
<directory>src</directory>
@@ -307,6 +301,17 @@
</resource>
</resources>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>com/cloud/gate/util/UtilTestCase.java</exclude>
+ <exclude>com/cloud/gate/service/ServiceTestCase.java</exclude>
+ <exclude>com/cloud/gate/util/CloudStackClientTestCase.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
@@ -364,22 +369,6 @@
</executions>
</plugin>
</plugins>
- <!--
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- -->
<pluginManagement>
<plugins>
<plugin>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ee85331/awsapi/test/com/cloud/gate/model/ModelTestCase.java
----------------------------------------------------------------------
diff --git a/awsapi/test/com/cloud/gate/model/ModelTestCase.java b/awsapi/test/com/cloud/gate/model/ModelTestCase.java
deleted file mode 100644
index 91aeaa7..0000000
--- a/awsapi/test/com/cloud/gate/model/ModelTestCase.java
+++ /dev/null
@@ -1,368 +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.gate.model;
-
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.hibernate.Transaction;
-import org.junit.Assert;
-
-import com.cloud.bridge.model.MHost;
-import com.cloud.bridge.model.MHostMount;
-import com.cloud.bridge.model.SBucket;
-import com.cloud.bridge.model.SHost;
-import com.cloud.bridge.model.SMeta;
-import com.cloud.bridge.model.SObject;
-import com.cloud.bridge.util.CloudSessionFactory;
-import com.cloud.bridge.util.QueryHelper;
-import com.cloud.gate.testcase.BaseTestCase;
-
-public class ModelTestCase extends BaseTestCase {
- protected final static Logger logger = Logger.getLogger(ModelTestCase.class);
-
- public void testSHost() {
- SHost host;
-
- // create the record
- Session session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = new SHost();
- host.setHost("localhost");
- host.setExportRoot("/");
- host.setUserOnHost("root");
- host.setUserPassword("password");
- session.saveOrUpdate(host);
- txn.commit();
- } finally {
- session.close();
- }
- Assert.assertTrue(host.getId() != 0);
-
- // retrive the record
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = (SHost)session.get(SHost.class, (long)host.getId());
- txn.commit();
-
- Assert.assertTrue(host.getHost().equals("localhost"));
- Assert.assertTrue(host.getUserOnHost().equals("root"));
- Assert.assertTrue(host.getUserPassword().equals("password"));
-
- logger.info("Retrived record, host:" + host.getHost()
- + ", user: " + host.getUserOnHost()
- + ", password: " + host.getUserPassword());
-
- } finally {
- session.close();
- }
-
- // delete the record
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = (SHost)session.get(SHost.class, (long)host.getId());
- session.delete(host);
- txn.commit();
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = (SHost)session.get(SHost.class, (long)host.getId());
- txn.commit();
-
- Assert.assertTrue(host == null);
- } finally {
- session.close();
- }
- }
-
- public void testSBucket() {
- SHost host;
- SBucket bucket;
- Session session;
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = new SHost();
- host.setHost("localhost");
- host.setUserOnHost("root");
- host.setUserPassword("password");
- host.setExportRoot("/");
-
- bucket = new SBucket();
- bucket.setName("Bucket");
- bucket.setOwnerCanonicalId("OwnerId-dummy");
- bucket.setCreateTime(new Date());
-
- host.getBuckets().add(bucket);
- bucket.setShost(host);
-
- session.save(host);
- session.save(bucket);
- txn.commit();
- } finally {
- session.close();
- }
-
- long bucketId = bucket.getId();
-
- // load bucket
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- bucket = (SBucket)session.get(SBucket.class, bucketId);
- txn.commit();
-
- Assert.assertTrue(bucket.getShost().getHost().equals("localhost"));
- Assert.assertTrue(bucket.getName().equals("Bucket"));
- Assert.assertTrue(bucket.getOwnerCanonicalId().equals("OwnerId-dummy"));
- } finally {
- session.close();
- }
-
- // delete the bucket
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- bucket = (SBucket)session.get(SBucket.class, bucketId);
- session.delete(bucket);
-
- host = (SHost)session.get(SHost.class, host.getId());
- session.delete(host);
- txn.commit();
- } finally {
- session.close();
- }
-
- // verify the deletion
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- bucket = (SBucket)session.get(SBucket.class, bucketId);
- txn.commit();
-
- Assert.assertTrue(bucket == null);
- } finally {
- session.close();
- }
- }
-
- public void testSObject() {
- SHost host;
- SBucket bucket;
- Session session;
- SObject sobject;
-
- // setup
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- host = new SHost();
- host.setHost("localhost");
- host.setUserOnHost("root");
- host.setUserPassword("password");
- host.setExportRoot("/");
-
- bucket = new SBucket();
- bucket.setName("Bucket");
- bucket.setOwnerCanonicalId("OwnerId-dummy");
- bucket.setCreateTime(new Date());
- bucket.setShost(host);
- host.getBuckets().add(bucket);
-
- sobject = new SObject();
- sobject.setNameKey("ObjectNameKey");
- sobject.setOwnerCanonicalId("OwnerId-dummy");
- sobject.setCreateTime(new Date());
- sobject.setBucket(bucket);
- bucket.getObjectsInBucket().add(sobject);
-
- session.save(host);
- session.save(bucket);
- session.save(sobject);
- txn.commit();
-
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- sobject = (SObject)session.get(SObject.class, sobject.getId());
- txn.commit();
- Assert.assertTrue(sobject.getBucket().getName().equals("Bucket"));
- Assert.assertTrue(sobject.getNameKey().equals("ObjectNameKey"));
- Assert.assertTrue(sobject.getOwnerCanonicalId().equals("OwnerId-dummy"));
- } finally {
- session.close();
- }
-
- // test delete cascade
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- bucket = (SBucket)session.get(SBucket.class, bucket.getId());
- session.delete(bucket);
-
- host = (SHost)session.get(SHost.class, host.getId());
- session.delete(host);
- txn.commit();
- } finally {
- session.close();
- }
- }
-
- public void testMeta() {
- Session session;
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- SMeta meta = new SMeta();
- meta.setTarget("SObject");
- meta.setTargetId(1);
- meta.setName("param1");
- meta.setValue("value1");
- session.save(meta);
-
- logger.info("Meta 1: " + meta.getId());
-
- meta = new SMeta();
- meta.setTarget("SObject");
- meta.setTargetId(1);
- meta.setName("param2");
- meta.setValue("value2");
- session.save(meta);
-
- logger.info("Meta 2: " + meta.getId());
-
- txn.commit();
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- Query query = session.createQuery("from SMeta where target=? and targetId=?");
- QueryHelper.bindParameters(query, new Object[] {
- "SObject", new Long(1)
- });
- List<SMeta> l = QueryHelper.executeQuery(query);
- txn.commit();
-
- for(SMeta meta: l) {
- logger.info("" + meta.getName() + "=" + meta.getValue());
- }
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- Query query = session.createQuery("delete from SMeta where target=?");
- QueryHelper.bindParameters(query, new Object[] {"SObject"});
- query.executeUpdate();
- txn.commit();
- } finally {
- session.close();
- }
- }
-
- public void testHosts() {
- Session session;
- SHost shost;
- MHost mhost;
- MHostMount hostMount;
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- shost = new SHost();
- shost.setHost("Storage host1");
- shost.setUserOnHost("root");
- shost.setUserPassword("password");
- shost.setExportRoot("/");
- session.save(shost);
-
- mhost = new MHost();
- mhost.setHostKey("1");
- mhost.setHost("management host1");
- mhost.setVersion("v1");
- session.save(mhost);
-
- hostMount = new MHostMount();
- hostMount.setMhost(mhost);
- hostMount.setShost(shost);
- hostMount.setMountPath("/mnt");
- session.save(hostMount);
- txn.commit();
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- mhost = (MHost)session.createQuery("from MHost where hostKey=?").
- setLong(0, new Long(1)).uniqueResult();
-
- if(mhost != null) {
- Iterator it = mhost.getMounts().iterator();
- while(it.hasNext()) {
- MHostMount mount = (MHostMount)it.next();
- Assert.assertTrue(mount.getMountPath().equals("/mnt"));
-
- logger.info(mount.getMountPath());
- }
- }
- txn.commit();
- } finally {
- session.close();
- }
-
- session = CloudSessionFactory.getInstance().openSession();
- try {
- Transaction txn = session.beginTransaction();
- mhost = (MHost)session.createQuery("from MHost where hostKey=?").
- setLong(0, new Long(1)).uniqueResult();
- if(mhost != null)
- session.delete(mhost);
-
- shost = (SHost)session.createQuery("from SHost where host=?").
- setString(0, "Storage host1").uniqueResult();
- if(shost != null)
- session.delete(shost);
- txn.commit();
- } finally {
- session.close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ee85331/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
----------------------------------------------------------------------
diff --git a/awsapi/test/com/cloud/gate/persist/PersitTestCase.java b/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
deleted file mode 100644
index 4961d93..0000000
--- a/awsapi/test/com/cloud/gate/persist/PersitTestCase.java
+++ /dev/null
@@ -1,73 +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.gate.persist;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.bridge.persist.PersistContext;
-import com.cloud.gate.testcase.BaseTestCase;
-
-public class PersitTestCase extends BaseTestCase {
- protected final static Logger logger = Logger.getLogger(PersitTestCase.class);
-
- public void testNamedLock() {
- Thread t1 = new Thread(new Runnable() {
- public void run() {
- for(int i = 0; i < 10; i++) {
- if(PersistContext.acquireNamedLock("TestLock", 3)) {
- logger.info("Thread 1 acquired lock");
- try {
- Thread.currentThread().sleep(BaseTestCase.getRandomMilliseconds(5000, 10000));
- } catch (InterruptedException e) {
- }
- logger.info("Thread 1 to release lock");
- PersistContext.releaseNamedLock("TestLock");
- } else {
- logger.info("Thread 1 is unable to acquire lock");
- }
- }
- }
- });
-
- Thread t2 = new Thread(new Runnable() {
- public void run() {
- for(int i = 0; i < 10; i++) {
- if(PersistContext.acquireNamedLock("TestLock", 3)) {
- logger.info("Thread 2 acquired lock");
- try {
- Thread.currentThread().sleep(BaseTestCase.getRandomMilliseconds(1000, 5000));
- } catch (InterruptedException e) {
- }
- logger.info("Thread 2 to release lock");
- PersistContext.releaseNamedLock("TestLock");
- } else {
- logger.info("Thread 2 is unable to acquire lock");
- }
- }
- }
- });
-
- t1.start();
- t2.start();
-
- try {
- t1.join();
- t2.join();
- } catch(InterruptedException e) {
- }
- }
-}
[33/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-702: Tests for Multiple IP Ranges-R4
Add ip range overlapped with two ip ranges in the exiting cidr
Signed-off-by: sanjeevneelarapu <sa...@citrix.com>
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/53e49651
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53e49651
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53e49651
Branch: refs/heads/vmware-datamodel
Commit: 53e496517ed51bab2c81084a02f49b0408b19a37
Parents: b8358e1
Author: sanjeevneelarapu <sa...@citrix.com>
Authored: Mon May 6 20:38:54 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:37:29 2013 +0530
----------------------------------------------------------------------
.../component/test_multiple_ip_ranges.py | 58 +++++++++++++++
1 files changed, 58 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53e49651/test/integration/component/test_multiple_ip_ranges.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_multiple_ip_ranges.py b/test/integration/component/test_multiple_ip_ranges.py
index 29942bd..7e9eeb1 100644
--- a/test/integration/component/test_multiple_ip_ranges.py
+++ b/test/integration/component/test_multiple_ip_ranges.py
@@ -368,3 +368,61 @@ class TestMultipleIpRanges(cloudstackTestCase):
#Test will reach here there is a bug in overlap ip range checking
self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed")
return
+
+ @attr(tags=["advanced_sg", "sg"])
+ def test_06_add_ip_range_overlapped_with_two_ranges(self):
+ """Test adding overlapped ip range in existing cidr
+
+ 1.Add ip range in new cidr e.g:10.147.40.2-10.147.40.10
+ 2.Add another ip range in the same cidr e.g:10.147.40.20-10.147.40.30
+ 2.Add ip range overlapped with both the ip ranges e.g.10.147.40.10-20
+ """
+ #call increment_cidr function to get exiting cidr from the setup and increment it
+ ip2 = self.increment_cidr()
+ test_nw = ip2.network
+ ip = IPAddress(test_nw)
+ #Add IP range in the new CIDR
+ test_gateway = ip.__add__(1)
+ test_startIp = ip.__add__(2)
+ test_endIp = ip.__add__(10)
+ test_startIp2 = ip.__add__(20)
+ test_endIp2 = ip.__add__(30)
+ test_startIp3 = ip.__add__(10)
+ test_endIp3 = ip.__add__(20)
+ #Populating services with new IP range
+ self.services["vlan_ip_range"]["startip"] = test_startIp
+ self.services["vlan_ip_range"]["endip"] = test_endIp
+ self.services["vlan_ip_range"]["gateway"] = test_gateway
+ self.services["vlan_ip_range"]["netmask"] = self.netmask
+ self.services["vlan_ip_range"]["zoneid"] = self.zone.id
+ self.services["vlan_ip_range"]["podid"] = self.pod.id
+ #create new vlan ip range
+ new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+ self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp,test_endIp))
+ self.cleanup.append(new_vlan)
+ new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
+ #Compare list output with configured values
+ self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
+ #Add 2nd IP range in the same CIDR
+ self.services["vlan_ip_range"]["startip"] = test_startIp2
+ self.services["vlan_ip_range"]["endip"] = test_endIp2
+ new_vlan = PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+ self.debug("Created new vlan range with startip:%s and endip:%s" %(test_startIp2,test_endIp2))
+ self.cleanup.append(new_vlan)
+ new_vlan_res = new_vlan.list(self.apiclient,id=new_vlan.vlan.id)
+ #Compare list output with configured values
+ self.verify_vlan_range(new_vlan_res,self.services["vlan_ip_range"])
+ #Add ip range which will overlap with two existing ip ranges in the same CIDR
+ #Populating services with new IP range
+ self.services["vlan_ip_range"]["startip"] = test_startIp3
+ self.services["vlan_ip_range"]["endip"] = test_endIp3
+ #Try to create ip range overlapped with exiting ip range
+ try:
+ PublicIpRange.create(self.apiclient, self.services["vlan_ip_range"])
+ except cloudstackAPIException as cs:
+ self.debug(cs.errorMsg)
+ self.assertTrue(cs.errorMsg.find("already has IPs that overlap with the new range")>0, msg="Fail:CS allowed adding overlapped ip ranges in guest cidr")
+ return
+ #Test will reach here there is a bug in overlap ip range checking
+ self.fail("CS should not accept overlapped ip ranges in guest traffic, but it allowed")
+ return
[27/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Breaking down region tests
region tests will be run in smoke and regression. In smoke we only test
the basic creation of a region. More extensive testing of duplicate
regions, test for updating region atteributes is in component.
Separated the class for testing accounts within region (account sync)
into a a new suite.
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/548a8d8c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/548a8d8c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/548a8d8c
Branch: refs/heads/vmware-datamodel
Commit: 548a8d8c1f391812bb492b42704d21dd99ac59b7
Parents: 5ef2f1f
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed May 8 12:39:34 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 13:50:04 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_regions.py | 469 +++------------
.../integration/component/test_regions_accounts.py | 206 +++++++
test/integration/smoke/test_regions.py | 93 +++
tools/marvin/marvin/integration/lib/base.py | 8 +-
4 files changed, 386 insertions(+), 390 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/548a8d8c/test/integration/component/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_regions.py b/test/integration/component/test_regions.py
index 1b24871..daf16cd 100644
--- a/test/integration/component/test_regions.py
+++ b/test/integration/component/test_regions.py
@@ -21,423 +21,120 @@ 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
+from random import choice
class Services:
- """
- """
-
def __init__(self):
self.services = {
- "domain": {
- "name": "testuuid",
- "domainUUID": "domain1"
- },
- "account": {
- "email": "test@test.com",
- "firstname": "Testuuid",
- "lastname": "Useruuid",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- "accountUUID": "account1",
- "userUUID": "user1"
- },
- "user": {
- "email": "test@test.com",
- "firstname": "Testuuid",
- "lastname": "Useruuid",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- "userUUID": "user2"
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- "region": {
- "regionid": "2",
- "regionname": "Region2",
- "regionendpoint": "http://region2:8080/client"
- }
+ "region": {
+ "regionid": "2",
+ "regionname": "Region2",
+ "regionendpoint": "http://region2:8080/client"
+ }
}
-
class TestRegions(cloudstackTestCase):
+ """Test Regions - CRUD tests for regions
"""
- Testing Regions related Apis
- """
+
@classmethod
def setUpClass(cls):
cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
cls.services = Services().services
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.cleanup = []
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.cleanup = []
return
- @attr(tags=["basic", "advanced"])
- def test_createAccountWithUUID(self):
- """
- Test for creating Account by passing id parameter
-
- # Validate the following
- # 1.Create an Account by passing id parameter.Verify the account is created.
- # 2.List this account by passing id parameter.Verify that list account is able to lis this account.
- # 3.Delete account should succeed.
-
- """
- account = Account.create(
- self.api_client,
- self.services["account"],
- domainid=self.domain.id
- )
- self.assertIn ( self.services["account"]["accountUUID"] , account.id,
- "Account is not created with the accountId passed")
-
- list_account = Account.list(self.api_client,
- id=account.id
- )
-
- self.assertEqual(
- isinstance(list_account, list),
- True,
- "Check for list account response by uuid failed"
- )
-
- print (list_account)
-
- account_response = list_account[0]
-
- print (account_response)
-
- self.assertEqual( account_response.id,
- account.id,
- "listAccount response does not match with account Id "
- )
- self.assertEqual(
- account_response.user[0].firstname,
- self.services["account"]["firstname"],
- "listAccount response does not match with account firstname"
- )
-
- self.cleanup.append(account)
- return
-
- @attr(tags=["basic", "advanced"])
- def test_createUserWithUUID(self):
- """
- Test for creating User by passing id parameter
-
- # Validate the following
- # 1.Create a User by passing id parameter.Verify the user is created.
- # 2.List this user by passing id parameter.Verify that list user is able to list this user.
- # 3.Delete User should succeed.
-
- """
-
- user = User.create(
- self.api_client,
- self.services["user"],
- account="Admin",
- domainid=self.domain.id
- )
- self.assertIn ( self.services["user"]["userUUID"] , user.id,
- "User is not created successfully with the userId passed")
-
- list_user = User.list(self.api_client,
- id=user.id
- )
-
- self.assertEqual(
- isinstance(list_user, list),
- True,
- "Check for list user response by uuid failed"
- )
-
-
- user_response = list_user[0]
-
-
- self.assertEqual( user_response.id,
- user.id,
- "list User response does not match with user Id "
- )
- self.assertEqual(
- user_response.firstname,
- self.services["user"]["firstname"],
- "listUser response does not match with user firstname"
- )
-
- user.delete(self.api_client)
-
- list_user = User.list(self.api_client,
- id=user.id
- )
-
- self.assertIsNone(
- list_user,
- "Deletion of user failed"
- )
-
-
- return
-
- @attr(tags=["basic", "advanced"])
- def test_createdomainWithUUID(self):
- """
- Test for creating Domain by passing id parameter
-
- # Validate the following
- # 1.Create a domain by passing id parameter.Verify the domain is created.
- # 2.List this domain by passing id parameter.Verify that list domain is able to list this domain.
- # 3.Delete domain should succeed.
-
- """
-
- domain = Domain.create(
- self.api_client,
- self.services["domain"]
- )
- self.assertIn ( self.services["domain"]["domainUUID"] , domain.id,
- "Domain is not created with the doaminId passed")
-
- list_domain = Domain.list(self.api_client,
- id=domain.id
- )
-
- self.assertEqual(
- isinstance(list_domain, list),
- True,
- "Check for list domain response by uuid failed"
- )
-
-
- domain_response = list_domain[0]
-
-
- self.assertEqual( domain_response.id,
- domain.id,
- "list domain response does not match with domain Id "
- )
- self.assertIn(
- self.services["domain"]["name"],
- domain_response.name,
- "list domaiin response does not match with user firstname"
- )
- try:
- domain.delete(self.api_client)
- except Exception as e:
- self.fail("Failed to delete domain: %s" % e)
+ def setUp(self):
+ pseudo_random_int = choice(xrange(1, 200))
+ self.services["region"]["regionid"] = pseudo_random_int
+ self.services["region"]["regionname"] = "region" + str(pseudo_random_int)
+ self.services["region"]["regionendpoint"] = "http://region" + str(pseudo_random_int) + ":8080/client"
- return
-
- @attr(tags=["basic", "advanced"])
- def test_createRegion(self):
- """
- Test for add Region
- """
-
- region = Region.create(self.api_client,
+ self.region = Region.create(self.api_client,
self.services["region"]
- )
+ )
+ self.cleanup = []
+ self.cleanup.append(self.region)
- list_region = Region.list(self.api_client,
+ list_region = Region.list(self.api_client,
id=self.services["region"]["regionid"]
- )
-
- self.assertEqual(
- isinstance(list_region, list),
- True,
- "Check for list Region response"
- )
- region_response = list_region[0]
-
- print (region_response)
- print (self.services["region"])
-
- self.assertEqual(
- str(region_response.id),
- self.services["region"]["regionid"],
- "listRegion response does not match with region Id created"
- )
+ )
self.assertEqual(
- region_response.name,
- self.services["region"]["regionname"],
- "listRegion response does not match with region name created"
- )
- self.assertEqual(
- region_response.endpoint,
- self.services["region"]["regionendpoint"],
- "listRegion response does not match with region endpoint created"
- )
-
- region = region.delete(self.api_client)
-
- return
-
- @attr(tags=["basic", "advanced"])
- def test_createDupRegion(self):
- """
- Test for duplicate checks on id and name parameters when adding regions
- """
-
- self.services["region"]["regionid"]="5"
- self.services["region"]["regionname"]="Region5"
- self.services["region"]["regionendpoint"]="http://region5:8080/client"
-
-
- region = Region.create(self.api_client,
- self.services["region"]
- )
+ isinstance(list_region, list),
+ True,
+ msg="Region creation failed"
+ )
- list_region = Region.list(self.api_client,
- id=self.services["region"]["regionid"]
- )
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createRegionWithExistingRegionId(self):
+ """Test for duplicate checks on region id
+ """
+ self.services["region"]["regionname"] = random_gen() #alter region name but not id
+ self.assertRaises(Exception, Region.create, self.api_client, self.services["region"])
- self.assertEqual(
- isinstance(list_region, list),
- True
- )
- """
- Creating regions with duplicate id should not be allowed
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createRegionWithExistingRegionName(self):
+ """Test for duplicate checks on region name
"""
+ random_int = choice(xrange(1, 200))
+ self.services["region"]["regionid"] = random_int #alter id but not name
+ self.services["region"]["regionendpoint"] = "http://region" + str(random_int) + ":8080/client"
+ self.assertRaises(Exception, Region.create, self.api_client, self.services["region"])
- self.services["region"]["regionid"]="5"
- self.services["region"]["regionname"]="Region51"
- self.services["region"]["regionendpoint"]="http://region51:8080/client"
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_updateRegion(self):
+ """ Test for update Region
+ """
+ self.services["region"]["regionname"] = "Region3" + random_gen()
+ self.services["region"]["regionendpoint"] = "http://region3updated:8080/client"
- try:
- region = Region.create(self.api_client,
- self.services["region"]
+ updated_region = self.region.update(self.api_client,
+ self.services["region"]
)
- self.assertIsNone(region,
- "Creating regions with duplicate id is allowed"
- )
- except:
- print " Creating Region with duplicate Id is not allowed"
- pass
- """
- Creating regions with duplicate name should not be allowed
- """
-
- self.services["region"]["regionid"]="51"
- self.services["region"]["regionname"]="Region5"
- self.services["region"]["regionendpoint"]="http://region51:8080/client"
-
- try:
- region = Region.create(self.api_client,
- self.services["region"]
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
)
- except:
- print " Creating Region with duplicate Name is not allowed"
- pass
-
- region.delete(self.api_client)
-
- return
-
- @attr(tags=["basic", "advanced"])
- def test_updateRegion(self):
- """
- Test for update Region
- """
-
- self.services["region"]["regionid"]="3"
- self.services["region"]["regionname"]="Region3"
- self.services["region"]["regionendpoint"]="http://region3:8080/client"
- region = Region.create(self.api_client,
- self.services["region"]
- )
-
- self.services["region"]["regionname"]="Region3upd"
- self.services["region"]["regionendpoint"]="http://region3upd:8080/client"
-
- updated_region = region.update(self.api_client,
- self.services["region"]
- )
-
- list_region = Region.list(self.api_client,
- id=self.services["region"]["regionid"]
- )
-
- self.assertEqual(
- isinstance(list_region, list),
- True,
- "Check for list Region response"
- )
- region_response = list_region[0]
-
- self.assertEqual(
- str(region_response.id),
- self.services["region"]["regionid"],
- "listRegion response does not match with region Id created"
- )
-
- self.assertEqual(
- region_response.name,
- self.services["region"]["regionname"],
- "listRegion response does not match with region name created"
- )
- self.assertEqual(
- region_response.endpoint,
- self.services["region"]["regionendpoint"],
- "listRegion response does not match with region endpoint created"
- )
-
- region.delete(self.api_client)
-
- return
-
- @attr(tags=["basic", "advanced"])
- def test_deleteRegion(self):
- """
- Test for delete Region
- """
-
- self.services["region"]["regionid"]="4"
- self.services["region"]["regionname"]="Region4"
- self.services["region"]["regionendpoint"]="http://region4:8080/client"
-
- region = Region.create(self.api_client,
- self.services["region"]
- )
-
- list_region = Region.list(self.api_client,
- id=self.services["region"]["regionid"]
- )
-
- print (list_region);
-
- self.assertEqual(
- len(list_region),
- 1,
- "Check for Region response"
- )
- region = region.delete(self.api_client)
-
- list_region = Region.list(self.api_client,
- id=self.services["region"]["regionid"]
- )
-
- print (list_region);
-
- self.assertIsNone(list_region,
- "Check for empty Region response"
- )
+ self.assertEqual(
+ isinstance(list_region, list),
+ True,
+ "Check for list Region response"
+ )
+ region_response = list_region[0]
- return
+ self.assertEqual(
+ region_response.id,
+ updated_region.id,
+ "listRegion response does not match with region Id created"
+ )
+ self.assertEqual(
+ region_response.name,
+ updated_region.name,
+ "listRegion response does not match with region name created"
+ )
+ self.assertEqual(
+ region_response.endpoint,
+ updated_region.endpoint,
+ "listRegion response does not match with region endpoint created"
+ )
- @classmethod
- def tearDown(cls):
+ def tearDown(self):
+ """ Test for delete region as cleanup
+ """
+ try:
+ #Clean up
+ cleanup_resources(self.api_client, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
- try:
- cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
- #Clean up
- cleanup_resources(cls.api_client, cls.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ @classmethod
+ def tearDownClass(cls):
+ """
+ Nothing to do
+ """
+ pass
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/548a8d8c/test/integration/component/test_regions_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_regions_accounts.py b/test/integration/component/test_regions_accounts.py
new file mode 100644
index 0000000..113f725
--- /dev/null
+++ b/test/integration/component/test_regions_accounts.py
@@ -0,0 +1,206 @@
+# 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 nose.plugins.attrib import attr
+
+class Services:
+ def __init__(self):
+ self.services = {
+ "domain": {
+ "name": "testuuid",
+ "domainUUID": "domain1"
+ },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Testuuid",
+ "lastname": "Useruuid",
+ "username": "test",
+ "password": "password",
+ "accountUUID": "account1",
+ "userUUID": "user1"
+ },
+ "user": {
+ "email": "test@test.com",
+ "firstname": "Testuuid",
+ "lastname": "Useruuid",
+ "username": "test",
+ "password": "password",
+ "userUUID": "user2"
+ },
+ }
+
+
+class TestRegionsAccounts(cloudstackTestCase):
+ """Test Accounts in Regions - CRUD tests for accounts in regions
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestRegionsAccounts, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.cleanup = []
+ return
+
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createAccountWithUUID(self):
+ """Test for creating account by passing id parameter
+
+ # Validate the following
+ # 1.Create an Account by passing id parameter.Verify the account is created.
+ # 2.List this account by passing id parameter.Verify that list account is able to lis this account.
+ # 3.Delete account should succeed.
+ """
+ account = Account.create(
+ self.api_client,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ self.assertIn(self.services["account"]["accountUUID"], account.id,
+ "Account is not created with the accountId passed")
+
+ list_account = Account.list(self.api_client,
+ id=account.id)
+
+ self.assertEqual(
+ isinstance(list_account, list),
+ True,
+ "Check for list account response by uuid failed"
+ )
+
+ account_response = list_account[0]
+ self.assertEqual(account_response.id,
+ account.id,
+ "listAccount response does not match with account Id "
+ )
+ self.assertEqual(
+ account_response.user[0].firstname,
+ self.services["account"]["firstname"],
+ "listAccount response does not match with account firstname"
+ )
+
+ self.cleanup.append(account)
+ return
+
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createUserWithUUID(self):
+ """Test for creating User by passing id parameter
+
+ # Validate the following
+ # 1.Create a User by passing id parameter.Verify the user is created.
+ # 2.List this user by passing id parameter.Verify that list user is able to list this user.
+ # 3.Delete User should succeed.
+ """
+
+ user = User.create(
+ self.api_client,
+ self.services["user"],
+ account="admin",
+ domainid=self.domain.id
+ )
+ self.assertIn(self.services["user"]["userUUID"], user.id,
+ "User is not created successfully with the userId passed")
+
+ list_user = User.list(self.api_client, id=user.id)
+
+ self.assertEqual(
+ isinstance(list_user, list),
+ True,
+ "Check for list user response by uuid failed"
+ )
+
+ user_response = list_user[0]
+
+ self.assertEqual(user_response.id,
+ user.id,
+ "list User response does not match with user Id "
+ )
+ self.assertEqual(
+ user_response.firstname,
+ self.services["user"]["firstname"],
+ "listUser response does not match with user firstname"
+ )
+
+ user.delete(self.api_client)
+
+ list_user = User.list(self.api_client,
+ id=user.id
+ )
+
+ self.assertIsNone(
+ list_user,
+ "Deletion of user failed"
+ )
+ return
+
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createdomainWithUUID(self):
+ """Test for creating Domain by passing id parameter
+
+ # Validate the following
+ # 1.Create a domain by passing id parameter.Verify the domain is created.
+ # 2.List this domain by passing id parameter.Verify that list domain is able to list this domain.
+ # 3.Delete domain should succeed.
+ """
+
+ domain = Domain.create(
+ self.api_client,
+ self.services["domain"]
+ )
+
+ self.assertIn(self.services["domain"]["domainUUID"], domain.id,
+ "Domain is not created with the doaminId passed")
+
+ list_domain = Domain.list(self.api_client,
+ id=domain.id
+ )
+
+ self.assertEqual(
+ isinstance(list_domain, list),
+ True,
+ "Check for list domain response by uuid failed"
+ )
+
+ domain_response = list_domain[0]
+
+ self.assertEqual(domain_response.id,
+ domain.id,
+ "list domain response does not match with domain Id "
+ )
+ self.assertIn(
+ self.services["domain"]["name"],
+ domain_response.name,
+ "list domaiin response does not match with user firstname"
+ )
+ try:
+ domain.delete(self.api_client)
+ except Exception as e:
+ self.fail("Failed to delete domain: %s" % e)
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ #Clean up
+ cleanup_resources(cls.api_client, cls.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/548a8d8c/test/integration/smoke/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_regions.py b/test/integration/smoke/test_regions.py
new file mode 100644
index 0000000..5d12e74
--- /dev/null
+++ b/test/integration/smoke/test_regions.py
@@ -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.
+
+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 nose.plugins.attrib import attr
+
+class Services:
+ def __init__(self):
+ self.services = {
+ "region": {
+ "regionid": "2",
+ "regionname": "Region2",
+ "regionendpoint": "http://region2:8080/client"
+ }
+ }
+
+
+class TestRegions(cloudstackTestCase):
+ """Test Regions - basic region creation
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.cleanup = []
+
+ @attr(tags=["simulator", "basic", "advanced"])
+ def test_createRegion(self):
+ """ Test for create region
+ """
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ self.assertEqual(
+ isinstance(list_region, list),
+ True,
+ "Check for list Region response"
+ )
+ region_response = list_region[0]
+
+ self.assertEqual(
+ str(region_response.id),
+ self.services["region"]["regionid"],
+ "listRegion response does not match with region Id created"
+ )
+
+ self.assertEqual(
+ region_response.name,
+ self.services["region"]["regionname"],
+ "listRegion response does not match with region name created"
+ )
+ self.assertEqual(
+ region_response.endpoint,
+ self.services["region"]["regionendpoint"],
+ "listRegion response does not match with region endpoint created"
+ )
+ self.cleanup.append(region)
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ #Clean up
+ cleanup_resources(cls.api_client, cls.cleanup)
+ list_region = Region.list(cls.api_client, id=cls.services["region"]["regionid"])
+ assert list_region is None, "Region deletion fails"
+ except Exception as e:
+ raise Exception("Warning: Region cleanup/delete fails with : %s" % e)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/548a8d8c/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 899c203..ecdc841 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -40,8 +40,8 @@ class Domain:
cmd = createDomain.createDomainCmd()
- if "domainUUID" in services:
- cmd.domainid = "-".join([services["domainUUID"],random_gen()])
+ if "domainUUID" in services:
+ cmd.domainid = "-".join([services["domainUUID"], random_gen()])
if name:
cmd.name = "-".join([name, random_gen()])
@@ -3151,9 +3151,9 @@ class Region:
cmd = updateRegion.updateRegionCmd()
cmd.id = self.id
if services["regionendpoint"]:
- cmd.endpoint = services["regionendpoint"]
+ cmd.endpoint = services["regionendpoint"]
if services["regionname"]:
- cmd.name = services["regionname"]
+ cmd.name = services["regionname"]
region = apiclient.updateRegion(cmd)
return region
[10/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Adding tracelogs to the API discovery service
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/26d637a0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/26d637a0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/26d637a0
Branch: refs/heads/vmware-datamodel
Commit: 26d637a0fb77e803b9f03cfcbc46076931a3c4b6
Parents: 9037d3b
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 13:50:56 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 13:52:12 2013 +0530
----------------------------------------------------------------------
.../discovery/ApiDiscoveryServiceImpl.java | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/26d637a0/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index 2d7dbd1..08fb573 100755
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -83,6 +83,9 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
}
String apiName = apiCmdAnnotation.name();
+ if (s_logger.isTraceEnabled()) {
+ s_logger.trace("Found api: " + apiName);
+ }
ApiDiscoveryResponse response = getCmdRequestMap(cmdClass, apiCmdAnnotation);
String responseName = apiCmdAnnotation.responseObject().getName();
[08/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Recent pom switcharoo caused the client to lose the dependecy on console-proxy, which it needs to include the systemvm
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/d6e0452a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d6e0452a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d6e0452a
Branch: refs/heads/vmware-datamodel
Commit: d6e0452af1785a259e52a760c1f5c372a52a7574
Parents: fd3c3b6
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue May 7 09:58:16 2013 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue May 7 09:58:16 2013 +0200
----------------------------------------------------------------------
client/pom.xml | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d6e0452a/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index a7c7009..147959b 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -239,6 +239,11 @@
<artifactId>cloud-plugin-host-anti-affinity</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-console-proxy</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
[11/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
dedicateGuestVlanRange is admin only API
Adding ACL for the dedicateGuestVlanRange API.
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/9037d3b3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9037d3b3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9037d3b3
Branch: refs/heads/vmware-datamodel
Commit: 9037d3b3d06eba017ab0aaba84b92e5b10dbc59f
Parents: d6e0452
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 13:50:12 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 13:52:12 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/commands.properties.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9037d3b3/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 6e3a5e4..22de93d 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -126,6 +126,7 @@ createVlanIpRange=1
deleteVlanIpRange=1
listVlanIpRanges=1
dedicatePublicIpRange=1
+dedicateGuestVlanRange=1
releasePublicIpRange=1
#### address commands
[12/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
commit e0d8f01ecd92a1a7b74558d02a28be3b2f20a10d enabled all tests, but the tests in vmware-base are horribly broken and will not compile with the current CloudStack.
Removing the tests to fix the nonoss build and they are so broken they should be rewritten from scratch anyway.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8b965c56
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8b965c56
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8b965c56
Branch: refs/heads/vmware-datamodel
Commit: 8b965c56859c32983da4d2414f5c4d34de34769d
Parents: 64522b6
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Tue May 7 10:57:23 2013 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Tue May 7 10:59:44 2013 +0200
----------------------------------------------------------------------
vmware-base/pom.xml | 4 -
.../vmware/mo/TestVmwareContextFactory.java | 43 -
.../cloud/hypervisor/vmware/mo/TestVmwareMO.java | 39 -
.../hypervisor/vmware/util/TestVmwareUtil.java | 107 --
vmware-base/test/com/cloud/vmware/TestVMWare.java | 1342 ---------------
5 files changed, 0 insertions(+), 1535 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b965c56/vmware-base/pom.xml
----------------------------------------------------------------------
diff --git a/vmware-base/pom.xml b/vmware-base/pom.xml
index 8fa811f..da4fb21 100644
--- a/vmware-base/pom.xml
+++ b/vmware-base/pom.xml
@@ -59,8 +59,4 @@
<version>1.4</version>
</dependency>
</dependencies>
- <build>
- <defaultGoal>install</defaultGoal>
- <sourceDirectory>src</sourceDirectory>
- </build>
</project>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b965c56/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
----------------------------------------------------------------------
diff --git a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java b/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
deleted file mode 100644
index 81a62d2..0000000
--- a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareContextFactory.java
+++ /dev/null
@@ -1,43 +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.hypervisor.vmware.mo;
-
-import com.cloud.hypervisor.vmware.util.VmwareClient;
-import com.cloud.hypervisor.vmware.util.VmwareContext;
-
-
-public class TestVmwareContextFactory {
- private static volatile int s_seq = 1;
-
- static {
- // skip certificate check
- System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
- }
-
- public static VmwareContext create(String vCenterAddress, String vCenterUserName, String vCenterPassword) throws Exception {
- assert(vCenterAddress != null);
- assert(vCenterUserName != null);
- assert(vCenterPassword != null);
-
- String serviceUrl = "https://" + vCenterAddress + "/sdk/vimService";
- VmwareClient vimClient = new VmwareClient(vCenterAddress + "-" + s_seq++);
- vimClient.connect(serviceUrl, vCenterUserName, vCenterPassword);
-
- VmwareContext context = new VmwareContext(vimClient, vCenterAddress);
- return context;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b965c56/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareMO.java b/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareMO.java
deleted file mode 100644
index c9807f4..0000000
--- a/vmware-base/test/com/cloud/hypervisor/vmware/mo/TestVmwareMO.java
+++ /dev/null
@@ -1,39 +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.hypervisor.vmware.mo;
-
-import java.util.GregorianCalendar;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.hypervisor.vmware.mo.SnapshotDescriptor.SnapshotInfo;
-import com.cloud.hypervisor.vmware.util.VmwareContext;
-import com.cloud.utils.Pair;
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
-import com.google.gson.Gson;
-import com.vmware.vim25.DynamicProperty;
-import com.vmware.vim25.ManagedObjectReference;
-import com.vmware.vim25.ObjectContent;
-import com.vmware.vim25.VirtualMachineConfigSpec;
-
-public class TestVmwareMO extends Log4jEnabledTestCase {
- private static final Logger s_logger = Logger.getLogger(TestVmwareMO.class);
-
- public void test() {
- }
-}
-
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b965c56/vmware-base/test/com/cloud/hypervisor/vmware/util/TestVmwareUtil.java
----------------------------------------------------------------------
diff --git a/vmware-base/test/com/cloud/hypervisor/vmware/util/TestVmwareUtil.java b/vmware-base/test/com/cloud/hypervisor/vmware/util/TestVmwareUtil.java
deleted file mode 100755
index d1dd11b..0000000
--- a/vmware-base/test/com/cloud/hypervisor/vmware/util/TestVmwareUtil.java
+++ /dev/null
@@ -1,107 +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.hypervisor.vmware.util;
-import java.io.File;
-
-import junit.framework.Assert;
-
-import org.apache.log4j.Logger;
-
-import com.cloud.hypervisor.vmware.resource.SshHelper;
-import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
-import com.cloud.utils.Pair;
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
-import com.vmware.vim25.ManagedObjectReference;
-
-public class TestVmwareUtil extends Log4jEnabledTestCase {
- private static final Logger s_logger = Logger.getLogger(TestVmwareUtil.class);
-
- public void testContextCreation() {
- try {
- VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
- Assert.assertTrue(true);
- context.close();
- } catch(Exception e) {
- s_logger.error("Unexpected exception : ", e);
- }
- }
-
- public void testSearchIndex() {
- try {
- VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
- Assert.assertTrue(true);
-
- ManagedObjectReference morHost = context.getService().findByDnsName(context.getServiceContent().getSearchIndex(),
- null, "esxhost-1.lab.vmops.com", false);
- Assert.assertTrue(morHost.getType().equalsIgnoreCase("HostSystem"));
-
- morHost = context.getService().findByIp(context.getServiceContent().getSearchIndex(),
- null, "192.168.1.168", false);
- Assert.assertTrue(morHost == null);
- context.close();
- } catch(Exception e) {
- s_logger.error("Unexpected exception : ", e);
- }
- }
-
- public void testVmxFileDownload() {
- try {
- VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
- byte[] vmxContent = context.getResourceContent("https://vsphere-1.lab.vmops.com/folder/ServerRoom-Fedora32/ServerRoom-Fedora32.vmx?dcPath=cupertino&dsName=NFS%20datastore");
- System.out.print(new String(vmxContent));
- context.close();
- } catch(Exception e) {
- s_logger.error("Unexpected exception : ", e);
- }
- }
-
- public void testVmxFileParser() {
- String[] tokens = "[NFS datastore] Fedora-clone-test/Fedora-clone-test.vmx".split("\\[|\\]|/");
-
- for(String str : tokens) {
- System.out.println("Token " + str);
- }
- }
-
- public void testSsh() {
- try {
- File file = new File("c:\\temp\\id_rsa.kelven");
- if(!file.exists()) {
- System.out.println("key file does not exist!");
- }
-
- Pair<Boolean, String> result = SshHelper.sshExecute("192.168.1.107", 22, "kelven", file, null, "ls -al");
- System.out.println("Result: " + result.second());
- } catch(Exception e) {
- s_logger.error("Unexpected exception : ", e);
- }
- }
-
- public void testScp() {
- try {
- File file = new File("c:\\temp\\id_rsa.kelven");
- if(!file.exists()) {
- System.out.println("key file does not exist!");
- }
-
- SshHelper.scpTo("192.168.1.107", 22, "kelven", file, null, "~", "Hello, world".getBytes(),
- "hello.txt", null);
- } catch(Exception e) {
- s_logger.error("Unexpected exception : ", e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8b965c56/vmware-base/test/com/cloud/vmware/TestVMWare.java
----------------------------------------------------------------------
diff --git a/vmware-base/test/com/cloud/vmware/TestVMWare.java b/vmware-base/test/com/cloud/vmware/TestVMWare.java
deleted file mode 100644
index f2d08e1..0000000
--- a/vmware-base/test/com/cloud/vmware/TestVMWare.java
+++ /dev/null
@@ -1,1342 +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.vmware;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-
-import org.apache.log4j.xml.DOMConfigurator;
-
-import com.cloud.hypervisor.vmware.mo.DatacenterMO;
-import com.cloud.hypervisor.vmware.mo.DistributedVirtualSwitchMO;
-import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper;
-import com.cloud.hypervisor.vmware.util.VmwareContext;
-import com.cloud.utils.PropertiesUtil;
-import com.vmware.vim25.HostIpConfig;
-import com.vmware.vim25.HostVirtualNicSpec;
-import com.vmware.vim25.ArrayOfManagedObjectReference;
-import com.vmware.vim25.DVPortgroupConfigInfo;
-import com.vmware.vim25.DVPortgroupConfigSpec;
-import com.vmware.vim25.DVSSecurityPolicy;
-import com.vmware.vim25.DVSTrafficShapingPolicy;
-import com.vmware.vim25.DatastoreInfo;
-import com.vmware.vim25.DynamicProperty;
-import com.vmware.vim25.HostConfigManager;
-import com.vmware.vim25.HostIpConfig;
-import com.vmware.vim25.HostPortGroupSpec;
-import com.vmware.vim25.HostVirtualNicSpec;
-import com.vmware.vim25.HttpNfcLeaseDeviceUrl;
-import com.vmware.vim25.HttpNfcLeaseInfo;
-import com.vmware.vim25.HttpNfcLeaseState;
-import com.vmware.vim25.InvalidProperty;
-import com.vmware.vim25.ManagedObjectReference;
-import com.vmware.vim25.ObjectContent;
-import com.vmware.vim25.ObjectSpec;
-import com.vmware.vim25.OvfCreateImportSpecParams;
-import com.vmware.vim25.OvfCreateImportSpecResult;
-import com.vmware.vim25.OvfFileItem;
-import com.vmware.vim25.PropertyFilterSpec;
-import com.vmware.vim25.PropertySpec;
-import com.vmware.vim25.RuntimeFault;
-import com.vmware.vim25.SelectionSpec;
-import com.vmware.vim25.TraversalSpec;
-import com.vmware.vim25.VMwareDVSPortSetting;
-import com.vmware.vim25.VirtualDeviceConfigSpec;
-import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
-import com.vmware.vim25.VirtualEthernetCard;
-import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
-import com.vmware.vim25.VirtualMachineCloneSpec;
-import com.vmware.vim25.VirtualMachineConfigSpec;
-import com.vmware.vim25.VirtualMachineRelocateSpec;
-import com.vmware.vim25.VirtualNicManagerNetConfig;
-import com.vmware.vim25.VirtualPCNet32;
-import com.vmware.vim25.VmwareDistributedVirtualSwitchVlanSpec;
-
-public class TestVMWare {
- private static ExtendedAppUtil cb;
- private static String[] _args;
-
- private static final int IND_DATACENTER_MOR = 3;
- private static final int IND_DVSWITCH_MOR = 4;
- private static final int IND_DVSWITCH_NAME = 5;
- private static final int IND_DVPORTGROUP_NAME = 6;
- private static final int IND_DVPORTGROUP_VLAN = 7;
- private static final int IND_DVPORTGROUP_PORTCOUNT = 8;
- private static final int MAX_ARGS = 9;
- static {
- try {
- javax.net.ssl.TrustManager[] trustAllCerts = new javax.net.ssl.TrustManager[1];
- javax.net.ssl.TrustManager tm = new TrustAllManager();
- trustAllCerts[0] = tm;
- javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL");
- sc.init(null, trustAllCerts, null);
- javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
- } catch (Exception e) {
- }
- }
-
- private static void setupLog4j() {
- File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
-
- if(file != null) {
- System.out.println("Log4j configuration from : " + file.getAbsolutePath());
- DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000);
- } else {
- System.out.println("Configure log4j with default properties");
- }
- }
-
- private void getAndPrintInventoryContents() throws Exception {
- TraversalSpec resourcePoolTraversalSpec = new TraversalSpec();
- resourcePoolTraversalSpec.setName("resourcePoolTraversalSpec");
- resourcePoolTraversalSpec.setType("ResourcePool");
- resourcePoolTraversalSpec.setPath("resourcePool");
- resourcePoolTraversalSpec.setSkip(new Boolean(false));
- resourcePoolTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") });
-
- TraversalSpec computeResourceRpTraversalSpec = new TraversalSpec();
- computeResourceRpTraversalSpec.setName("computeResourceRpTraversalSpec");
- computeResourceRpTraversalSpec.setType("ComputeResource");
- computeResourceRpTraversalSpec.setPath("resourcePool");
- computeResourceRpTraversalSpec.setSkip(new Boolean(false));
- computeResourceRpTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null,null,"resourcePoolTraversalSpec") });
-
- TraversalSpec computeResourceHostTraversalSpec = new TraversalSpec();
- computeResourceHostTraversalSpec.setName("computeResourceHostTraversalSpec");
- computeResourceHostTraversalSpec.setType("ComputeResource");
- computeResourceHostTraversalSpec.setPath("host");
- computeResourceHostTraversalSpec.setSkip(new Boolean(false));
-
- TraversalSpec datacenterHostTraversalSpec = new TraversalSpec();
- datacenterHostTraversalSpec.setName("datacenterHostTraversalSpec");
- datacenterHostTraversalSpec.setType("Datacenter");
- datacenterHostTraversalSpec.setPath("hostFolder");
- datacenterHostTraversalSpec.setSkip(new Boolean(false));
- datacenterHostTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") });
-
- TraversalSpec datacenterVmTraversalSpec = new TraversalSpec();
- datacenterVmTraversalSpec.setName("datacenterVmTraversalSpec");
- datacenterVmTraversalSpec.setType("Datacenter");
- datacenterVmTraversalSpec.setPath("vmFolder");
- datacenterVmTraversalSpec.setSkip(new Boolean(false));
- datacenterVmTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec") });
-
- TraversalSpec folderTraversalSpec = new TraversalSpec();
- folderTraversalSpec.setName("folderTraversalSpec");
- folderTraversalSpec.setType("Folder");
- folderTraversalSpec.setPath("childEntity");
- folderTraversalSpec.setSkip(new Boolean(false));
- folderTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null,null,"folderTraversalSpec"),
- datacenterHostTraversalSpec,
- datacenterVmTraversalSpec,
- computeResourceRpTraversalSpec,
- computeResourceHostTraversalSpec,
- resourcePoolTraversalSpec });
-
- PropertySpec[] propspecary = new PropertySpec[] { new PropertySpec() };
- propspecary[0].setAll(new Boolean(false));
- propspecary[0].setPathSet(new String[] { "name" });
- propspecary[0].setType("ManagedEntity");
-
- PropertyFilterSpec spec = new PropertyFilterSpec();
- spec.setPropSet(propspecary);
- spec.setObjectSet(new ObjectSpec[] { new ObjectSpec() });
- spec.getObjectSet(0).setObj(cb.getServiceConnection3().getRootFolder());
- spec.getObjectSet(0).setSkip(new Boolean(false));
- spec.getObjectSet(0).setSelectSet(
- new SelectionSpec[] { folderTraversalSpec });
-
- // Recursively get all ManagedEntity ManagedObjectReferences
- // and the "name" property for all ManagedEntities retrieved
- ObjectContent[] ocary =
- cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { spec }
- );
-
- // If we get contents back. print them out.
- if (ocary != null) {
- ObjectContent oc = null;
- ManagedObjectReference mor = null;
- DynamicProperty[] pcary = null;
- DynamicProperty pc = null;
- for (int oci = 0; oci < ocary.length; oci++) {
- oc = ocary[oci];
- mor = oc.getObj();
- pcary = oc.getPropSet();
-
- System.out.println("Object Type : " + mor.getType());
- System.out.println("Reference Value : " + mor.get_value());
-
- if (pcary != null) {
- for (int pci = 0; pci < pcary.length; pci++) {
- pc = pcary[pci];
- System.out.println(" Property Name : " + pc.getName());
- if (pc != null) {
- if (!pc.getVal().getClass().isArray()) {
- System.out.println(" Property Value : " + pc.getVal());
- }
- else {
- Object[] ipcary = (Object[])pc.getVal();
- System.out.println("Val : " + pc.getVal());
- for (int ii = 0; ii < ipcary.length; ii++) {
- Object oval = ipcary[ii];
- if (oval.getClass().getName().indexOf("ManagedObjectReference") >= 0) {
- ManagedObjectReference imor = (ManagedObjectReference)oval;
-
- System.out.println("Inner Object Type : " + imor.getType());
- System.out.println("Inner Reference Value : " + imor.get_value());
- }
- else {
- System.out.println("Inner Property Value : " + oval);
- }
- }
- }
- }
- }
- }
- }
- } else {
- System.out.println("No Managed Entities retrieved!");
- }
- }
-
- private void listDataCenters() {
- try {
- ManagedObjectReference[] morDatacenters = getDataCenterMors();
- if(morDatacenters != null) {
- for(ManagedObjectReference mor : morDatacenters) {
- System.out.println("Datacenter : " + mor.get_value());
-
- Map<String, Object> properites = new HashMap<String, Object>();
- properites.put("name", null);
- properites.put("vmFolder", null);
- properites.put("hostFolder", null);
-
- getProperites(mor, properites);
- for(Map.Entry<String, Object> entry : properites.entrySet()) {
- if(entry.getValue() instanceof ManagedObjectReference) {
- ManagedObjectReference morProp = (ManagedObjectReference)entry.getValue();
- System.out.println("\t" + entry.getKey() + ":(" + morProp.getType() + ", " + morProp.get_value() + ")");
- } else {
- System.out.println("\t" + entry.getKey() + ":" + entry.getValue());
- }
- }
-
- System.out.println("Datacenter clusters");
- ManagedObjectReference[] clusters = getDataCenterClusterMors(mor);
- if(clusters != null) {
- for(ManagedObjectReference morCluster : clusters) {
- Object[] props = this.getProperties(morCluster, new String[] {"name"});
- System.out.println("cluster : " + props[0]);
-
- System.out.println("cluster hosts");
- ManagedObjectReference[] hosts = getClusterHostMors(morCluster);
- if(hosts != null) {
- for(ManagedObjectReference morHost : hosts) {
- Object[] props2 = this.getProperties(morHost, new String[] {"name"});
- System.out.println("host : " + props2[0]);
- }
- }
- }
- }
-
- System.out.println("Datacenter standalone hosts");
- ManagedObjectReference[] hosts = getDataCenterStandaloneHostMors(mor);
- if(hosts != null) {
- for(ManagedObjectReference morHost : hosts) {
- Object[] props = this.getProperties(morHost, new String[] {"name"});
- System.out.println("host : " + props[0]);
- }
- }
-
- System.out.println("Datacenter datastores");
- ManagedObjectReference[] stores = getDataCenterDatastoreMors(mor);
- if(stores != null) {
- for(ManagedObjectReference morStore : stores) {
- // data store name property does not work for some reason
- Object[] props = getProperties(morStore, new String[] {"info" });
-
- System.out.println(morStore.getType() + ": " + ((DatastoreInfo)props[0]).getName());
- }
- }
-
- System.out.println("Datacenter VMs");
- ManagedObjectReference[] vms = getDataCenterVMMors(mor);
- if(stores != null) {
- for(ManagedObjectReference morVm : vms) {
- Object[] props = this.getProperties(morVm, new String[] {"name"});
- System.out.println("VM name: " + props[0] + ", ref val: " + morVm.get_value());
- }
- }
- }
- }
- } catch(RuntimeFault e) {
- e.printStackTrace();
- } catch(RemoteException e) {
- e.printStackTrace();
- }
- }
-
- private void listInventoryFolders() {
- TraversalSpec folderTraversalSpec = new TraversalSpec();
- folderTraversalSpec.setName("folderTraversalSpec");
- folderTraversalSpec.setType("Folder");
- folderTraversalSpec.setPath("childEntity");
- folderTraversalSpec.setSkip(new Boolean(false));
- folderTraversalSpec.setSelectSet(
- new SelectionSpec [] { new SelectionSpec(null, null, "folderTraversalSpec")}
- );
-
- PropertySpec[] propSpecs = new PropertySpec[] { new PropertySpec() };
- propSpecs[0].setAll(new Boolean(false));
- propSpecs[0].setPathSet(new String[] { "name" });
- propSpecs[0].setType("ManagedEntity");
-
- PropertyFilterSpec filterSpec = new PropertyFilterSpec();
- filterSpec.setPropSet(propSpecs);
- filterSpec.setObjectSet(new ObjectSpec[] { new ObjectSpec() });
- filterSpec.getObjectSet(0).setObj(cb.getServiceConnection3().getRootFolder());
- filterSpec.getObjectSet(0).setSkip(new Boolean(false));
- filterSpec.getObjectSet(0).setSelectSet(
- new SelectionSpec[] { folderTraversalSpec }
- );
-
- try {
- ObjectContent[] objContent = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { filterSpec }
- );
- printContent(objContent);
- } catch (InvalidProperty e) {
- e.printStackTrace();
- } catch (RuntimeFault e) {
- e.printStackTrace();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
-
- private TraversalSpec getFolderRecursiveTraversalSpec() {
- SelectionSpec recurseFolders = new SelectionSpec();
- recurseFolders.setName("folder2childEntity");
-
- TraversalSpec folder2childEntity = new TraversalSpec();
- folder2childEntity.setType("Folder");
- folder2childEntity.setPath("childEntity");
- folder2childEntity.setName(recurseFolders.getName());
- folder2childEntity.setSelectSet(new SelectionSpec[] { recurseFolders });
-
- return folder2childEntity;
- }
-
- private ManagedObjectReference[] getDataCenterMors() throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("Datacenter");
- pSpec.setPathSet(new String[] { "name"} );
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(cb.getServiceConnection3().getRootFolder());
- oSpec.setSkip(Boolean.TRUE);
- oSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
-
- if(ocs != null) {
- ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
- for(int i = 0; i < ocs.length; i++)
- morDatacenters[i] = ocs[i].getObj();
-
- return morDatacenters;
- }
- return null;
- }
-
- private ManagedObjectReference[] getDataCenterVMMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("VirtualMachine");
- pSpec.setPathSet(new String[] { "name"} );
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(morDatacenter);
- oSpec.setSkip(Boolean.TRUE);
-
- TraversalSpec tSpec = new TraversalSpec();
- tSpec.setName("dc2VMFolder");
- tSpec.setType("Datacenter");
- tSpec.setPath("vmFolder");
- tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() } );
-
- oSpec.setSelectSet(new SelectionSpec[] { tSpec });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
-
- if(ocs != null) {
- ManagedObjectReference[] morVMs = new ManagedObjectReference[ocs.length];
- for(int i = 0; i < ocs.length; i++)
- morVMs[i] = ocs[i].getObj();
-
- return morVMs;
- }
- return null;
- }
-
- private ManagedObjectReference[] getDataCenterDatastoreMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
- Object[] stores = getProperties(morDatacenter, new String[] { "datastore" });
- if(stores != null && stores.length == 1) {
- return ((ArrayOfManagedObjectReference)stores[0]).getManagedObjectReference();
- }
- return null;
- }
-
- private ManagedObjectReference[] getDataCenterClusterMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("ClusterComputeResource");
- pSpec.setPathSet(new String[] { "name"} );
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(morDatacenter);
- oSpec.setSkip(Boolean.TRUE);
-
- TraversalSpec tSpec = new TraversalSpec();
- tSpec.setName("traversalHostFolder");
- tSpec.setType("Datacenter");
- tSpec.setPath("hostFolder");
- tSpec.setSkip(false);
- tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
-
- oSpec.setSelectSet(new TraversalSpec[] { tSpec });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
-
- if(ocs != null) {
- ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
- for(int i = 0; i < ocs.length; i++)
- morDatacenters[i] = ocs[i].getObj();
-
- return morDatacenters;
- }
- return null;
- }
-
- private ManagedObjectReference[] getDataCenterStandaloneHostMors(ManagedObjectReference morDatacenter) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("ComputeResource");
- pSpec.setPathSet(new String[] { "name"} );
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(morDatacenter);
- oSpec.setSkip(Boolean.TRUE);
-
- TraversalSpec tSpec = new TraversalSpec();
- tSpec.setName("traversalHostFolder");
- tSpec.setType("Datacenter");
- tSpec.setPath("hostFolder");
- tSpec.setSkip(false);
- tSpec.setSelectSet(new SelectionSpec[] { getFolderRecursiveTraversalSpec() });
-
- oSpec.setSelectSet(new TraversalSpec[] { tSpec });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
-
- if(ocs != null) {
- List<ManagedObjectReference> listComputeResources = new ArrayList<ManagedObjectReference>();
- for(ObjectContent oc : ocs) {
- if(oc.getObj().getType().equalsIgnoreCase("ComputeResource"))
- listComputeResources.add(oc.getObj());
- }
-
- List<ManagedObjectReference> listHosts = new ArrayList<ManagedObjectReference>();
- for(ManagedObjectReference morComputeResource : listComputeResources) {
- ManagedObjectReference[] hosts = getComputeResourceHostMors(morComputeResource);
- if(hosts != null) {
- for(ManagedObjectReference host: hosts)
- listHosts.add(host);
- }
- }
-
- return listHosts.toArray(new ManagedObjectReference[0]);
- }
- return null;
- }
-
- private ManagedObjectReference[] getComputeResourceHostMors(ManagedObjectReference morCompute) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("HostSystem");
- pSpec.setPathSet(new String[] { "name"} );
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(morCompute);
- oSpec.setSkip(true);
-
- TraversalSpec tSpec = new TraversalSpec();
- tSpec.setName("computeResource2Host");
- tSpec.setType("ComputeResource");
- tSpec.setPath("host");
- tSpec.setSkip(false);
- oSpec.setSelectSet(new TraversalSpec[] { tSpec });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
-
- if(ocs != null) {
- ManagedObjectReference[] morDatacenters = new ManagedObjectReference[ocs.length];
- for(int i = 0; i < ocs.length; i++)
- morDatacenters[i] = ocs[i].getObj();
-
- return morDatacenters;
- }
- return null;
- }
-
- private ManagedObjectReference[] getClusterHostMors(ManagedObjectReference morCluster) throws RuntimeFault, RemoteException {
- // ClusterComputeResource inherits from ComputeResource
- return getComputeResourceHostMors(morCluster);
- }
-
- private ObjectContent[] getDataCenterProperites(String[] properites) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("Datacenter");
- pSpec.setPathSet(properites );
-
- SelectionSpec recurseFolders = new SelectionSpec();
- recurseFolders.setName("folder2childEntity");
-
- TraversalSpec folder2childEntity = new TraversalSpec();
- folder2childEntity.setType("Folder");
- folder2childEntity.setPath("childEntity");
- folder2childEntity.setName(recurseFolders.getName());
- folder2childEntity.setSelectSet(new SelectionSpec[] { recurseFolders });
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(cb.getServiceConnection3().getRootFolder());
- oSpec.setSkip(Boolean.TRUE);
- oSpec.setSelectSet(new SelectionSpec[] { folder2childEntity });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- return cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
- }
-
- private void printContent(ObjectContent[] objContent) {
- if(objContent != null) {
- for(ObjectContent oc : objContent) {
- ManagedObjectReference mor = oc.getObj();
- DynamicProperty[] objProps = oc.getPropSet();
-
- System.out.println("Object type: " + mor.getType());
- if(objProps != null) {
- for(DynamicProperty objProp : objProps) {
- if(!objProp.getClass().isArray()) {
- System.out.println("\t" + objProp.getName() + "=" + objProp.getVal());
- } else {
- Object[] ipcary = (Object[])objProp.getVal();
- System.out.print("\t" + objProp.getName() + "=[");
- int i = 0;
- for(Object item : ipcary) {
- if (item.getClass().getName().indexOf("ManagedObjectReference") >= 0) {
- ManagedObjectReference imor = (ManagedObjectReference)item;
- System.out.print("(" + imor.getType() + "," + imor.get_value() + ")");
- } else {
- System.out.print(item);
- }
-
- if(i < ipcary.length - 1)
- System.out.print(", ");
- i++;
- }
-
- System.out.println("]");
- }
- }
- }
- }
- }
- }
-
- private void getProperites(ManagedObjectReference mor, Map<String, Object> properties) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType(mor.getType());
- pSpec.setPathSet(properties.keySet().toArray(new String[0]));
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(mor);
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] {pSpec} );
- pfSpec.setObjectSet(new ObjectSpec[] {oSpec} );
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] {pfSpec} );
-
- if(ocs != null) {
- for(ObjectContent oc : ocs) {
- DynamicProperty[] propSet = oc.getPropSet();
- if(propSet != null) {
- for(DynamicProperty prop : propSet) {
- properties.put(prop.getName(), prop.getVal());
- }
- }
- }
- }
- }
-
- private Object[] getProperties(ManagedObjectReference moRef, String[] properties) throws RuntimeFault, RemoteException {
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType(moRef.getType());
- pSpec.setPathSet(properties);
-
- ObjectSpec oSpec = new ObjectSpec();
- // Set the starting object
- oSpec.setObj(moRef);
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] {pSpec} );
- pfSpec.setObjectSet(new ObjectSpec[] {oSpec} );
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] {pfSpec} );
-
- Object[] ret = new Object[properties.length];
- if(ocs != null) {
- for(int i = 0; i< ocs.length; ++i) {
- ObjectContent oc = ocs[i];
- DynamicProperty[] dps = oc.getPropSet();
- if(dps != null) {
- for(int j = 0; j < dps.length; ++j) {
- DynamicProperty dp = dps[j];
- for(int p = 0; p < ret.length; ++p) {
- if(properties[p].equals(dp.getName())) {
- ret[p] = dp.getVal();
- }
- }
- }
- }
- }
- }
- return ret;
- }
-
- private void powerOnVm() throws Exception {
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-480");
-
- cb.getServiceConnection3().getService().powerOnVM_Task(morVm, null);
- }
-
- private void powerOffVm() throws Exception {
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-66");
-
- cb.getServiceConnection3().getService().powerOffVM_Task(morVm);
- }
-
- private void createSnapshot() throws Exception {
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-66");
- cb.getServiceConnection3().getService().createSnapshot_Task(morVm, "RunningSnapshotProg", "", false, false);
- }
-
- private void registerTemplate() throws Exception {
- ManagedObjectReference morFolder = new ManagedObjectReference();
- morFolder.setType("Folder");
- morFolder.set_value("group-v3");
-
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-48");
-
- System.out.println("Begin registerVM_Task");
- ManagedObjectReference taskmor = cb.getServiceConnection3().getService().registerVM_Task(
- morFolder, "[NFS datastore] Template-Fedora/Template-Fedora.vmtx", "Template-Fedora", true,
- null, morHost);
- System.out.println("End registerVM_Task");
-
- String result = cb.getServiceUtil3().waitForTask(taskmor);
- if (result.equalsIgnoreCase("Sucess")) {
- System.out.println("Registering The Virtual Machine ..........Done");
- } else {
- System.out.println("Some Exception While Registering The VM");
- }
- }
-
- private void createVmFromTemplate() throws Exception {
- VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
-
- ManagedObjectReference morDatastore = new ManagedObjectReference();
- morDatastore.setType("Datastore");
- morDatastore.set_value("datastore-30");
-
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-48");
-
- ManagedObjectReference morPool = new ManagedObjectReference();
- morPool.setType("ResourcePool");
- morPool.set_value("resgroup-41");
-
- VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
- cloneSpec.setLocation(relocSpec);
- cloneSpec.setPowerOn(false);
- cloneSpec.setTemplate(false);
-
- relocSpec.setDatastore(morDatastore);
- relocSpec.setHost(morHost);
- relocSpec.setPool(morPool);
-
- ManagedObjectReference morTemplate = new ManagedObjectReference();
- morTemplate.setType("VirtualMachine");
- morTemplate.set_value("vm-76");
-
- ManagedObjectReference morFolder = new ManagedObjectReference();
- morFolder.setType("Folder");
- morFolder.set_value("group-v3");
-
- ManagedObjectReference cloneTask
- = cb.getServiceConnection3().getService().cloneVM_Task(morTemplate, morFolder,
- "Fedora-clone-test", cloneSpec);
-
- String status = cb.getServiceUtil3().waitForTask(cloneTask);
- if(status.equalsIgnoreCase("failure")) {
- System.out.println("Failure -: Virtual Machine cannot be cloned");
- }
-
- if(status.equalsIgnoreCase("sucess")) {
- System.out.println("Virtual Machine Cloned successfully.");
- }
- }
-
- private void addNic() throws Exception {
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-77");
-
- ManagedObjectReference morNetwork = new ManagedObjectReference();
- morNetwork.setType("DistributedVirtualPortgroup");
- morNetwork.set_value("dvportgroup-56");
-
- VirtualDeviceConfigSpec nicSpec = new VirtualDeviceConfigSpec();
- nicSpec.setOperation(VirtualDeviceConfigSpecOperation.add);
- VirtualEthernetCard nic = new VirtualPCNet32();
- VirtualEthernetCardNetworkBackingInfo nicBacking
- = new VirtualEthernetCardNetworkBackingInfo();
- nicBacking.setDeviceName("Adapter to dSwitch-vlan26");
- nicBacking.setNetwork(morNetwork);
-
- nic.setAddressType("generated");
- nic.setBacking(nicBacking);
- nic.setKey(4);
- nicSpec.setDevice(nic);
-
- VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
- VirtualDeviceConfigSpec [] nicSpecArray = {nicSpec};
- vmConfigSpec.setDeviceChange(nicSpecArray);
-
- ManagedObjectReference tmor
- = cb.getServiceConnection3().getService().reconfigVM_Task(
- morVm, vmConfigSpec);
-
- String status = cb.getServiceUtil3().waitForTask(tmor);
- if(status.equalsIgnoreCase("failure")) {
- System.out.println("Failure -: Virtual Machine cannot be cloned");
- }
-
- if(status.equalsIgnoreCase("sucess")) {
- System.out.println("Virtual Machine Cloned successfully.");
- }
- }
-
- // add virtual NIC to vmkernel
- private void addNicToNetwork() throws Exception {
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-48");
-
- HostPortGroupSpec portgrp = new HostPortGroupSpec();
- portgrp.setName("VM Network vlan26");
-
- Object cmobj = cb.getServiceUtil3().getDynamicProperty(morHost, "configManager");
- HostConfigManager configMgr = (HostConfigManager)cmobj;
- ManagedObjectReference nwSystem = configMgr.getNetworkSystem();
-
- HostVirtualNicSpec vNicSpec = new HostVirtualNicSpec();
- HostIpConfig ipConfig = new HostIpConfig();
- ipConfig.setDhcp(false);
- ipConfig.setIpAddress("192.168.26.177");
- ipConfig.setSubnetMask("255.255.255.0");
-
- vNicSpec.setIp(ipConfig);
- vNicSpec.setPortgroup("VM Network vlan26");
-
- cb.getServiceConnection3().getService().addVirtualNic(nwSystem,
- "dvPortGroup-vlan26", vNicSpec);
- }
-
- private void createDatacenter() throws Exception {
- cb.getServiceConnection3().getService().createDatacenter(
- cb.getServiceConnection3().getRootFolder(),
- "cloud.dc.test");
- }
-
- private void getPropertyWithPath() throws Exception {
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-161");
-
- VirtualNicManagerNetConfig[] netConfigs = (VirtualNicManagerNetConfig[])cb.getServiceUtil3().getDynamicProperty(morHost, "config.virtualNicManagerInfo.netConfig");
- }
-
- private void getHostVMs() throws Exception {
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-48");
-
- PropertySpec pSpec = new PropertySpec();
- pSpec.setType("VirtualMachine");
- pSpec.setPathSet(new String[] { "name", "runtime.powerState", "config.template" });
-
- TraversalSpec host2VmTraversal = new TraversalSpec();
- host2VmTraversal.setType("HostSystem");
- host2VmTraversal.setPath("vm");
- host2VmTraversal.setName("host2VmTraversal");
-
- ObjectSpec oSpec = new ObjectSpec();
- oSpec.setObj(morHost);
- oSpec.setSkip(Boolean.TRUE);
- oSpec.setSelectSet(new SelectionSpec[] { host2VmTraversal });
-
- PropertyFilterSpec pfSpec = new PropertyFilterSpec();
- pfSpec.setPropSet(new PropertySpec[] { pSpec });
- pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
-
- ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
- cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
- new PropertyFilterSpec[] { pfSpec });
- this.printContent(ocs);
- }
-
- private void testFT() throws Exception {
-
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-480");
-
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-470");
-
- System.out.println("Create secondary VM");
- ManagedObjectReference morTask = cb.getServiceConnection3().getService().createSecondaryVM_Task(morVm, morHost);
- String result = cb.getServiceUtil3().waitForTask(morTask);
-
- System.out.println("Create secondary VM resutl : " + result);
- }
-
- private void testFTEnable() throws Exception {
- ManagedObjectReference morVm = new ManagedObjectReference();
- morVm.setType("VirtualMachine");
- morVm.set_value("vm-480");
-
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-470");
-
- ManagedObjectReference morSecondaryVm = new ManagedObjectReference();
- morSecondaryVm.setType("VirtualMachine");
- morSecondaryVm.set_value("vm-485");
-
- System.out.println("Enable FT");
- ManagedObjectReference morTask = cb.getServiceConnection3().getService().enableSecondaryVM_Task(morVm,
- morSecondaryVm, morHost);
- String result = cb.getServiceUtil3().waitForTask(morTask);
-
- System.out.println("Enable FT resutl : " + result);
- }
- private DatacenterMO setupDatacenterObject(String serverAddress, String dcMor) {
- VmwareContext context = new VmwareContext(cb, serverAddress);
-
- ManagedObjectReference morDc = new ManagedObjectReference();
- morDc.setType("Datacenter");
- morDc.set_value(dcMor);
-
- return new DatacenterMO(context, morDc);
- }
-
- private DistributedVirtualSwitchMO setupDistributedVirtualSwitchObject(String dvsMor, String serverAddress) {
- VmwareContext context = new VmwareContext(cb, serverAddress);
- return new DistributedVirtualSwitchMO(context, setupDVS(dvsMor));
- }
-
- private ManagedObjectReference setupDVS(String dvsMor) {
- ManagedObjectReference morDvs = new ManagedObjectReference();
- morDvs.setType("VmwareDistributedVirtualSwitch");
- morDvs.set_value(dvsMor);
- return morDvs;
- }
-
- private void testDvSwitchOperations() throws Exception {
- String dvSwitchName, dcMor;
- ManagedObjectReference queriedDvs;
- ManagedObjectReference morDvs;
- DatacenterMO dcMo;
- URL serviceUrl;
-
- // Initialize mor for existing DVS
- if (_args.length <= IND_DVSWITCH_NAME) {
- System.out.println("Using default parameters as required command line arguments are not provided.");
- System.out.println("Sequence of arguments: <SERVERADDRESS> <USER> <PASSWORD> <DATACENTER> <DVSWITCH_MOR> <DVSWITCH_NAME>");
- morDvs = setupDVS("dvs-921");
- dvSwitchName = "dvSwitch0";
- dcMor = "datacenter-2";
- } else {
- morDvs = setupDVS(_args[IND_DVSWITCH_MOR]);
- dvSwitchName = _args[IND_DVSWITCH_NAME];
- dcMor = _args[IND_DATACENTER_MOR];
- }
-
- serviceUrl = new URL(cb.getServiceUrl());
-
- // Initialize Datacenter Object that pertains to above DVS
- dcMo = setupDatacenterObject(serviceUrl.getHost(), dcMor);
-
- // Query for DVS with name
- queriedDvs = dcMo.getDvSwitchMor(dvSwitchName);
-
- System.out.print("\nTest fetch dvSwitch object from vCenter : ");
- if (morDvs.equals(queriedDvs)) {
- System.out.println("Success\n");
- } else {
- System.out.println("Failed\n");
- }
- }
-
- private void testDvPortGroupOpearations() throws Exception {
- // addDvPortGroup, updateDvPortGroup, getDvPortGroup, hasDvPortGroup
- ManagedObjectReference morDvs, morDvPortGroup;
- DatacenterMO dcMo;
- DistributedVirtualSwitchMO dvsMo;
- int networkRateMbps;
- int networkRateMbpsToUpdate;
- DVSTrafficShapingPolicy shapingPolicy;
- VmwareDistributedVirtualSwitchVlanSpec vlanSpec;
- DVSSecurityPolicy secPolicy;
- VMwareDVSPortSetting dvsPortSetting;
- DVPortgroupConfigSpec dvPortGroupSpec;
- DVPortgroupConfigInfo dvPortgroupInfo = null;
- String dvPortGroupName, dcMor;
- Integer vid;
- int numPorts;
- int timeOutMs;
- URL serviceUrl;
-
- if (_args.length < MAX_ARGS) {
- System.out.println("Using default parameters as required command line arguments are not provided.");
- System.out.println("Sequence of arguments: <SERVERADDRESS> <USER> <PASSWORD> <DATACENTER> <DVSWITCH_MOR> <DVSWITCH_NAME> <DVPORTGROUP_NAME> <DVPORTGROUP_VLAN> <DVPORTGROUP_PORTCOUNT>");
- morDvs = setupDVS("dvs-921");
- dvPortGroupName = "cloud.public.201.dvSwitch0.1";
- networkRateMbps = 201;
- vid = new Integer(399); // VLAN 399
- timeOutMs = 7000;
- numPorts = 64;
- dcMor = "datacenter-2";
- } else {
- morDvs = setupDVS(_args[IND_DVSWITCH_MOR]);
- dvPortGroupName = _args[IND_DVPORTGROUP_NAME];
- vid = new Integer(IND_DVPORTGROUP_VLAN);
- dcMor = _args[IND_DATACENTER_MOR];
- numPorts = Integer.parseInt(_args[IND_DVPORTGROUP_PORTCOUNT]);
- timeOutMs = 7000;
- networkRateMbps = 201;
- }
- serviceUrl = new URL(cb.getServiceUrl());
-
- // Initialize Datacenter Object that pertains to above DVS
- dcMo = setupDatacenterObject(serviceUrl.getHost(), dcMor);
- // Create dvPortGroup configuration spec
- dvsMo = setupDistributedVirtualSwitchObject(morDvs.get_value(), serviceUrl.getHost());
-
- shapingPolicy = HypervisorHostHelper.getDVSShapingPolicy(networkRateMbps);
- secPolicy = HypervisorHostHelper.createDVSSecurityPolicy();
- if (vid != null) {
- vlanSpec = HypervisorHostHelper.createDVPortVlanIdSpec(vid);
- } else {
- vlanSpec = HypervisorHostHelper.createDVPortVlanSpec();
- }
- dvsPortSetting = HypervisorHostHelper.createVmwareDVPortSettingSpec(shapingPolicy, secPolicy, vlanSpec);
- dvPortGroupSpec = HypervisorHostHelper.createDvPortGroupSpec(dvPortGroupName, dvsPortSetting, numPorts);
- if (!dcMo.hasDvPortGroup(dvPortGroupName)) {
- System.out.print("\nTest create dvPortGroup : ");
- try {
- // Call method to create dvPortGroup
- dvsMo.createDVPortGroup(dvPortGroupSpec);
- System.out.println("Success\n");
- HypervisorHostHelper.waitForDvPortGroupReady(dcMo, dvPortGroupName, timeOutMs);
- } catch (Exception e) {
- System.out.println("Failed\n");
- throw new Exception(e);
- }
- }
-
- // Test for presence of dvPortGroup
- System.out.print("\nTest presence of dvPortGroup : ");
- if (dcMo.hasDvPortGroup(dvPortGroupName)) {
- System.out.println("Success\n");
- } else {
- System.out.println("Failed\n");
- }
-
- // Test get existing dvPortGroup
- System.out.print("\nTest fetch dvPortGroup configuration : ");
- try {
- dvPortgroupInfo = dcMo.getDvPortGroupSpec(dvPortGroupName);
- if (dvPortgroupInfo != null)
- System.out.println("Success\n");
- } catch (Exception e) {
- System.out.println("Failed\n");
- }
- // Test compare dvPortGroup configuration
- System.out.print("\nTest compare dvPortGroup configuration : ");
-
- if (HypervisorHostHelper.isSpecMatch(dvPortgroupInfo, vid, shapingPolicy)) {
- System.out.println("Success\n");
- // We haven't modified the dvPortGroup after creating above.
- // Hence expecting to be matching.
- // NOTE : Hopefully nothing changes the configuration externally.
- } else {
- System.out.println("Failed\n");
- }
-
- // Test update dvPortGroup configuration
- networkRateMbpsToUpdate = 210;
- shapingPolicy = HypervisorHostHelper.getDVSShapingPolicy(networkRateMbpsToUpdate);
- dvsPortSetting = HypervisorHostHelper.createVmwareDVPortSettingSpec(shapingPolicy, secPolicy, vlanSpec);
- dvPortGroupSpec.setDefaultPortConfig(dvsPortSetting);
- dvPortGroupSpec.setConfigVersion(dvPortgroupInfo.getConfigVersion());
- morDvPortGroup = dcMo.getDvPortGroupMor(dvPortGroupName);
- System.out.print("\nTest update dvPortGroup configuration : ");
- if (!HypervisorHostHelper.isSpecMatch(dvPortgroupInfo, vid, shapingPolicy)) {
- try {
- dvsMo.updateDvPortGroup(morDvPortGroup, dvPortGroupSpec);
- System.out.println("Success\n");
- } catch (Exception e) {
- System.out.println("Failed\n");
- throw new Exception(e);
- }
- }
- }
- private void importOVF() throws Exception {
- ManagedObjectReference morHost = new ManagedObjectReference();
- morHost.setType("HostSystem");
- morHost.set_value("host-223");
-
- ManagedObjectReference morRp = new ManagedObjectReference();
- morRp.setType("ResourcePool");
- morRp.set_value("resgroup-222");
-
- ManagedObjectReference morDs = new ManagedObjectReference();
- morDs.setType("Datastore");
- morDs.set_value("datastore-30");
-
- ManagedObjectReference morVmFolder = new ManagedObjectReference();
- morVmFolder.setType("Folder");
- morVmFolder.set_value("group-v3");
-
- ManagedObjectReference morNetwork = new ManagedObjectReference();
- morNetwork.setType("Network");
- morNetwork.set_value("network-32");
-
- ManagedObjectReference morOvf = cb.getServiceConnection3().getServiceContent().getOvfManager();
-
- OvfCreateImportSpecParams importSpecParams = new OvfCreateImportSpecParams();
- importSpecParams.setHostSystem(morHost);
- importSpecParams.setLocale("US");
- importSpecParams.setEntityName("winxpsp3-ovf-deployed");
- importSpecParams.setDeploymentOption("");
- importSpecParams.setDiskProvisioning("thin");
-
-/*
- OvfNetworkMapping networkMapping = new OvfNetworkMapping();
- networkMapping.setName("VM Network");
- networkMapping.setNetwork(morNetwork); // network);
- importSpecParams.setNetworkMapping(new OvfNetworkMapping[] { networkMapping });
-*/
- importSpecParams.setPropertyMapping(null);
-
- String ovfDescriptor = readOvfContent("C:\\research\\vmware\\winxpsp3-ovf\\winxpsp3-ovf.ovf");
- OvfCreateImportSpecResult ovfImportResult = cb.getServiceConnection3().getService().createImportSpec(
- morOvf, ovfDescriptor, morRp, morDs, importSpecParams);
-
- if(ovfImportResult != null) {
- long totalBytes = addTotalBytes(ovfImportResult);
-
- ManagedObjectReference morLease = cb.getServiceConnection3().getService().importVApp(morRp,
- ovfImportResult.getImportSpec(), morVmFolder, morHost);
-
- HttpNfcLeaseState state;
- for(;;) {
- state = (HttpNfcLeaseState)cb.getServiceUtil3().getDynamicProperty(morLease, "state");
- if(state == HttpNfcLeaseState.ready || state == HttpNfcLeaseState.error)
- break;
- }
-
- if(state == HttpNfcLeaseState.ready) {
- HttpNfcLeaseInfo httpNfcLeaseInfo = (HttpNfcLeaseInfo)cb.getServiceUtil3().getDynamicProperty(morLease, "info");
- HttpNfcLeaseDeviceUrl[] deviceUrls = httpNfcLeaseInfo.getDeviceUrl();
- long bytesAlreadyWritten = 0;
- for (HttpNfcLeaseDeviceUrl deviceUrl : deviceUrls) {
-
- String deviceKey = deviceUrl.getImportKey();
- for (OvfFileItem ovfFileItem : ovfImportResult.getFileItem()) {
- if (deviceKey.equals(ovfFileItem.getDeviceId())) {
- System.out.println("Import key==OvfFileItem device id: " + deviceKey);
- System.out.println("device URL: " + deviceUrl.getUrl());
-
- String absoluteFile = "C:\\research\\vmware\\winxpsp3-ovf\\" + ovfFileItem.getPath();
- String urlToPost = deviceUrl.getUrl().replace("*", "esxhost-1.lab.vmops.com");
-
- uploadVmdkFile(ovfFileItem.isCreate(), absoluteFile, urlToPost, bytesAlreadyWritten, totalBytes);
- bytesAlreadyWritten += ovfFileItem.getSize();
- System.out.println("Completed uploading the VMDK file:" + absoluteFile);
- }
- }
- }
- cb.getServiceConnection3().getService().httpNfcLeaseProgress(morLease, 100);
- cb.getServiceConnection3().getService().httpNfcLeaseComplete(morLease);
- }
- }
- }
-
- private static void uploadVmdkFile(boolean put, String diskFilePath, String urlStr, long bytesAlreadyWritten, long totalBytes) throws IOException {
- HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
- public boolean verify(String urlHostName, SSLSession session) {
- return true;
- }
- });
-
- HttpsURLConnection conn = (HttpsURLConnection) new URL(urlStr).openConnection();
-
- conn.setDoOutput(true);
- conn.setUseCaches(false);
-
- int CHUCK_LEN = 64*1024;
- conn.setChunkedStreamingMode(CHUCK_LEN);
- conn.setRequestMethod(put? "PUT" : "POST"); // Use a post method to write the file.
- conn.setRequestProperty("Connection", "Keep-Alive");
- conn.setRequestProperty("Content-Type", "application/x-vnd.vmware-streamVmdk");
- conn.setRequestProperty("Content-Length", Long.toString(new File(diskFilePath).length()));
- BufferedOutputStream bos = new BufferedOutputStream(conn.getOutputStream());
- BufferedInputStream diskis = new BufferedInputStream(new FileInputStream(diskFilePath));
- int bytesAvailable = diskis.available();
- int bufferSize = Math.min(bytesAvailable, CHUCK_LEN);
- byte[] buffer = new byte[bufferSize];
- long totalBytesWritten = 0;
- while (true) {
- int bytesRead = diskis.read(buffer, 0, bufferSize);
- if (bytesRead == -1)
- {
- System.out.println("Total bytes written: " + totalBytesWritten);
- break;
- }
- totalBytesWritten += bytesRead;
- bos.write(buffer, 0, bufferSize);
- bos.flush();
- System.out.println("Total bytes written: " + totalBytesWritten);
-
-/*
- int progressPercent = (int) (((bytesAlreadyWritten + totalBytesWritten) * 100) / totalBytes);
- leaseUpdater.setPercent(progressPercent);
-*/
- }
- diskis.close();
- bos.flush();
- bos.close();
- conn.disconnect();
- }
-
- public static long addTotalBytes(OvfCreateImportSpecResult ovfImportResult) {
- OvfFileItem[] fileItemArr = ovfImportResult.getFileItem();
- long totalBytes = 0;
- if (fileItemArr != null) {
- for (OvfFileItem fi : fileItemArr) {
- printOvfFileItem(fi);
- totalBytes += fi.getSize();
- }
- }
- return totalBytes;
- }
-
- private static void printOvfFileItem(OvfFileItem fi) {
- System.out.println("================ OvfFileItem ================");
- System.out.println("chunkSize: " + fi.getChunkSize());
- System.out.println("create: " + fi.isCreate());
- System.out.println("deviceId: " + fi.getDeviceId());
- System.out.println("path: " + fi.getPath());
- System.out.println("size: " + fi.getSize());
- System.out.println("==============================================");
- }
-
- public static String readOvfContent(String ovfFilePath) throws IOException {
- StringBuffer strContent = new StringBuffer();
- BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(ovfFilePath)));
- String lineStr;
- while ((lineStr = in.readLine()) != null) {
- strContent.append(lineStr);
- }
-
- in.close();
- return strContent.toString();
- }
-
- public static String escapeSpecialChars(String str) {
- str = str.replaceAll("<", "<");
- return str.replaceAll(">", ">"); // do not escape "&" -> "&", "\"" -> """
- }
-
- public static void main(String[] args) throws Exception {
- setupLog4j();
- TestVMWare client = new TestVMWare();
-
- // skip certificate check
- System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory");
-
- String serviceUrl = "https://" + args[0] + "/sdk/vimService";
-
- try {
- String[] params = new String[] {"--url", serviceUrl, "--username", args[1], "--password", args[2] };
-
- cb = ExtendedAppUtil.initialize("Connect", params);
- cb.connect();
- System.out.println("Connection Succesful.");
- _args = args;
-
- // client.listInventoryFolders();
- // client.listDataCenters();
- // client.powerOnVm();
- // client.createSnapshot();
- // client.registerTemplate();
- // client.createVmFromTemplate();
- // client.addNic();
- // client.addNicToNetwork();
-
- // client.createDatacenter();
- // client.getPropertyWithPath();
- // client.getHostVMs();
- // client.testFT();
- // client.testFTEnable();
-
- // client.importOVF();
-
- // Test get DvSwitch
- client.testDvSwitchOperations();
- // Test add DvPortGroup,
- // Test update vPortGroup,
- // Test get DvPortGroup,
- // Test compare DvPortGroup
- client.testDvPortGroupOpearations();
-
- // Test addDvNic
- // Test deleteDvNic
- // client.testDvNicOperations();
-
- cb.disConnect();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static class TrustAllManager implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
-
- public java.security.cert.X509Certificate[] getAcceptedIssuers() {
- return null;
- }
-
- public boolean isServerTrusted(java.security.cert.X509Certificate[] certs) {
- return true;
- }
-
- public boolean isClientTrusted(java.security.cert.X509Certificate[] certs) {
- return true;
- }
-
- public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType)
- throws java.security.cert.CertificateException {
- return;
- }
- public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType)
- throws java.security.cert.CertificateException {
- return;
- }
- }
-}
-
[50/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Merge branch 'vmware-datamodel' of https://git-wip-us.apache.org/repos/asf/cloudstack into vmware-datamodel
Conflicts:
engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/57444fcb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/57444fcb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/57444fcb
Branch: refs/heads/vmware-datamodel
Commit: 57444fcb6b22db9317ab8ba89ac5bf7112273d4e
Parents: 9b08294 91e3825
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Thu May 9 23:29:58 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu May 9 23:29:58 2013 +0530
----------------------------------------------------------------------
setup/db/db/schema-410to420.sql | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
[40/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
fix bug CLOUDSTACK-2341 remove network from VM is not removing PF/LB/static nat rules for the VM
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6ef615e4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6ef615e4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6ef615e4
Branch: refs/heads/vmware-datamodel
Commit: 6ef615e40dd56f57813f0fec78ad2bd9e394b8c7
Parents: 3c59747
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Thu May 9 11:03:43 2013 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Thu May 9 11:04:30 2013 +0800
----------------------------------------------------------------------
.../src/com/cloud/network/rules/RulesManager.java | 3 +
.../com/cloud/network/rules/RulesManagerImpl.java | 38 +++++++++++
server/src/com/cloud/vm/UserVmManagerImpl.java | 6 ++
.../com/cloud/vm/VirtualMachineManagerImpl.java | 50 +++++++++++----
.../com/cloud/network/MockRulesManagerImpl.java | 8 +++
5 files changed, 92 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ef615e4/server/src/com/cloud/network/rules/RulesManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/rules/RulesManager.java b/server/src/com/cloud/network/rules/RulesManager.java
index 4b83e04..cede987 100644
--- a/server/src/com/cloud/network/rules/RulesManager.java
+++ b/server/src/com/cloud/network/rules/RulesManager.java
@@ -24,6 +24,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.vm.Nic;
import com.cloud.vm.VirtualMachine;
/**
@@ -87,4 +88,6 @@ public interface RulesManager extends RulesService {
*/
boolean applyStaticNatForNetwork(long networkId, boolean continueOnError, Account caller, boolean forRevoke);
+ List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic);
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ef615e4/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 2355635..c9b47b4 100755
--- a/server/src/com/cloud/network/rules/RulesManagerImpl.java
+++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java
@@ -50,8 +50,11 @@ import com.cloud.network.dao.FirewallRulesCidrsDao;
import com.cloud.network.dao.FirewallRulesDao;
import com.cloud.network.dao.IPAddressDao;
import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.LoadBalancerVMMapDao;
+import com.cloud.network.dao.LoadBalancerVMMapVO;
import com.cloud.network.rules.FirewallRule.FirewallRuleType;
import com.cloud.network.rules.FirewallRule.Purpose;
+import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.network.rules.dao.PortForwardingRulesDao;
import com.cloud.network.vpc.VpcManager;
import com.cloud.offering.NetworkOffering;
@@ -77,6 +80,7 @@ import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.Ip;
+import com.cloud.utils.net.NetUtils;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.UserVmVO;
@@ -132,6 +136,8 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
VpcManager _vpcMgr;
@Inject
NicSecondaryIpDao _nicSecondaryDao;
+ @Inject
+ LoadBalancerVMMapDao _loadBalancerVMMapDao;
@Override
public void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm, Account caller) {
@@ -1467,4 +1473,36 @@ public class RulesManagerImpl extends ManagerBase implements RulesManager, Rules
protected void removePFRule(PortForwardingRuleVO rule) {
_portForwardingDao.remove(rule.getId());
}
+
+ @Override
+ public List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic){
+ List<FirewallRuleVO> result = new ArrayList<FirewallRuleVO>();
+ // add PF rules
+ result.addAll(_portForwardingDao.listByDestIpAddr(nic.getIp4Address()));
+ // add static NAT rules
+ List<FirewallRuleVO> staticNatRules = _firewallDao.listStaticNatByVmId(nic.getInstanceId());
+ for(FirewallRuleVO rule : staticNatRules){
+ if(rule.getNetworkId() == nic.getNetworkId())
+ result.add(rule);
+ }
+ List<? extends IpAddress> staticNatIps = _ipAddressDao.listStaticNatPublicIps(nic.getNetworkId());
+ for(IpAddress ip : staticNatIps){
+ if(ip.getVmIp() != null && ip.getVmIp().equals(nic.getIp4Address())){
+ VMInstanceVO vm = _vmInstanceDao.findById(nic.getInstanceId());
+ // generate a static Nat rule on the fly because staticNATrule does not persist into db anymore
+ // FIX ME
+ FirewallRuleVO staticNatRule = new FirewallRuleVO(null, ip.getId(), 0, 65535, NetUtils.ALL_PROTO.toString(),
+ nic.getNetworkId(), vm.getAccountId(), vm.getDomainId(), Purpose.StaticNat, null, null, null, null, null);
+ result.add(staticNatRule);
+ }
+ }
+ // add LB rules
+ List<LoadBalancerVMMapVO> lbMapList = _loadBalancerVMMapDao.listByInstanceId(nic.getInstanceId());
+ for(LoadBalancerVMMapVO lb : lbMapList){
+ FirewallRuleVO lbRule = _firewallDao.findById(lb.getLoadBalancerId());
+ if(lbRule.getNetworkId() == nic.getNetworkId())
+ result.add(lbRule);
+ }
+ return result;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ef615e4/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 bc25bed..644f5ed 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -831,6 +831,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
if(network == null) {
throw new InvalidParameterValueException("unable to find a network with id " + networkId);
}
+ List<NicVO> allNics = _nicDao.listByVmId(vmInstance.getId());
+ for(NicVO nic : allNics){
+ if(nic.getNetworkId() == network.getId())
+ throw new CloudRuntimeException("A NIC already exists for VM:" + vmInstance.getInstanceName() + " in network: " + network.getUuid());
+ }
+
NicProfile profile = new NicProfile(null, null);
if(ipAddress != null) {
profile = new NicProfile(ipAddress, null);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ef615e4/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 afffbec..521b5e0 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -24,7 +24,6 @@ import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -37,40 +36,56 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import com.cloud.capacity.CapacityManager;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import com.cloud.dc.*;
-import com.cloud.agent.api.*;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.AgentManager.OnError;
import com.cloud.agent.Listener;
+import com.cloud.agent.api.AgentControlAnswer;
+import com.cloud.agent.api.AgentControlCommand;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.CheckVirtualMachineAnswer;
+import com.cloud.agent.api.CheckVirtualMachineCommand;
+import com.cloud.agent.api.ClusterSyncAnswer;
+import com.cloud.agent.api.ClusterSyncCommand;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.MigrateAnswer;
+import com.cloud.agent.api.MigrateCommand;
+import com.cloud.agent.api.PingRoutingCommand;
+import com.cloud.agent.api.PrepareForMigrationAnswer;
+import com.cloud.agent.api.PrepareForMigrationCommand;
+import com.cloud.agent.api.RebootAnswer;
+import com.cloud.agent.api.RebootCommand;
+import com.cloud.agent.api.ScaleVmCommand;
+import com.cloud.agent.api.StartAnswer;
+import com.cloud.agent.api.StartCommand;
+import com.cloud.agent.api.StartupCommand;
+import com.cloud.agent.api.StartupRoutingCommand;
import com.cloud.agent.api.StartupRoutingCommand.VmState;
+import com.cloud.agent.api.StopAnswer;
+import com.cloud.agent.api.StopCommand;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
-import com.cloud.agent.api.to.StorageFilerTO;
-import com.cloud.agent.api.to.VolumeTO;
import com.cloud.agent.manager.Commands;
import com.cloud.agent.manager.allocator.HostAllocator;
import com.cloud.alert.AlertManager;
+import com.cloud.capacity.CapacityManager;
import com.cloud.cluster.ClusterManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.Resource.ResourceType;
import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.dao.ClusterDao;
+import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO;
-import com.cloud.consoleproxy.ConsoleProxyManager;
+import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.HostPodDao;
import com.cloud.deploy.DataCenterDeployment;
@@ -109,6 +124,7 @@ import com.cloud.network.NetworkManager;
import com.cloud.network.NetworkModel;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.rules.RulesManager;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.resource.ResourceManager;
@@ -126,9 +142,9 @@ import com.cloud.storage.VolumeVO;
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.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
-import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.snapshot.SnapshotManager;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
@@ -154,12 +170,12 @@ import com.cloud.vm.VirtualMachine.Event;
import com.cloud.vm.VirtualMachine.State;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
import com.cloud.vm.snapshot.VMSnapshot;
import com.cloud.vm.snapshot.VMSnapshotManager;
import com.cloud.vm.snapshot.VMSnapshotVO;
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
-import com.cloud.vm.dao.UserVmDetailsDao;
@Local(value = VirtualMachineManager.class)
public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMachineManager, Listener {
@@ -235,6 +251,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
protected VolumeDataFactory volFactory;
@Inject
protected ResourceLimitService _resourceLimitMgr;
+ @Inject
+ protected RulesManager rulesMgr;
protected List<DeploymentPlanner> _planners;
public List<DeploymentPlanner> getPlanners() {
@@ -2845,6 +2863,12 @@ 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
+ + ", nic has associated Port forwarding or Load balancer or Static NAT rules.");
+ }
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(),
_networkModel.getNetworkRate(network.getId(), vm.getId()),
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6ef615e4/server/test/com/cloud/network/MockRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/MockRulesManagerImpl.java b/server/test/com/cloud/network/MockRulesManagerImpl.java
index 200fd2c..82a3e93 100644
--- a/server/test/com/cloud/network/MockRulesManagerImpl.java
+++ b/server/test/com/cloud/network/MockRulesManagerImpl.java
@@ -28,6 +28,7 @@ import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.rules.FirewallRuleVO;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.PortForwardingRuleVO;
import com.cloud.network.rules.RulesManager;
@@ -40,6 +41,7 @@ import com.cloud.utils.Pair;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.net.Ip;
+import com.cloud.vm.Nic;
import com.cloud.vm.VirtualMachine;
@Local(value = {RulesManager.class, RulesService.class})
@@ -310,4 +312,10 @@ public class MockRulesManagerImpl extends ManagerBase implements RulesManager, R
return null;
}
+ @Override
+ public List<FirewallRuleVO> listAssociatedRulesForGuestNic(Nic nic) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
[35/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2387:Addition/Deletion of a VLAN Range from UI calls updateTrafficType API which makes all networklabels as undefined which finally results in failure to deploy VMs
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/305f3cb8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/305f3cb8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/305f3cb8
Branch: refs/heads/vmware-datamodel
Commit: 305f3cb8a503df84875fe7e066ca60fe186da22e
Parents: 76e8afa
Author: Pranav Saxena <pr...@citrix.com>
Authored: Wed May 8 17:07:46 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Wed May 8 17:07:46 2013 +0530
----------------------------------------------------------------------
ui/scripts/system.js | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/305f3cb8/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 2746e0d..34ba64c 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -1066,10 +1066,7 @@
dataType: "json",
success: function(json) {
var jobId = json.updatephysicalnetworkresponse.jobid;
- var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest');
- updateTrafficLabels(trafficType, args.data, function() {
args.response.success({ _custom: { jobId: jobId }});
- });
},
error:function(json){
[23/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2357 : Failed to update VNMC provider to enabled state
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/20bc334f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/20bc334f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/20bc334f
Branch: refs/heads/vmware-datamodel
Commit: 20bc334f2c9df58d658c9541b1fa43a47521d979
Parents: 64dc39a
Author: Koushik Das <ko...@citrix.com>
Authored: Wed May 8 08:32:48 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Wed May 8 08:32:48 2013 +0530
----------------------------------------------------------------------
.../cloud/network/element/CiscoVnmcElement.java | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/20bc334f/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
index 443bb40..470c4e8 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/element/CiscoVnmcElement.java
@@ -434,16 +434,14 @@ public class CiscoVnmcElement extends AdapterBase implements SourceNatServicePro
@Override
public boolean isReady(PhysicalNetworkServiceProvider provider) {
- // TODO Auto-generated method stub
- return false;
+ return true;
}
@Override
public boolean shutdownProviderInstances(
PhysicalNetworkServiceProvider provider, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException {
- // TODO Auto-generated method stub
- return false;
+ return true;
}
@Override
[41/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
fix CLOUDSTACK-2277 Add approriate message for the user informing about the absence of vm-tools when adding nics to vm on vmware
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/600f140d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/600f140d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/600f140d
Branch: refs/heads/vmware-datamodel
Commit: 600f140df67e8521e118691f92b460d55e7ec656
Parents: 6ef615e
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Thu May 9 14:27:13 2013 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Thu May 9 14:27:13 2013 +0800
----------------------------------------------------------------------
.../hypervisor/vmware/resource/VmwareResource.java | 18 +++++++++++++++
server/src/com/cloud/vm/UserVmManagerImpl.java | 4 +-
2 files changed, 20 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/600f140d/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 030eff0..d87da64 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -237,6 +237,7 @@ import com.vmware.vim25.ClusterDasConfigInfo;
import com.vmware.vim25.ComputeResourceSummary;
import com.vmware.vim25.DatastoreSummary;
import com.vmware.vim25.DynamicProperty;
+import com.vmware.vim25.GuestInfo;
import com.vmware.vim25.HostCapability;
import com.vmware.vim25.HostFirewallInfo;
import com.vmware.vim25.HostFirewallRuleset;
@@ -1326,6 +1327,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
throw new Exception(msg);
}
+ if(!isVMWareToolsInstalled(vmMo)){
+ String errMsg = "vmware tools is not installed or not running, cannot add nic to vm " + vmName;
+ s_logger.debug(errMsg);
+ return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due to " + errMsg);
+ }
+
// TODO need a way to specify the control of NIC device type
VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.E1000;
@@ -1400,6 +1407,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
throw new Exception(msg);
}
+ if(!isVMWareToolsInstalled(vmMo)){
+ String errMsg = "vmware tools not installed or not running, cannot remove nic from vm " + vmName;
+ s_logger.debug(errMsg);
+ return new UnPlugNicAnswer(cmd, false, "Unable to execute unPlugNicCommand due to " + errMsg);
+ }
+
VirtualDevice nic = findVirtualNicDevice(vmMo, cmd.getNic().getMac());
if ( nic == null ) {
return new UnPlugNicAnswer(cmd, true, "success");
@@ -5237,4 +5250,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
// TODO Auto-generated method stub
}
+
+ private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception{
+ GuestInfo guestInfo = vmMo.getVmGuestInfo();
+ return (guestInfo != null && guestInfo.getGuestState() != null && guestInfo.getGuestState().equalsIgnoreCase("running"));
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/600f140d/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 644f5ed..eee8503 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -4248,7 +4248,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
_agentMgr.send(dest.getHost().getId(),cmds);
PlugNicAnswer plugNicAnswer = cmds.getAnswer(PlugNicAnswer.class);
if (!(plugNicAnswer != null && plugNicAnswer.getResult())) {
- s_logger.warn("Unable to plug nic for " + vmVO);
+ s_logger.warn("Unable to plug nic for " + vmVO + " due to: " + " due to: " + plugNicAnswer.getDetails());
return false;
}
} catch (OperationTimedoutException e) {
@@ -4276,7 +4276,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
_agentMgr.send(dest.getHost().getId(),cmds);
UnPlugNicAnswer unplugNicAnswer = cmds.getAnswer(UnPlugNicAnswer.class);
if (!(unplugNicAnswer != null && unplugNicAnswer.getResult())) {
- s_logger.warn("Unable to unplug nic for " + vmVO);
+ s_logger.warn("Unable to unplug nic for " + vmVO + " due to: " + unplugNicAnswer.getDetails());
return false;
}
} catch (OperationTimedoutException e) {
[37/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2318: update volumes.path to fix stop/start vm error after
upgrade from 2.2.14 to 3.0.0
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/99d09363
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/99d09363
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/99d09363
Branch: refs/heads/vmware-datamodel
Commit: 99d0936314571e645f62e40bf4d227232be89632
Parents: 44f3f5e
Author: Wei Zhou <w....@leaseweb.com>
Authored: Wed May 8 17:44:46 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Wed May 8 17:45:56 2013 +0100
----------------------------------------------------------------------
setup/db/db/schema-2214to30.sql | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/99d09363/setup/db/db/schema-2214to30.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-2214to30.sql b/setup/db/db/schema-2214to30.sql
index 60eceea..e288b0f 100755
--- a/setup/db/db/schema-2214to30.sql
+++ b/setup/db/db/schema-2214to30.sql
@@ -664,6 +664,7 @@ ALTER TABLE `cloud`.`dc_storage_network_ip_range` ADD COLUMN `gateway` varchar(1
ALTER TABLE `cloud`.`volumes` ADD COLUMN `last_pool_id` bigint unsigned;
UPDATE `cloud`.`volumes` SET `last_pool_id` = `pool_id`;
+UPDATE `cloud`.`volumes` SET `path` = SUBSTRING_INDEX(`path`, '/', -1);
ALTER TABLE `cloud`.`user_ip_address` ADD COLUMN `is_system` int(1) unsigned NOT NULL default '0';
ALTER TABLE `cloud`.`volumes` ADD COLUMN `update_count` bigint unsigned NOT NULL DEFAULT 0;
[46/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Legacy zone support.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f01189ac
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f01189ac
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f01189ac
Branch: refs/heads/vmware-datamodel
Commit: f01189ac5f3b3f82206fc0f41f1251752db86925
Parents: cada301
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Sat May 4 23:20:59 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu May 9 23:22:58 2013 +0530
----------------------------------------------------------------------
setup/db/db/schema-410to420.sql | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f01189ac/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 9183754..d19ed4d 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -934,6 +934,13 @@ CREATE TABLE `cloud`.`vmware_data_center_zone_map` (
CONSTRAINT `fk_vmware_data_center_zone_map__vmware_data_center_id` FOREIGN KEY (`vmware_data_center_id`) REFERENCES `vmware_data_center`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE `cloud`.`legacy_zones` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `zone_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of CloudStack zone',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_legacy_zones__zone_id` FOREIGN KEY (`zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
-- Re-enable foreign key checking, at the end of the upgrade path
@@ -994,6 +1001,7 @@ CREATE VIEW `cloud`.`account_view` AS
select
account.id,
account.uuid,
+ account.uuid,
account.account_name,
account.type,
account.state,
[19/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-893 api
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/43fdb144
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/43fdb144
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/43fdb144
Branch: refs/heads/vmware-datamodel
Commit: 43fdb144e19332fa4a37a1c01376921545ebbc28
Parents: b9f262a
Author: Radhika PC <ra...@citrix.com>
Authored: Tue May 7 18:26:08 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Tue May 7 18:26:47 2013 +0530
----------------------------------------------------------------------
docs/en-US/added-API-commands-4.2.xml | 43 ++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43fdb144/docs/en-US/added-API-commands-4.2.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/added-API-commands-4.2.xml b/docs/en-US/added-API-commands-4.2.xml
index 3471624..7417bd1 100644
--- a/docs/en-US/added-API-commands-4.2.xml
+++ b/docs/en-US/added-API-commands-4.2.xml
@@ -63,5 +63,48 @@
more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
<para>The response parameters are: true, false </para>
</listitem>
+ <listitem>
+ <para>createGlobalLoadBalancerRule</para>
+ <para>Creates a GSLB rule. The request parameters are name (the name of the global load
+ balancer rule); domain name ( the preferred domain name for the service); lb algorithm (the
+ algorithm used to load balance the traffic across the zones); session persistence (source IP
+ and HTTP cookie); account name; and domain Id.</para>
+ </listitem>
+ <listitem>
+ <para>assignToGlobalLoadBalancerRule</para>
+ <para>Assigns a load balancing rule or list of load balancing rules to GSLB. The request
+ parameters are: id (the UUID of global load balancer rule); loadbalancerrulelist (the list
+ load balancer rules that will be assigned to global load balancer rule. These are second
+ tier load balancing rules created with createLoadBalancerRule API. Weight is optional, the
+ default is 1).</para>
+ </listitem>
+ <listitem>
+ <para>removeFromGlobalLoadBalancerRule</para>
+ <para>Removes a load balancer rule association with global load balancer rule. The request
+ parameters are id (the UUID of global load balancer rule); loadbalancerrulelist (the list
+ load balancer rules that will be assigned to global load balancer rule).</para>
+ </listitem>
+ <listitem>
+ <para>deleteGlobalLoadBalancerRule</para>
+ <para>Deletes a global load balancer rule. The request parameters is: id (the unique ID of the
+ global load balancer rule).</para>
+ </listitem>
+ <listitem>
+ <para>listGlobalLoadBalancerRule</para>
+ <para>Lists load balancer rules. account (lists resources by account. Use with the domainId
+ parameter); domainid (lists only resources belonging to the domain specified) id (the unique
+ ID of the global load balancer rule) isrecursive (defaults to false, but if true, lists all
+ resources from the parent specified by the domainId till leaves); keyword (List by keyword);
+ listall (if set to false, list only resources belonging to the command's caller; if set to
+ true - list resources that the caller is authorized to see. Default value is false); page;
+ pagesize; projectid (lists objects by project); regionid (region ID); tags (lists resources
+ by tags: key/value pairs). </para>
+ </listitem>
+ <listitem>
+ <para>updateGlobalLoadBalancerRule</para>
+ <para>Archives the specified events. The request parameters are: ids (allowed to pass one or
+ more IDs separated by comma); type (string); olderthan (yyyy-mm-dd format).</para>
+ <para>The response parameters are: true, false </para>
+ </listitem>
</itemizedlist>
</section>
[26/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2329, CLOUDSTACK-1820: Tests for regions
Marvin tests and corresponding library changes for the regions feature.
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/5ef2f1f2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5ef2f1f2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5ef2f1f2
Branch: refs/heads/vmware-datamodel
Commit: 5ef2f1f26fcd159cb48b25882ea10cb3fc44d1b9
Parents: b6cb23c
Author: Sangeetha Hariharan <sa...@citrix.com>
Authored: Fri May 3 17:02:32 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 13:49:13 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_regions.py | 443 ++++++++++++++++++++++
tools/marvin/marvin/integration/lib/base.py | 54 +++
2 files changed, 497 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ef2f1f2/test/integration/component/test_regions.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_regions.py b/test/integration/component/test_regions.py
new file mode 100644
index 0000000..1b24871
--- /dev/null
+++ b/test/integration/component/test_regions.py
@@ -0,0 +1,443 @@
+#!/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:
+ """
+ """
+
+ def __init__(self):
+ self.services = {
+ "domain": {
+ "name": "testuuid",
+ "domainUUID": "domain1"
+ },
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Testuuid",
+ "lastname": "Useruuid",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ "accountUUID": "account1",
+ "userUUID": "user1"
+ },
+ "user": {
+ "email": "test@test.com",
+ "firstname": "Testuuid",
+ "lastname": "Useruuid",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ "userUUID": "user2"
+ },
+ "ostype": 'CentOS 5.3 (64-bit)',
+ "region": {
+ "regionid": "2",
+ "regionname": "Region2",
+ "regionendpoint": "http://region2:8080/client"
+ }
+ }
+
+
+class TestRegions(cloudstackTestCase):
+ """
+ Testing Regions related Apis
+ """
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.cleanup = []
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_createAccountWithUUID(self):
+ """
+ Test for creating Account by passing id parameter
+
+ # Validate the following
+ # 1.Create an Account by passing id parameter.Verify the account is created.
+ # 2.List this account by passing id parameter.Verify that list account is able to lis this account.
+ # 3.Delete account should succeed.
+
+ """
+ account = Account.create(
+ self.api_client,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ self.assertIn ( self.services["account"]["accountUUID"] , account.id,
+ "Account is not created with the accountId passed")
+
+ list_account = Account.list(self.api_client,
+ id=account.id
+ )
+
+ self.assertEqual(
+ isinstance(list_account, list),
+ True,
+ "Check for list account response by uuid failed"
+ )
+
+ print (list_account)
+
+ account_response = list_account[0]
+
+ print (account_response)
+
+ self.assertEqual( account_response.id,
+ account.id,
+ "listAccount response does not match with account Id "
+ )
+ self.assertEqual(
+ account_response.user[0].firstname,
+ self.services["account"]["firstname"],
+ "listAccount response does not match with account firstname"
+ )
+
+ self.cleanup.append(account)
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_createUserWithUUID(self):
+ """
+ Test for creating User by passing id parameter
+
+ # Validate the following
+ # 1.Create a User by passing id parameter.Verify the user is created.
+ # 2.List this user by passing id parameter.Verify that list user is able to list this user.
+ # 3.Delete User should succeed.
+
+ """
+
+ user = User.create(
+ self.api_client,
+ self.services["user"],
+ account="Admin",
+ domainid=self.domain.id
+ )
+ self.assertIn ( self.services["user"]["userUUID"] , user.id,
+ "User is not created successfully with the userId passed")
+
+ list_user = User.list(self.api_client,
+ id=user.id
+ )
+
+ self.assertEqual(
+ isinstance(list_user, list),
+ True,
+ "Check for list user response by uuid failed"
+ )
+
+
+ user_response = list_user[0]
+
+
+ self.assertEqual( user_response.id,
+ user.id,
+ "list User response does not match with user Id "
+ )
+ self.assertEqual(
+ user_response.firstname,
+ self.services["user"]["firstname"],
+ "listUser response does not match with user firstname"
+ )
+
+ user.delete(self.api_client)
+
+ list_user = User.list(self.api_client,
+ id=user.id
+ )
+
+ self.assertIsNone(
+ list_user,
+ "Deletion of user failed"
+ )
+
+
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_createdomainWithUUID(self):
+ """
+ Test for creating Domain by passing id parameter
+
+ # Validate the following
+ # 1.Create a domain by passing id parameter.Verify the domain is created.
+ # 2.List this domain by passing id parameter.Verify that list domain is able to list this domain.
+ # 3.Delete domain should succeed.
+
+ """
+
+ domain = Domain.create(
+ self.api_client,
+ self.services["domain"]
+ )
+ self.assertIn ( self.services["domain"]["domainUUID"] , domain.id,
+ "Domain is not created with the doaminId passed")
+
+ list_domain = Domain.list(self.api_client,
+ id=domain.id
+ )
+
+ self.assertEqual(
+ isinstance(list_domain, list),
+ True,
+ "Check for list domain response by uuid failed"
+ )
+
+
+ domain_response = list_domain[0]
+
+
+ self.assertEqual( domain_response.id,
+ domain.id,
+ "list domain response does not match with domain Id "
+ )
+ self.assertIn(
+ self.services["domain"]["name"],
+ domain_response.name,
+ "list domaiin response does not match with user firstname"
+ )
+ try:
+ domain.delete(self.api_client)
+ except Exception as e:
+ self.fail("Failed to delete domain: %s" % e)
+
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_createRegion(self):
+ """
+ Test for add Region
+ """
+
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ self.assertEqual(
+ isinstance(list_region, list),
+ True,
+ "Check for list Region response"
+ )
+ region_response = list_region[0]
+
+ print (region_response)
+ print (self.services["region"])
+
+ self.assertEqual(
+ str(region_response.id),
+ self.services["region"]["regionid"],
+ "listRegion response does not match with region Id created"
+ )
+
+ self.assertEqual(
+ region_response.name,
+ self.services["region"]["regionname"],
+ "listRegion response does not match with region name created"
+ )
+ self.assertEqual(
+ region_response.endpoint,
+ self.services["region"]["regionendpoint"],
+ "listRegion response does not match with region endpoint created"
+ )
+
+ region = region.delete(self.api_client)
+
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_createDupRegion(self):
+ """
+ Test for duplicate checks on id and name parameters when adding regions
+ """
+
+ self.services["region"]["regionid"]="5"
+ self.services["region"]["regionname"]="Region5"
+ self.services["region"]["regionendpoint"]="http://region5:8080/client"
+
+
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ self.assertEqual(
+ isinstance(list_region, list),
+ True
+ )
+ """
+ Creating regions with duplicate id should not be allowed
+ """
+
+ self.services["region"]["regionid"]="5"
+ self.services["region"]["regionname"]="Region51"
+ self.services["region"]["regionendpoint"]="http://region51:8080/client"
+
+ try:
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+ self.assertIsNone(region,
+ "Creating regions with duplicate id is allowed"
+ )
+ except:
+ print " Creating Region with duplicate Id is not allowed"
+ pass
+
+ """
+ Creating regions with duplicate name should not be allowed
+ """
+
+ self.services["region"]["regionid"]="51"
+ self.services["region"]["regionname"]="Region5"
+ self.services["region"]["regionendpoint"]="http://region51:8080/client"
+
+ try:
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+ except:
+ print " Creating Region with duplicate Name is not allowed"
+ pass
+
+ region.delete(self.api_client)
+
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_updateRegion(self):
+ """
+ Test for update Region
+ """
+
+ self.services["region"]["regionid"]="3"
+ self.services["region"]["regionname"]="Region3"
+ self.services["region"]["regionendpoint"]="http://region3:8080/client"
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+
+ self.services["region"]["regionname"]="Region3upd"
+ self.services["region"]["regionendpoint"]="http://region3upd:8080/client"
+
+ updated_region = region.update(self.api_client,
+ self.services["region"]
+ )
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ self.assertEqual(
+ isinstance(list_region, list),
+ True,
+ "Check for list Region response"
+ )
+ region_response = list_region[0]
+
+ self.assertEqual(
+ str(region_response.id),
+ self.services["region"]["regionid"],
+ "listRegion response does not match with region Id created"
+ )
+
+ self.assertEqual(
+ region_response.name,
+ self.services["region"]["regionname"],
+ "listRegion response does not match with region name created"
+ )
+ self.assertEqual(
+ region_response.endpoint,
+ self.services["region"]["regionendpoint"],
+ "listRegion response does not match with region endpoint created"
+ )
+
+ region.delete(self.api_client)
+
+ return
+
+ @attr(tags=["basic", "advanced"])
+ def test_deleteRegion(self):
+ """
+ Test for delete Region
+ """
+
+ self.services["region"]["regionid"]="4"
+ self.services["region"]["regionname"]="Region4"
+ self.services["region"]["regionendpoint"]="http://region4:8080/client"
+
+ region = Region.create(self.api_client,
+ self.services["region"]
+ )
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ print (list_region);
+
+ self.assertEqual(
+ len(list_region),
+ 1,
+ "Check for Region response"
+ )
+
+ region = region.delete(self.api_client)
+
+ list_region = Region.list(self.api_client,
+ id=self.services["region"]["regionid"]
+ )
+
+ print (list_region);
+
+ self.assertIsNone(list_region,
+ "Check for empty Region response"
+ )
+
+ return
+
+
+ @classmethod
+ def tearDown(cls):
+
+ try:
+ cls.api_client = super(TestRegions, cls).getClsTestClient().getApiClient()
+ #Clean up
+ cleanup_resources(cls.api_client, cls.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ef2f1f2/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 92b8a2d..899c203 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -40,6 +40,9 @@ class Domain:
cmd = createDomain.createDomainCmd()
+ if "domainUUID" in services:
+ cmd.domainid = "-".join([services["domainUUID"],random_gen()])
+
if name:
cmd.name = "-".join([name, random_gen()])
elif "name" in services:
@@ -97,6 +100,13 @@ class Account:
cmd.password = services["password"]
cmd.username = "-".join([services["username"], random_gen()])
+ if "accountUUID" in services:
+ cmd.accountid = "-".join([services["accountUUID"],random_gen()])
+
+ if "userUUID" in services:
+ cmd.userid = "-".join([services["userUUID"],random_gen()])
+
+
if domainid:
cmd.domainid = domainid
account = apiclient.createAccount(cmd)
@@ -135,6 +145,9 @@ class User:
cmd.firstname = services["firstname"]
cmd.lastname = services["lastname"]
+ if "userUUID" in services:
+ cmd.userid = "-".join([services["userUUID"],random_gen()])
+
# Password Encoding
mdf = hashlib.md5()
mdf.update(services["password"])
@@ -3108,3 +3121,44 @@ class VmSnapshot:
cmd.vmsnapshotid = vmsnapshotid
return apiclient.deleteVMSnapshot(cmd)
+
+class Region:
+ """ Regions related Api """
+ def __init__(self, items):
+ self.__dict__.update(items)
+
+ @classmethod
+ def create(cls, apiclient, services):
+ cmd = addRegion.addRegionCmd()
+ cmd.id = services["regionid"]
+ cmd.endpoint = services["regionendpoint"]
+ cmd.name = services["regionname"]
+ try:
+ region = apiclient.addRegion(cmd)
+ if region is not None:
+ return Region(region.__dict__)
+ except Exception as e:
+ raise e
+
+ @classmethod
+ def list(cls, apiclient, **kwargs):
+ cmd = listRegions.listRegionsCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ region = apiclient.listRegions(cmd)
+ return region
+
+ def update(self, apiclient, services):
+ cmd = updateRegion.updateRegionCmd()
+ cmd.id = self.id
+ if services["regionendpoint"]:
+ cmd.endpoint = services["regionendpoint"]
+ if services["regionname"]:
+ cmd.name = services["regionname"]
+ region = apiclient.updateRegion(cmd)
+ return region
+
+ def delete(self, apiclient):
+ cmd = removeRegion.removeRegionCmd()
+ cmd.id = self.id
+ region = apiclient.removeRegion(cmd)
+ return region
[42/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2413 - Display the Name of compute offering in dialog box Change Service Offering (was Description field before)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2e1877af
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2e1877af
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2e1877af
Branch: refs/heads/vmware-datamodel
Commit: 2e1877af33a49d4d18d3e024abca16b3d72dbf4e
Parents: 600f140
Author: Milamber <mi...@apache.org>
Authored: Thu May 9 10:46:05 2013 +0100
Committer: Milamber <mi...@apache.org>
Committed: Thu May 9 10:50:04 2013 +0100
----------------------------------------------------------------------
ui/scripts/instances.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e1877af/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index e5d7d14..c76d843 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -934,7 +934,7 @@
var serviceofferings = json.listserviceofferingsresponse.serviceoffering;
var items = [];
$(serviceofferings).each(function() {
- items.push({id: this.id, description: this.displaytext});
+ items.push({id: this.id, description: this.name});
});
args.response.success({data: items});
}
[48/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-1963 New mapping model for CloudStack zone and Vmware datacenter
Upgrade changes with legacy zone support
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/47d40880
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/47d40880
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/47d40880
Branch: refs/heads/vmware-datamodel
Commit: 47d4088071062b4edd2afeef08e58dfc9998eee2
Parents: f01189a
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Mon May 6 15:59:24 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu May 9 23:22:59 2013 +0530
----------------------------------------------------------------------
.../src/com/cloud/upgrade/dao/Upgrade410to420.java | 162 ++++++++++++++-
.../cloud/hypervisor/vmware/VmwareDatacenter.java | 4 -
.../hypervisor/vmware/VmwareDatacenterVO.java | 12 -
.../vmware/manager/VmwareManagerImpl.java | 5 +-
4 files changed, 164 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47d40880/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 05e2b49..c3e37de 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -17,6 +17,7 @@
package com.cloud.upgrade.dao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import org.apache.log4j.Logger;
@@ -26,6 +27,8 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.UUID;
public class Upgrade410to420 implements DbUpgrade {
@@ -59,6 +62,7 @@ public class Upgrade410to420 implements DbUpgrade {
@Override
public void performDataMigration(Connection conn) {
upgradeVmwareLabels(conn);
+ persistLegacyZones(conn);
createPlaceHolderNics(conn);
updateRemoteAccessVpn(conn);
updateSystemVmTemplates(conn);
@@ -235,7 +239,163 @@ public class Upgrade410to420 implements DbUpgrade {
}
}
}
-
+
+ private void persistLegacyZones(Connection conn) {
+ List<Long> listOfLegacyZones = new ArrayList<Long>();
+ PreparedStatement pstmt = null;
+ PreparedStatement clustersQuery = null;
+ PreparedStatement clusterDetailsQuery = null;
+ ResultSet rs = null;
+ ResultSet clusters = null;
+ ResultSet clusterDetails = null;
+ ResultSet dcInfo = null;
+ Long vmwareDcId = 1L;
+ Long zoneId;
+ Long clusterId;
+ String clusterHypervisorType;
+ boolean legacyZone;
+ boolean ignoreZone;
+ Long count;
+ String dcOfPreviousCluster = null;
+ String dcOfCurrentCluster = null;
+ String[] tokens;
+ String url;
+ String user;
+ String password;
+ String vc = "";
+ String dcName = "";
+ String guid;
+
+ try {
+ clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` where removed is NULL");
+ pstmt = conn.prepareStatement("select id from `cloud`.`data_center` where removed is NULL");
+ rs = pstmt.executeQuery();
+
+ while (rs.next()) {
+ zoneId = rs.getLong("id");
+ legacyZone = false;
+ ignoreZone = true;
+ count = 0L;
+ // Legacy zone term is meant only for VMware
+ // Legacy zone is a zone with atleast 2 clusters & with multiple DCs or VCs
+ clusters = clustersQuery.executeQuery();
+ if (!clusters.next()) {
+ continue; // Ignore the zone without any clusters
+ } else {
+ dcOfPreviousCluster = null;
+ dcOfCurrentCluster = null;
+ do {
+ clusterHypervisorType = clusters.getString("hypervisor_type");
+ clusterId = clusters.getLong("id");
+ if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
+ ignoreZone = false;
+ if (count > 0) {
+ dcOfPreviousCluster = dcOfCurrentCluster;
+ clusterDetailsQuery = conn.prepareStatement("select value,username,password from `cloud`.`cluster_details` where name='url' and cluster_id=?");
+ clusterDetailsQuery.setLong(1, clusterId);
+ clusterDetails = clusterDetailsQuery.executeQuery();
+ url = clusterDetails.getString("value");
+ tokens = url.split("/"); // url format - http://vcenter/dc/cluster
+ vc = tokens[2];
+ dcName = tokens[3];
+ dcOfCurrentCluster = dcName + "@" + vc;
+ if (!dcOfPreviousCluster.equals(dcOfCurrentCluster)) {
+ legacyZone = true;
+ s_logger.debug("Marking the zone " + zoneId + " as legacy zone.");
+ }
+ }
+ } else {
+ s_logger.debug("Ignoring zone " + zoneId + " with hypervisor type " + clusterHypervisorType);
+ break;
+ }
+ count++;
+ } while (clusters.next());
+ if (ignoreZone) {
+ continue; // Ignore the zone with hypervisors other than VMware
+ }
+ }
+ if (legacyZone) {
+ listOfLegacyZones.add(zoneId);
+ } else {
+ user = clusterDetails.getString("username");
+ password = clusterDetails.getString("password");
+ guid = dcName + "@" + vc;
+
+ pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vmware_data_center` (uuid, name, guid, vcenter_host, username, password) values(?, ?, ?, ?, ?, ?)");
+ pstmt.setString(1, UUID.randomUUID().toString());
+ pstmt.setString(2, dcName);
+ pstmt.setString(3, guid);
+ pstmt.setString(4, vc);
+ pstmt.setString(5, user);
+ pstmt.setString(6, password);
+ pstmt.executeUpdate();
+
+ pstmt = conn.prepareStatement("SELECT id FROM `cloud`.`vmware_data_center` where guid=?");
+ pstmt.setString(1, guid);
+ dcInfo = pstmt.executeQuery();
+ if(dcInfo.next()) {
+ vmwareDcId = dcInfo.getLong("id");
+ }
+
+ pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vmware_data_center_zone_map` (zone_id, vmware_data_center_id) values(?, ?)");
+ pstmt.setLong(1, zoneId);
+ pstmt.setLong(2, vmwareDcId);
+ pstmt.executeUpdate();
+ }
+ }
+ updateLegacyZones(conn, listOfLegacyZones);
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to load legacy zones into cloud.legacy_zones table.", e);
+ } finally {
+ try {
+ if (rs != null) {
+ rs.close();
+ }
+ if (pstmt != null) {
+ pstmt.close();
+ }
+ if (dcInfo != null) {
+ dcInfo.close();
+ }
+ if (clusters != null) {
+ clusters.close();
+ }
+ if (clusterDetails != null) {
+ clusterDetails.close();
+ }
+ if (clustersQuery != null) {
+ clustersQuery.close();
+ }
+ if (clusterDetailsQuery != null) {
+ clusterDetailsQuery.close();
+ }
+ } catch (SQLException e) {
+ }
+ }
+ }
+
+ private void updateLegacyZones(Connection conn, List<Long> zones) {
+ PreparedStatement legacyZonesQuery = null;
+ //Insert legacy zones into table for legacy zones.
+ try {
+ legacyZonesQuery = conn.prepareStatement("INSERT INTO `cloud`.`legacy_zones` (zone_id) VALUES (?)");
+ for(Long zoneId : zones) {
+ legacyZonesQuery.setLong(1, zoneId);
+ legacyZonesQuery.executeUpdate();
+ s_logger.debug("Inserted zone " + zoneId + " into cloud.legacyzones table");
+ }
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable add zones to cloud.legacyzones table.", e);
+ } finally {
+ try {
+ if (legacyZonesQuery != null) {
+ legacyZonesQuery.close();
+ }
+ } catch (SQLException e) {
+ }
+ }
+ }
+
private void createPlaceHolderNics(Connection conn) {
PreparedStatement pstmt = null;
ResultSet rs = null;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47d40880/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
index 246b477..b978cd9 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
@@ -3,14 +3,10 @@ package com.cloud.hypervisor.vmware;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import com.vmware.vim25.ManagedObjectReference;
-
public interface VmwareDatacenter extends Identity, InternalIdentity {
String getVmwareDatacenterName();
- ManagedObjectReference getVmwareDatacenterMor();
-
String getGuid();
String getVcenterHost();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47d40880/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
index aaeccc2..61a531a 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
@@ -11,7 +11,6 @@ import javax.persistence.Table;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.Encrypt;
-import com.vmware.vim25.ManagedObjectReference;
/**
* VmwareDatacenterVO contains information of Vmware Datacenter associated with a CloudStack zone.
@@ -76,17 +75,6 @@ public class VmwareDatacenterVO implements VmwareDatacenter {
}
@Override
- public ManagedObjectReference getVmwareDatacenterMor() {
- String morString = guid.split("@")[0];
- ManagedObjectReference mor = new ManagedObjectReference();
-
- mor.setType(morString.split(":")[0]);
- mor.setValue(morString.split(":")[1]);
-
- return mor;
- }
-
- @Override
public String getVcenterHost() {
return vCenterHost;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47d40880/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 3b94537..3e90312 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -985,8 +985,9 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
// Check if DC is already associated with another cloudstack deployment
// Get custom field property cloud.zone over this DC
- dcMor = dcMo.getMor();
- guid = dcMor.getType() + ":" + dcMor.getValue() + "@" + vCenterHost;
+ // dcMor = dcMo.getMor();
+ // guid = dcMor.getType() + ":" + dcMor.getValue() + "@" + vCenterHost;
+ guid = vmwareDcName + "@" + vCenterHost;
dcCustomFieldValue = dcMo.getCustomFieldValue(CustomFieldConstants.CLOUD_ZONE);
if (dcCustomFieldValue == null) {
[47/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-1963 New mapping model for CloudStack zone and Vmware datacenter
Plugin, API & DB changes
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cada3015
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cada3015
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cada3015
Branch: refs/heads/vmware-datamodel
Commit: cada30157e0f648beecebc6a4208142a83ae176b
Parents: 8f9a42e
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Fri May 3 22:38:57 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu May 9 23:22:58 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/nonossComponentContext.xml.in | 2 +
.../cloud/hypervisor/vmware/VmwareDatacenter.java | 23 ++
.../hypervisor/vmware/VmwareDatacenterService.java | 15 +
.../hypervisor/vmware/VmwareDatacenterVO.java | 155 ++++++++
.../hypervisor/vmware/VmwareDatacenterZoneMap.java | 13 +
.../vmware/VmwareDatacenterZoneMapVO.java | 77 ++++
.../hypervisor/vmware/VmwareServerDiscoverer.java | 80 ++++-
.../hypervisor/vmware/dao/VmwareDatacenterDao.java | 48 +++
.../vmware/dao/VmwareDatacenterDaoImpl.java | 87 +++++
.../vmware/dao/VmwareDatacenterZoneMapDao.java | 18 +
.../vmware/dao/VmwareDatacenterZoneMapDaoImpl.java | 61 +++
.../vmware/manager/VmwareManagerImpl.java | 302 ++++++++++++++-
.../api/command/admin/zone/AddVmwareDcCmd.java | 103 +++++
.../api/command/admin/zone/RemoveVmwareDcCmd.java | 80 ++++
.../api/response/VmwareDatacenterResponse.java | 34 ++
setup/db/db/schema-410to420.sql | 18 +
.../hypervisor/vmware/mo/CustomFieldConstants.java | 1 +
.../cloud/hypervisor/vmware/mo/DatacenterMO.java | 5 +
18 files changed, 1118 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index ff52457..6d97b9c 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -77,6 +77,8 @@
</bean>
<bean id="VmwareManager" class="com.cloud.hypervisor.vmware.manager.VmwareManagerImpl"/>
<bean id="vmwareContextFactory" class="com.cloud.hypervisor.vmware.resource.VmwareContextFactory" />
+ <bean id="VmwareDatacenterDaoImpl" class="com.cloud.hypervisor.vmware.dao.VmwareDatacenterDaoImpl" />
+ <bean id="VmwareDatacenterZoneMapDaoImpl" class="com.cloud.hypervisor.vmware.dao.VmwareDatacenterZoneMapDaoImpl" />
<!--
Nicira support components
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
new file mode 100644
index 0000000..246b477
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenter.java
@@ -0,0 +1,23 @@
+package com.cloud.hypervisor.vmware;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.vmware.vim25.ManagedObjectReference;
+
+public interface VmwareDatacenter extends Identity, InternalIdentity {
+
+ String getVmwareDatacenterName();
+
+ ManagedObjectReference getVmwareDatacenterMor();
+
+ String getGuid();
+
+ String getVcenterHost();
+
+ long getId();
+
+ String getPassword();
+
+ String getUser();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterService.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterService.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterService.java
new file mode 100644
index 0000000..f04b2b5
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterService.java
@@ -0,0 +1,15 @@
+package com.cloud.hypervisor.vmware;
+
+import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd;
+import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
+
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.utils.component.PluggableService;
+
+public interface VmwareDatacenterService extends PluggableService {
+
+ public VmwareDatacenterVO addVmwareDatacenter(AddVmwareDcCmd cmd) throws IllegalArgumentException, DiscoveryException, ResourceInUseException, Exception;
+
+ public boolean removeVmwareDatacenter(RemoveVmwareDcCmd cmd) throws IllegalArgumentException, ResourceInUseException, Exception;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
new file mode 100644
index 0000000..aaeccc2
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterVO.java
@@ -0,0 +1,155 @@
+package com.cloud.hypervisor.vmware;
+
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.db.Encrypt;
+import com.vmware.vim25.ManagedObjectReference;
+
+/**
+ * VmwareDatacenterVO contains information of Vmware Datacenter associated with a CloudStack zone.
+ */
+
+@Entity
+@Table(name="vmware_data_center")
+public class VmwareDatacenterVO implements VmwareDatacenter {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "guid")
+ private String guid;
+
+ @Column(name = "name")
+ private String name;
+
+ @Column(name = "vcenter_host")
+ private String vCenterHost;
+
+ @Column(name = "uuid")
+ private String uuid;
+
+ @Column(name = "username")
+ private String user;
+
+ @Encrypt
+ @Column(name = "password")
+ private String password;
+
+ @Override
+ public String getUuid() {
+ return uuid;
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public String getVmwareDatacenterName() {
+ return name;
+ }
+
+ @Override
+ public String getGuid() {
+ return guid;
+ }
+
+ @Override
+ public String getUser() {
+ return user;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ @Override
+ public ManagedObjectReference getVmwareDatacenterMor() {
+ String morString = guid.split("@")[0];
+ ManagedObjectReference mor = new ManagedObjectReference();
+
+ mor.setType(morString.split(":")[0]);
+ mor.setValue(morString.split(":")[1]);
+
+ return mor;
+ }
+
+ @Override
+ public String getVcenterHost() {
+ return vCenterHost;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ public void setGuid(String guid) {
+ this.guid = guid;
+ }
+
+ public void setVmwareDatacenterName(String name) {
+ this.name = name;
+ }
+
+ public void setVcenterHost(String vCenterHost) {
+ this.vCenterHost = vCenterHost;
+ }
+
+ public void setUser(String user) {
+ this.user = user; ;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ @Override
+ public String toString() {
+ return new StringBuilder("VmwareDatacenter[").append(guid).append("]").toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return NumbersUtil.hash(id);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof VmwareDatacenterVO) {
+ return ((VmwareDatacenterVO)obj).getId() == this.getId();
+ } else {
+ return false;
+ }
+ }
+
+ public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) {
+ this.uuid = UUID.randomUUID().toString();
+ this.name = name;
+ this.guid = guid;
+ this.vCenterHost = vCenterHost;
+ this.user = user;
+ this.password = password;
+ }
+
+ public VmwareDatacenterVO(long id, String guid, String name, String vCenterHost, String user, String password) {
+ this(guid, name, vCenterHost, user, password);
+ this.id = id;
+ }
+
+ public VmwareDatacenterVO() {
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMap.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMap.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMap.java
new file mode 100644
index 0000000..840c633
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMap.java
@@ -0,0 +1,13 @@
+package com.cloud.hypervisor.vmware;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+import com.cloud.org.Grouping;
+
+public interface VmwareDatacenterZoneMap extends Grouping, InternalIdentity {
+ public long getId();
+
+ public long getZoneId();
+
+ public long getVmwareDcId();
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java
new file mode 100644
index 0000000..e20386d
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareDatacenterZoneMapVO.java
@@ -0,0 +1,77 @@
+//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.vmware;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+
+//NOTE: This particular table is totally internal to the CS MS.
+//Do not ever include a uuid/guid field in this table. We just
+//need it map zone ids with VMware datacenter Ids.
+
+@Entity
+@Table(name="vmware_data_center_zone_map")
+public class VmwareDatacenterZoneMapVO implements VmwareDatacenterZoneMap {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="zone_id")
+ private long zoneId;
+
+ @Column(name="vmware_data_center_id")
+ private long vmwareDcId;
+
+ public VmwareDatacenterZoneMapVO(long zoneId, long vmwareDcId) {
+ this.zoneId = zoneId;
+ this.vmwareDcId = vmwareDcId;
+ }
+
+ public VmwareDatacenterZoneMapVO() {
+ // Do nothing.
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public long getZoneId() {
+ return zoneId;
+ }
+
+ @Override
+ public long getVmwareDcId() {
+ return vmwareDcId;
+ }
+
+ public void setZoneId(long zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public void setVsmId(long vmwareDcId) {
+ this.vmwareDcId = vmwareDcId;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
index 2f82b53..aec44b3 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java
@@ -30,6 +30,7 @@ import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.ApiConstants;
+import org.springframework.beans.NullValueInNestedPathException;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupRoutingCommand;
@@ -51,6 +52,8 @@ import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
+import com.cloud.hypervisor.vmware.dao.VmwareDatacenterDao;
+import com.cloud.hypervisor.vmware.dao.VmwareDatacenterZoneMapDao;
import com.cloud.hypervisor.vmware.manager.VmwareManager;
import com.cloud.hypervisor.vmware.mo.ClusterMO;
import com.cloud.hypervisor.vmware.mo.HostMO;
@@ -107,11 +110,16 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
@Inject
CiscoNexusVSMDeviceDao _nexusDao;
@Inject
- CiscoNexusVSMElementService _nexusElement;
+ CiscoNexusVSMElement _nexusElement;
@Inject
NetworkModel _netmgr;
@Inject
HypervisorCapabilitiesDao _hvCapabilitiesDao;
+ @Inject
+ VmwareDatacenterZoneMapDao _vmwareDcZoneMapDao;
+ @Inject
+ VmwareDatacenterDao _vmwareDcDao;
+
protected Map<String, String> _urlParams;
protected boolean useDVS = false;
protected boolean nexusDVS = false;
@@ -140,6 +148,18 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
return null;
}
+ Map<String, String> clusterDetails = _clusterDetailsDao.findDetails(clusterId);
+ boolean legacyZone = false;
+ //Check if NOT a legacy zone.
+ if (!legacyZone) {
+ String updatedInventoryPath = validateCluster(dcId, url, username, password);
+ if (url.getPath() != updatedInventoryPath) {
+ // If url from API doesn't specifiy DC then update url in database with DC assocaited with this zone.
+ clusterDetails.put("url", url.getScheme() + "://" + url.getHost() + updatedInventoryPath);
+ _clusterDetailsDao.persist(clusterId, clusterDetails);
+ }
+ }
+
List<HostVO> hosts = _resourceMgr.listAllHostsInCluster(clusterId);
if (hosts != null && hosts.size() > 0) {
int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(), hosts.get(0).getHypervisorVersion());
@@ -164,7 +184,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
VmwareTrafficLabel guestTrafficLabelObj = new VmwareTrafficLabel(TrafficType.Guest);
VmwareTrafficLabel publicTrafficLabelObj = new VmwareTrafficLabel(TrafficType.Public);
- Map<String, String> clusterDetails = _clusterDetailsDao.findDetails(clusterId);
DataCenterVO zone = _dcDao.findById(dcId);
NetworkType zoneType = zone.getNetworkType();
_readGlobalConfigParameters();
@@ -395,6 +414,63 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
}
}
+ private String validateCluster(Long dcId, URI url, String username, String password) throws DiscoveryException {
+ String msg;
+ long vmwareDcId;
+ VmwareDatacenterVO vmwareDc;
+ String vmwareDcNameFromDb;
+ String vmwareDcNameFromApi;
+ String vCenterHost;
+ String updatedInventoryPath = url.getPath();
+ String clusterName = null;
+
+ // Check if zone is associated with DC
+ VmwareDatacenterZoneMapVO vmwareDcZone = _vmwareDcZoneMapDao.findByZoneId(dcId);
+ if (vmwareDcZone == null) {
+ msg = "Zone " + dcId + " is not associated with any VMware DC yet. "
+ + "Please add VMware DC to this zone first and then try to add clusters.";
+ s_logger.error(msg);
+ throw new DiscoveryException(msg);
+ }
+
+ // Retrieve DC added to this zone from database
+ vmwareDcId = vmwareDcZone.getVmwareDcId();
+ vmwareDc = _vmwareDcDao.findById(vmwareDcId);
+ vmwareDcNameFromApi = vmwareDcNameFromDb = vmwareDc.getVmwareDatacenterName();
+ vCenterHost = vmwareDc.getVcenterHost();
+ String inventoryPath = url.getPath();
+
+ assert (inventoryPath != null);
+
+ String[] pathTokens = inventoryPath.split("/");
+ if (pathTokens.length == 2) {
+ // DC name is not present in url.
+ // Using DC name read from database.
+ clusterName = pathTokens[1];
+ updatedInventoryPath = "/" + vmwareDcNameFromDb + "/" + clusterName;
+ } else if (pathTokens.length == 3) {
+ vmwareDcNameFromApi = pathTokens[1];
+ clusterName = pathTokens[2];
+ }
+
+ if (!vCenterHost.equalsIgnoreCase(url.getHost())) {
+ msg = "This cluster " + clusterName + " belongs to vCenter " + url.getHost()
+ + " .But this zone is associated with VMware DC from vCenter " + vCenterHost
+ + ". Make sure the cluster being added belongs to vCenter " + vCenterHost
+ + " and DC " + vmwareDcNameFromDb;
+ s_logger.error(msg);
+ throw new DiscoveryException(msg);
+ } else if (!vmwareDcNameFromDb.equalsIgnoreCase(vmwareDcNameFromApi)) {
+ msg = "This cluster " + clusterName + " belongs to VMware DC " + vmwareDcNameFromApi
+ + " .But this zone is associated with VMware DC " + vmwareDcNameFromDb
+ + ". Make sure the cluster being added belongs to DC " + vmwareDcNameFromDb
+ + " in vCenter " + vCenterHost;
+ s_logger.error(msg);
+ throw new DiscoveryException(msg);
+ }
+ return updatedInventoryPath;
+ }
+
private boolean validateDiscoveredHosts(VmwareContext context,
ManagedObjectReference morCluster,
List<ManagedObjectReference> morHosts) throws Exception {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDao.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDao.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDao.java
new file mode 100644
index 0000000..e339604
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDao.java
@@ -0,0 +1,48 @@
+package com.cloud.hypervisor.vmware.dao;
+
+import java.util.List;
+
+import com.cloud.hypervisor.vmware.VmwareDatacenterVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface VmwareDatacenterDao extends GenericDao<VmwareDatacenterVO, Long> {
+
+ /**
+ * Return a VMware Datacenter given guid
+ * @param guid of VMware datacenter
+ * @return VmwareDatacenterVO for the VMware datacenter having the specified guid.
+ */
+ VmwareDatacenterVO getVmwareDatacenterByGuid(String guid);
+
+ /**
+ * Return a VMware Datacenter given name and vCenter host.
+ * For legacy zones multiple records will be present in the table.
+ * @param name of VMware datacenter
+ * @param vCenter host
+ * @return VmwareDatacenterVO for the VMware datacenter with given name and
+ * belonging to specified vCenter host.
+ */
+ List<VmwareDatacenterVO> getVmwareDatacenterByNameAndVcenter(String name, String vCenterHost);
+
+ /**
+ * Return a list of VMware Datacenter given name.
+ * @param name of Vmware datacenter
+ * @return list of VmwareDatacenterVO for VMware datacenters having the specified name.
+ */
+ List<VmwareDatacenterVO> listVmwareDatacenterByName(String name);
+
+ /**
+ * Return a list of VMware Datacenters belonging to specified vCenter
+ * @param vCenter Host
+ * @return list of VmwareDatacenterVO for all VMware datacenters belonging to
+ * specified vCenter
+ */
+ List<VmwareDatacenterVO> listVmwareDatacenterByVcenter(String vCenterHost);
+
+ /**
+ * Lists all associated VMware datacenter on the management server.
+ * @return list of VmwareDatacenterVO for all associated VMware datacenters
+ */
+ List<VmwareDatacenterVO> listAllVmwareDatacenters();
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDaoImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDaoImpl.java
new file mode 100644
index 0000000..b8fa715
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterDaoImpl.java
@@ -0,0 +1,87 @@
+package com.cloud.hypervisor.vmware.dao;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.hypervisor.vmware.VmwareDatacenterVO;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=VmwareDatacenterDao.class) @DB(txn=false)
+public class VmwareDatacenterDaoImpl extends GenericDaoBase<VmwareDatacenterVO, Long> implements VmwareDatacenterDao {
+ protected static final Logger s_logger = Logger.getLogger(VmwareDatacenterDaoImpl.class);
+
+ final SearchBuilder<VmwareDatacenterVO> nameSearch;
+ final SearchBuilder<VmwareDatacenterVO> guidSearch;
+ final SearchBuilder<VmwareDatacenterVO> vcSearch;
+ final SearchBuilder<VmwareDatacenterVO> nameVcSearch;
+ final SearchBuilder<VmwareDatacenterVO> fullTableSearch;
+
+ public VmwareDatacenterDaoImpl() {
+ super();
+
+ nameSearch = createSearchBuilder();
+ nameSearch.and("name", nameSearch.entity().getVmwareDatacenterName(), Op.EQ);
+ nameSearch.done();
+
+ nameVcSearch = createSearchBuilder();
+ nameVcSearch.and("name", nameVcSearch.entity().getVmwareDatacenterName(), Op.EQ);
+ nameVcSearch.and("vCenterHost", nameVcSearch.entity().getVcenterHost(), Op.EQ);
+ nameVcSearch.done();
+
+ vcSearch = createSearchBuilder();
+ vcSearch.and("vCenterHost", vcSearch.entity().getVcenterHost(), Op.EQ);
+ vcSearch.done();
+
+ guidSearch = createSearchBuilder();
+ guidSearch.and("guid", guidSearch.entity().getGuid(), Op.EQ);
+ guidSearch.done();
+
+ fullTableSearch = createSearchBuilder();
+ fullTableSearch.done();
+ }
+
+ @Override
+ public VmwareDatacenterVO getVmwareDatacenterByGuid(String guid) {
+ SearchCriteria<VmwareDatacenterVO> sc = guidSearch.create();
+ sc.setParameters("guid", guid);
+ return findOneBy(sc);
+ }
+
+ @Override
+ public List<VmwareDatacenterVO> getVmwareDatacenterByNameAndVcenter(String name, String vCenterHost) {
+ SearchCriteria<VmwareDatacenterVO> sc = guidSearch.create();
+ sc.setParameters("name", name);
+ sc.setParameters("vCenterHost", vCenterHost);
+ return search(sc, null);
+ }
+
+ @Override
+ public List<VmwareDatacenterVO> listVmwareDatacenterByName(String name) {
+ SearchCriteria<VmwareDatacenterVO> sc = guidSearch.create();
+ sc.setParameters("name", name);
+ return search(sc, null);
+ }
+
+ @Override
+ public List<VmwareDatacenterVO> listVmwareDatacenterByVcenter(String vCenterHost) {
+ SearchCriteria<VmwareDatacenterVO> sc = vcSearch.create();
+ sc.setParameters("vCenterHost", vCenterHost);
+ return search(sc, null);
+ }
+
+ @Override
+ public List<VmwareDatacenterVO> listAllVmwareDatacenters() {
+ SearchCriteria<VmwareDatacenterVO> sc = fullTableSearch.create();
+ return search(sc, null);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDao.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDao.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDao.java
new file mode 100644
index 0000000..dff9bb0
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDao.java
@@ -0,0 +1,18 @@
+package com.cloud.hypervisor.vmware.dao;
+
+import com.cloud.hypervisor.vmware.VmwareDatacenterZoneMapVO;
+import com.cloud.utils.db.GenericDao;
+
+public interface VmwareDatacenterZoneMapDao extends GenericDao<VmwareDatacenterZoneMapVO, Long> {
+ /**
+ * @param id of zone
+ * @return map object of VMware datacenter & zone
+ */
+ VmwareDatacenterZoneMapVO findByZoneId(long zoneId);
+
+ /**
+ * @param id of VMware datacenter
+ * @return map object of VMware datacenter & zone
+ */
+ VmwareDatacenterZoneMapVO findByVmwareDcId(long vmwareDcId);
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDaoImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDaoImpl.java
new file mode 100644
index 0000000..1c13269
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/dao/VmwareDatacenterZoneMapDaoImpl.java
@@ -0,0 +1,61 @@
+//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.vmware.dao;
+
+import javax.ejb.Local;
+
+import org.springframework.stereotype.Component;
+
+import com.cloud.hypervisor.vmware.VmwareDatacenterZoneMapVO;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+import com.cloud.utils.db.SearchCriteria.Op;
+
+@Component
+@Local(value=VmwareDatacenterZoneMapDao.class)
+public class VmwareDatacenterZoneMapDaoImpl extends GenericDaoBase<VmwareDatacenterZoneMapVO, Long>
+ implements VmwareDatacenterZoneMapDao {
+
+ protected final SearchBuilder<VmwareDatacenterZoneMapVO> zoneSearch;
+ protected final SearchBuilder<VmwareDatacenterZoneMapVO> vmwareDcSearch;
+
+ public VmwareDatacenterZoneMapDaoImpl() {
+ zoneSearch = createSearchBuilder();
+ zoneSearch.and("zoneId", zoneSearch.entity().getZoneId(), Op.EQ);
+ zoneSearch.done();
+
+ vmwareDcSearch = createSearchBuilder();
+ vmwareDcSearch.and("vmwareDcId", vmwareDcSearch.entity().getVmwareDcId(), Op.EQ);
+ vmwareDcSearch.done();
+ }
+
+ @Override
+ public VmwareDatacenterZoneMapVO findByZoneId(long zoneId) {
+ SearchCriteria<VmwareDatacenterZoneMapVO> sc = zoneSearch.create();
+ sc.setParameters("zoneId", zoneId);
+ return findOneBy(sc);
+ }
+
+ @Override
+ public VmwareDatacenterZoneMapVO findByVmwareDcId(long vmwareDcId) {
+ SearchCriteria<VmwareDatacenterZoneMapVO> sc = vmwareDcSearch.create();
+ sc.setParameters("vmwareDcId", vmwareDcId);
+ return findOneBy(sc);
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 9f260f1..3b94537 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -21,6 +21,7 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -35,6 +36,8 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.api.command.admin.zone.AddVmwareDcCmd;
+import org.apache.cloudstack.api.command.admin.zone.RemoveVmwareDcCmd;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
@@ -51,15 +54,28 @@ import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.ClusterDetailsDao;
import com.cloud.dc.ClusterVO;
import com.cloud.dc.ClusterVSMMapVO;
+import com.cloud.dc.DataCenterVO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.ClusterVSMMapDao;
+import com.cloud.dc.dao.DataCenterDao;
import com.cloud.exception.DiscoveredWithErrorException;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceInUseException;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
import com.cloud.hypervisor.vmware.VmwareCleanupMaid;
+import com.cloud.hypervisor.vmware.VmwareDatacenterService;
+import com.cloud.hypervisor.vmware.VmwareDatacenterVO;
+import com.cloud.hypervisor.vmware.VmwareDatacenterZoneMapVO;
+import com.cloud.hypervisor.vmware.dao.VmwareDatacenterDao;
+import com.cloud.hypervisor.vmware.dao.VmwareDatacenterZoneMapDao;
+import com.cloud.hypervisor.vmware.mo.CustomFieldConstants;
+import com.cloud.hypervisor.vmware.mo.CustomFieldsManagerMO;
+import com.cloud.hypervisor.vmware.mo.DatacenterMO;
import com.cloud.hypervisor.vmware.mo.DiskControllerType;
import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
import com.cloud.hypervisor.vmware.mo.HostMO;
@@ -68,8 +84,10 @@ import com.cloud.hypervisor.vmware.mo.TaskMO;
import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType;
import com.cloud.hypervisor.vmware.mo.VmwareHostType;
import com.cloud.utils.ssh.SshHelper;
+import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
import com.cloud.hypervisor.vmware.util.VmwareClient;
import com.cloud.hypervisor.vmware.util.VmwareContext;
+import com.cloud.hypervisor.vmware.util.VmwareHelper;
import com.cloud.network.CiscoNexusVSMDeviceVO;
import com.cloud.network.NetworkModel;
import com.cloud.network.dao.CiscoNexusVSMDeviceDao;
@@ -83,11 +101,13 @@ import com.cloud.storage.secondary.SecondaryStorageVmManager;
import com.cloud.utils.FileUtil;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
+import com.cloud.utils.UriUtils;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.concurrency.NamedThreadFactory;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GlobalLock;
+import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.script.Script;
import com.cloud.utils.ssh.SshHelper;
@@ -98,8 +118,8 @@ import com.vmware.vim25.HostConnectSpec;
import com.vmware.vim25.ManagedObjectReference;
-@Local(value = {VmwareManager.class})
-public class VmwareManagerImpl extends ManagerBase implements VmwareManager, VmwareStorageMount, Listener {
+@Local(value = {VmwareManager.class, VmwareDatacenterService.class})
+public class VmwareManagerImpl extends ManagerBase implements VmwareManager, VmwareStorageMount, Listener, VmwareDatacenterService {
private static final Logger s_logger = Logger.getLogger(VmwareManagerImpl.class);
private static final int STARTUP_DELAY = 60000; // 60 seconds
@@ -124,6 +144,9 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
@Inject ConfigurationDao _configDao;
@Inject ConfigurationServer _configServer;
@Inject HypervisorCapabilitiesDao _hvCapabilitiesDao;
+ @Inject DataCenterDao _dcDao;
+ @Inject VmwareDatacenterDao _vmwareDcDao;
+ @Inject VmwareDatacenterZoneMapDao _vmwareDcZoneMapDao;
String _mountParent;
StorageLayer _storage;
@@ -865,4 +888,279 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
public String getRootDiskController() {
return _rootDiskController;
}
+
+ @Override
+ public List<Class<?>> getCommands() {
+ List<Class<?>> cmdList = new ArrayList<Class<?>>();
+ cmdList.add(AddVmwareDcCmd.class);
+ cmdList.add(RemoveVmwareDcCmd.class);
+ return cmdList;
+ }
+
+ @Override
+ @DB
+ public VmwareDatacenterVO addVmwareDatacenter(AddVmwareDcCmd cmd) throws Exception {
+ VmwareDatacenterVO vmwareDc = null;
+ Long zoneId = cmd.getZoneId();
+ String url = cmd.getUrl();
+ String userName = cmd.getUsername();
+ String password = cmd.getPassword();
+ String vmwareDcName = cmd.getName();
+
+ // Zone validation
+ validateZone(zoneId, "add VMware datacenter to zone");
+
+ // Check if the zone exists in the system
+ // If no, throw invalid param value exception
+ DataCenterVO zone = _dcDao.findById(zoneId);
+ if (zone == null) {
+ InvalidParameterValueException ex = new InvalidParameterValueException(
+ "Can't find zone by the id specified");
+ ex.addProxyObject(zone, zoneId, "dcId");
+ throw ex;
+ }
+
+ VmwareDatacenterZoneMapVO vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
+ // Check if zone is associated with VMware DC
+ if (vmwareDcZoneMap != null) {
+ throw new CloudRuntimeException("Zone " + zoneId + " is already associated with a VMware datacenter.");
+ }
+
+ // Check if zone has resources? - For now look for clusters
+ // If yes, throw resource in use execption
+ List<ClusterVO> clusters = _clusterDao.listByZoneId(zoneId);
+ if (clusters != null) {
+ try {
+ if (clusters.size() > 0) {
+ throw new ResourceInUseException("Zone has one or more clusters."
+ + " Can't add VMware datacenter to zone which already has clusters.");
+ }}catch(Throwable t) {
+ s_logger.error(t);
+ }
+ }
+
+ // Validate url and get uri
+ URI uri = getUri(url);
+
+ // Validate username and password and DC name
+ if (userName == null) {
+ throw new InvalidParameterValueException("Invalid parameter username.");
+ }
+
+ if (password == null) {
+ throw new InvalidParameterValueException("Invalid parameter password.");
+ }
+
+ if (vmwareDcName == null) {
+ throw new InvalidParameterValueException("Invalid parameter name. Please provide valid VMware datacenter name.");
+ }
+
+ // Check if DC is already part of zone
+ // In that case vmware_data_center table should have the DC
+ String vCenterHost = uri.getHost();
+ List<VmwareDatacenterVO> vmwareDcs = _vmwareDcDao.getVmwareDatacenterByNameAndVcenter(vmwareDcName, vCenterHost);
+ if (vmwareDcs != null && vmwareDcs.size() != 0) {
+ throw new ResourceInUseException("This DC is already part of other CloudStack zone(s). Cannot add this DC to more zones.");
+ }
+
+ VmwareContext context = null;
+ DatacenterMO dcMo = null;
+ String dcCustomFieldValue;
+ boolean addDcCustomFieldDef = false;
+ boolean dcInUse = false;
+ String guid;
+ ManagedObjectReference dcMor;
+ try {
+ context = VmwareContextFactory.create(vCenterHost, userName, password);
+
+ // Check if DC exists on vCenter
+ try {
+ dcMo = new DatacenterMO(context, vmwareDcName);
+ } catch(Throwable t) {
+ String msg = "Unable to find DC " + vmwareDcName + " in vCenter " + vCenterHost;
+ s_logger.error(msg);
+ throw new DiscoveryException(msg);
+ }
+ assert (dcMo != null);
+
+ // Check if DC is already associated with another cloudstack deployment
+ // Get custom field property cloud.zone over this DC
+ dcMor = dcMo.getMor();
+ guid = dcMor.getType() + ":" + dcMor.getValue() + "@" + vCenterHost;
+
+ dcCustomFieldValue = dcMo.getCustomFieldValue(CustomFieldConstants.CLOUD_ZONE);
+ if (dcCustomFieldValue == null) {
+ addDcCustomFieldDef = true;
+ }
+ dcInUse = Boolean.parseBoolean(dcCustomFieldValue);
+ if (dcInUse) {
+ throw new ResourceInUseException("This DC is being managed by other CloudStack deployment. Cannot add this DC to zone.");
+ }
+
+ // Add DC to database into vmware_data_center table
+ vmwareDc = new VmwareDatacenterVO(guid, vmwareDcName, vCenterHost, userName, password);
+ Transaction txn = Transaction.currentTxn();
+ try {
+ txn.start();
+ vmwareDc = _vmwareDcDao.persist(vmwareDc);
+ txn.commit();
+ } catch (Exception e) {
+ txn.rollback();
+ s_logger.error("Failed to persist VMware datacenter details to database. Exception: " + e.getMessage());
+ throw new CloudRuntimeException(e.getMessage());
+ }
+
+ // Map zone with vmware datacenter
+ vmwareDcZoneMap = new VmwareDatacenterZoneMapVO(zoneId, vmwareDc.getId());
+
+ txn = Transaction.currentTxn();
+ try {
+ txn.start();
+ vmwareDcZoneMap = _vmwareDcZoneMapDao.persist(vmwareDcZoneMap);
+ txn.commit();
+ } catch (Exception e) {
+ txn.rollback();
+ s_logger.error("Failed to associate VMware datacenter with zone " + zoneId + ". Exception: " + e.getMessage());
+ // Removing VMware datacenter from vmware_data_center table because association with zone failed.
+ _vmwareDcDao.remove(vmwareDcZoneMap.getId());
+ throw new CloudRuntimeException(e.getMessage());
+ }
+
+ // Set custom field for this DC
+ if (addDcCustomFieldDef) {
+ dcMo.ensureCustomFieldDef(CustomFieldConstants.CLOUD_ZONE);
+ }
+ dcMo.setCustomFieldValue(CustomFieldConstants.CLOUD_ZONE, "true");
+
+ } catch (Exception e) {
+ String msg = "VMware DC discovery failed due to : " + VmwareHelper.getExceptionMessage(e);
+ s_logger.error(msg);
+ throw new CloudRuntimeException(msg);
+ } finally {
+ if (context != null)
+ context.close();
+ context = null;
+ }
+ return vmwareDc;
+ }
+
+ @Override
+ public boolean removeVmwareDatacenter(RemoveVmwareDcCmd cmd) throws Exception {
+ Long zoneId = cmd.getZoneId();
+ // Validate zone
+ validateZone(zoneId, "remove VMware datacenter from zone");
+
+ // Get DC associated with this zone
+ VmwareDatacenterZoneMapVO vmwareDcZoneMap;
+ VmwareDatacenterVO vmwareDatacenter;
+ String vmwareDcName;
+ long vmwareDcId;
+ String vCenterHost;
+ String userName;
+ String password;
+ DatacenterMO dcMo = null;
+ Transaction txn;
+
+ vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
+ // Check if zone is associated with VMware DC
+ if (vmwareDcZoneMap == null) {
+ throw new CloudRuntimeException("Zone " + zoneId + " is not associated with any VMware datacenter.");
+ }
+
+ vmwareDcId = vmwareDcZoneMap.getVmwareDcId();
+ vmwareDatacenter = _vmwareDcDao.findById(vmwareDcId);
+ vmwareDcName = vmwareDatacenter.getVmwareDatacenterName();
+ vCenterHost = vmwareDatacenter.getVcenterHost();
+ userName = vmwareDatacenter.getUser();
+ password = vmwareDatacenter.getPassword();
+ txn = Transaction.currentTxn();
+ try {
+ txn.start();
+ // Remove the VMware datacenter entry in table vmware_data_center
+ _vmwareDcDao.remove(vmwareDcId);
+ // Remove the map entry in table vmware_data_center_zone_map
+ _vmwareDcZoneMapDao.remove(vmwareDcZoneMap.getId());
+ txn.commit();
+ } catch (Exception e) {
+ s_logger.info("Caught exception when trying to delete VMware datacenter record.." + e.getMessage());
+ throw new CloudRuntimeException("Failed to delete VMware datacenter ");
+ }
+
+ // Construct context
+ VmwareContext context = null;
+ try {
+ context = VmwareContextFactory.create(vCenterHost, userName, password);
+
+ // Check if DC exists on vCenter
+ try {
+ dcMo = new DatacenterMO(context, vmwareDcName);
+ } catch(Throwable t) {
+ String msg = "able to find DC " + vmwareDcName + " in vCenter " + vCenterHost;
+ s_logger.error(msg);
+ throw new DiscoveryException(msg);
+ }
+
+ assert (dcMo != null);
+
+ // Reset custom field property cloud.zone over this DC
+ dcMo.setCustomFieldValue(CustomFieldConstants.CLOUD_ZONE, "false");
+ s_logger.info("Sucessfully reset custom field property cloud.zone over DC " + vmwareDcName);
+ } catch (Exception e) {
+ String msg = "Unable to reset custom field property cloud.zone over DC " + vmwareDcName
+ + " due to : " + VmwareHelper.getExceptionMessage(e);
+ s_logger.error(msg);
+ throw new CloudRuntimeException(msg);
+ } finally {
+ if (context != null)
+ context.close();
+ context = null;
+ }
+ return true;
+ }
+
+ private void validateZone(Long zoneId, String errStr) throws ResourceInUseException {
+ // Check if zone with specified id exists
+ DataCenterVO zone = _dcDao.findById(zoneId);
+ if (zone == null) {
+ InvalidParameterValueException ex = new InvalidParameterValueException(
+ "Can't find zone by the id specified");
+ ex.addProxyObject(zone, zoneId, "dcId");
+ throw ex;
+ }
+
+ // Check if zone has resources? - For now look for clusters
+ List<ClusterVO> clusters = _clusterDao.listByZoneId(zoneId);
+ if(clusters != null && clusters.size() != 0) {
+ throw new ResourceInUseException("Zone has one or more clusters."
+ + " Can't " + errStr + " which already has clusters.");
+ }
+ }
+
+ private URI getUri(String url) throws InvalidParameterValueException {
+ if (url == null) {
+ throw new InvalidParameterValueException("Invalid url.");
+ }
+
+ URI uri = null;
+ try {
+ uri = new URI(UriUtils.encodeURIComponent(url));
+ if (uri.getScheme() == null) {
+ throw new InvalidParameterValueException(
+ "uri.scheme is null " + url
+ + ", add http:// as a prefix");
+ } else if (uri.getScheme().equalsIgnoreCase("http")) {
+ if (uri.getHost() == null
+ || uri.getHost().equalsIgnoreCase("")
+ || uri.getPath() == null
+ || uri.getPath().equalsIgnoreCase("")) {
+ throw new InvalidParameterValueException(
+ "Your host and/or path is wrong. Make sure it's of the format http://hostname/path");
+ }
+ }
+ } catch (URISyntaxException e) {
+ throw new InvalidParameterValueException(url
+ + " is not a valid uri");
+ }
+ return uri;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java
new file mode 100644
index 0000000..3d9101b
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/AddVmwareDcCmd.java
@@ -0,0 +1,103 @@
+package org.apache.cloudstack.api.command.admin.zone;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.VmwareDatacenterResponse;
+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.hypervisor.vmware.VmwareDatacenterService;
+import com.cloud.hypervisor.vmware.VmwareDatacenterVO;
+import com.cloud.user.Account;
+
+@APICommand(name = "addVmwareDc", description="Adds a VMware datacenter to specified zone", responseObject=VmwareDatacenterResponse.class)
+public class AddVmwareDcCmd extends BaseCmd {
+
+ @Inject public VmwareDatacenterService _vmwareDatacenterService;
+
+ public static final Logger s_logger = Logger.getLogger(AddVmwareDcCmd.class.getName());
+
+ private static final String s_name = "addvmwaredcresponse";
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of VMware datacenter to be added to specified zone.")
+ private String name;
+
+ @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=false, description="The URL of vCenter.")
+ private String url;
+
+ @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=false, description="The Username required to connect to resource.")
+ private String username;
+
+ @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required=false, description="The password for specified username.")
+ private String password;
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, required=true, description="The Zone ID.")
+ private Long zoneId;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ try {
+ VmwareDatacenterResponse response = new VmwareDatacenterResponse();
+ VmwareDatacenterVO result = _vmwareDatacenterService.addVmwareDatacenter(this);
+ if (result != null){
+ response.setId(result.getUuid());
+ response.setName(result.getVmwareDatacenterName());
+ response.setResponseName(getCommandName());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add VMware Datacenter to zone.");
+ }
+ this.setResponseObject(response);
+ } catch (DiscoveryException ex) {
+ s_logger.warn("Exception: ", ex);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ } catch (ResourceInUseException ex) {
+ s_logger.warn("Exception: ", ex);
+ ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ for (String proxyObj : ex.getIdProxyList()) {
+ e.addProxyObject(proxyObj);
+ }
+ throw e;
+ } catch (IllegalArgumentException ex) {
+ throw new IllegalArgumentException(ex.getMessage());
+ } catch (Exception e) {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java
new file mode 100644
index 0000000..cf54698
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/command/admin/zone/RemoveVmwareDcCmd.java
@@ -0,0 +1,80 @@
+package org.apache.cloudstack.api.command.admin.zone;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.BaseCmd.CommandType;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.DiscoveryException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.hypervisor.vmware.VmwareDatacenterService;
+import com.cloud.network.element.CiscoNexusVSMElementService;
+import com.cloud.user.Account;
+
+@APICommand(name = "removeVmwareDc", responseObject=SuccessResponse.class, description="Remove a VMware datacenter from a zone.")
+public class RemoveVmwareDcCmd extends BaseCmd {
+
+ @Inject public VmwareDatacenterService _vmwareDatacenterService;
+
+ public static final Logger s_logger = Logger.getLogger(AddVmwareDcCmd.class.getName());
+
+ private static final String s_name = "removevmwaredcresponse";
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, required=true,
+ description="The id of Zone from which VMware datacenter has to be removed.")
+
+ private Long zoneId;
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ @Override
+ public void execute() {
+ SuccessResponse response = new SuccessResponse();
+ try {
+ boolean result = _vmwareDatacenterService.removeVmwareDatacenter(this);
+ if (result) {
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove VMware datacenter from zone");
+ }
+ } catch (ResourceInUseException ex) {
+ s_logger.warn("The zone has one or more resources (like cluster), hence not able to remove VMware datacenter from zone."
+ + " Please remove all resource from zone, and retry. Exception: ", ex);
+ ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
+ for (String proxyObj : ex.getIdProxyList()) {
+ e.addProxyObject(proxyObj);
+ }
+ throw e;
+ } catch (IllegalArgumentException ex) {
+ throw new IllegalArgumentException(ex.getMessage());
+ } catch (Exception e) {
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java
new file mode 100644
index 0000000..151d037
--- /dev/null
+++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/api/response/VmwareDatacenterResponse.java
@@ -0,0 +1,34 @@
+package org.apache.cloudstack.api.response;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.EntityReference;
+
+import com.cloud.hypervisor.vmware.VmwareDatacenter;
+import com.cloud.serializer.Param;
+import com.google.gson.annotations.SerializedName;
+
+@EntityReference(value = VmwareDatacenter.class)
+public class VmwareDatacenterResponse extends BaseResponse {
+ @SerializedName(ApiConstants.ID) @Param(description="The VMware Datacenter ID")
+ private String id;
+
+ @SerializedName(ApiConstants.NAME) @Param(description="The VMware Datacenter name")
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index c8ac1ec..9183754 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -915,6 +915,24 @@ CREATE TABLE `cloud`.`network_asa1000v_map` (
CONSTRAINT `fk_network_asa1000v_map__asa1000v_id` FOREIGN KEY (`asa1000v_id`) REFERENCES `external_cisco_asa1000v_devices`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE `cloud`.`vmware_data_center` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `uuid` varchar(255) UNIQUE,
+ `name` varchar(255) NOT NULL COMMENT 'Name of VMware datacenter',
+ `guid` varchar(255) NOT NULL UNIQUE COMMENT 'id of VMware datacenter',
+ `vcenter_host` varchar(255) NOT NULL COMMENT 'vCenter host containing this VMware datacenter',
+ `username` varchar(255) NOT NULL COMMENT 'Name of vCenter host user',
+ `password` varchar(255) NOT NULL COMMENT 'Password of vCenter host user',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `cloud`.`vmware_data_center_zone_map` (
+ `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
+ `zone_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of CloudStack zone',
+ `vmware_data_center_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of VMware datacenter',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_vmware_data_center_zone_map__vmware_data_center_id` FOREIGN KEY (`vmware_data_center_id`) REFERENCES `vmware_data_center`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldConstants.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldConstants.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldConstants.java
index 4cd5f9b..11bc157 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldConstants.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/CustomFieldConstants.java
@@ -21,4 +21,5 @@ public interface CustomFieldConstants {
public final static String CLOUD_GC = "cloud.gc";
public final static String CLOUD_GC_DVP = "cloud.gc.dvp";
public final static String CLOUD_NIC_MASK = "cloud.nic.mask";
+ public final static String CLOUD_ZONE = "cloud.zone";
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cada3015/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
index 0a3e20b..cabb60a 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatacenterMO.java
@@ -488,4 +488,9 @@ public class DatacenterMO extends BaseMO {
dvSwitchMor = _context.getVimClient().getDecendentMoRef(networkFolderMor, "VmwareDistributedVirtualSwitch", dvSwitchName);
return dvSwitchMor;
}
+
+ public boolean ensureCustomFieldDef(String fieldName) throws Exception {
+ CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(_context, _context.getServiceContent().getCustomFieldsManager());
+ return cfmMo.ensureCustomFieldDef("Datacenter", fieldName) > 0;
+ }
}
[34/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2171:Unable to Create a VM In the VMware Setup with the latest Master
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/76e8afa2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/76e8afa2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/76e8afa2
Branch: refs/heads/vmware-datamodel
Commit: 76e8afa24fdbdf7d3132c5c5b90320f19bf7ddcb
Parents: 53e4965
Author: Pranav Saxena <pr...@citrix.com>
Authored: Wed May 8 17:05:36 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Wed May 8 17:05:36 2013 +0530
----------------------------------------------------------------------
ui/scripts/system.js | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/76e8afa2/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index dc09ea8..2746e0d 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -1018,12 +1018,7 @@
dataType: "json",
success: function(json) {
var jobId = json.updatephysicalnetworkresponse.jobid;
-
- var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest');
-
- updateTrafficLabels(trafficType, args.data, function() {
args.response.success({ _custom: { jobId: jobId }});
- });
},
error:function(json){
[31/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2363: fixing the scripts to conform with lib changes
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/1fe50a8d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1fe50a8d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1fe50a8d
Branch: refs/heads/vmware-datamodel
Commit: 1fe50a8d6778e37fd0784919538fdc7afccfb4c8
Parents: 731cc43
Author: Talluri <Sr...@citrix.com>
Authored: Wed May 8 04:43:31 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:26:43 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_project_configs.py | 104 +++++++-------
test/integration/component/test_project_limits.py | 10 +-
test/integration/component/test_projects.py | 50 ++++----
test/integration/smoke/test_network.py | 12 +-
test/integration/smoke/test_templates.py | 8 +-
5 files changed, 92 insertions(+), 92 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1fe50a8d/test/integration/component/test_project_configs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py
index fa2ee0a..33409ac 100644
--- a/test/integration/component/test_project_configs.py
+++ b/test/integration/component/test_project_configs.py
@@ -242,8 +242,8 @@ class TestUserProjectCreation(cloudstackTestCase):
project = Project.create(
self.apiclient,
self.services["project"],
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
# Cleanup created project at end of test
self.cleanup.append(project)
@@ -409,11 +409,11 @@ class TestProjectCreationNegative(cloudstackTestCase):
project = Project.create(
self.apiclient,
self.services["project"],
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.debug("Project creation with domain user: %s failed" %
- self.user.account.name)
+ self.user.name)
return
@@ -531,21 +531,21 @@ class TestProjectInviteRequired(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -684,22 +684,22 @@ class TestProjectInviteRequiredTrue(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -853,22 +853,22 @@ class TestProjectInviteTimeout(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -894,18 +894,18 @@ class TestProjectInviteTimeout(cloudstackTestCase):
self.apiclient,
projectid=project.id,
accept=True,
- account=self.user.account.name
+ account=self.user.name
)
self.debug(
"Accepting project invitation for project: %s user: %s" % (
project.name,
- self.user.account.name
+ self.user.name
))
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
@@ -979,22 +979,22 @@ class TestProjectInviteTimeout(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1025,18 +1025,18 @@ class TestProjectInviteTimeout(cloudstackTestCase):
self.apiclient,
projectid=project.id,
accept=True,
- account=self.user.account.name
+ account=self.user.name
)
self.debug(
"Accepting invitation after expiry project: %s user: %s" % (
project.name,
- self.user.account.name
+ self.user.name
))
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
@@ -1110,22 +1110,22 @@ class TestProjectInviteTimeout(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1151,22 +1151,22 @@ class TestProjectInviteTimeout(cloudstackTestCase):
time.sleep(int(self.config.value) * 2)
self.debug("Adding %s user again to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1239,22 +1239,22 @@ class TestProjectInviteTimeout(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = ProjectInvitation.list(
self.apiclient,
state='Pending',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1279,18 +1279,18 @@ class TestProjectInviteTimeout(cloudstackTestCase):
self.apiclient,
projectid=project.id,
accept=False,
- account=self.user.account.name
+ account=self.user.name
)
self.debug(
"Declining invitation for project: %s user: %s" % (
project.name,
- self.user.account.name
+ self.user.name
))
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
accounts_reponse,
@@ -1367,19 +1367,19 @@ class TestProjectInviteTimeout(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding user with email: %s to project: %s" % (
- self.user.account.email,
+ self.user.email,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- email=self.user.account.user[0].email
+ email=self.user.user[0].email
)
# Fetch the latest mail sent to user
mail_content = fetch_latest_mail(
self.services["mail_account"],
- from_mail=self.user.account.user[0].email
+ from_mail=self.user.user[0].email
)
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1fe50a8d/test/integration/component/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index 4a8b9d4..c5d2d6d 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -429,14 +429,14 @@ class TestProjectLimits(cloudstackTestCase):
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
+ self.user.name,
)
# Get the resource limits for domain
@@ -459,14 +459,14 @@ class TestProjectLimits(cloudstackTestCase):
#with self.assertRaises(Exception):
self.debug(
"Attempting to update resource limit by user: %s" % (
- self.user.account.name
+ self.user.name
))
# Update project resource limits to 3
update_resource_limit(
self.apiclient,
resource.resourcetype,
- account=self.user.account.name,
- domainid=self.user.account.domainid,
+ account=self.user.name,
+ domainid=self.user.domainid,
max=3,
projectid=project.id
)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1fe50a8d/test/integration/component/test_projects.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py
index 9fa6075..ccfc8ef 100644
--- a/test/integration/component/test_projects.py
+++ b/test/integration/component/test_projects.py
@@ -248,15 +248,15 @@ class TestMultipleProjectCreation(cloudstackTestCase):
# Add user to the project
project_1.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project_1.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -280,15 +280,15 @@ class TestMultipleProjectCreation(cloudstackTestCase):
# Add user to the project
project_2.addAccount(
self.apiclient,
- self.user.account.name,
- self.user.account.email
+ self.user.name,
+ self.user.email
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project_2.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -432,15 +432,15 @@ class TestCrossDomainAccountAdd(cloudstackTestCase):
)
self.debug("Adding user: %s from domain: %s to project: %s" % (
- self.user.account.name,
- self.user.account.domainid,
+ self.user.name,
+ self.user.domainid,
project.id
))
with self.assertRaises(Exception):
# Add user to the project from different domain
project.addAccount(
self.apiclient,
- self.user.account.name
+ self.user.name
)
self.debug("User add to project failed!")
return
@@ -938,7 +938,7 @@ class TestProjectOwners(cloudstackTestCase):
)
self.cleanup.append(self.user)
self.debug("Created account with ID: %s" %
- self.user.account.name)
+ self.user.name)
list_projects_reponse = Project.list(
self.apiclient,
@@ -1033,20 +1033,20 @@ class TestProjectOwners(cloudstackTestCase):
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
+ self.user.name,
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1068,19 +1068,19 @@ class TestProjectOwners(cloudstackTestCase):
)
self.debug("Updating project with new Admin: %s" %
- self.user.account.name)
+ self.user.name)
# Update the project with new admin
project.update(
self.apiclient,
- account=self.user.account.name
+ account=self.user.name
)
# listProjectAccount to verify the user is new admin of the project
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.debug(accounts_reponse)
self.assertEqual(
@@ -1248,20 +1248,20 @@ class TestProjectResources(cloudstackTestCase):
"Check project name from list response"
)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name,
+ self.user.name,
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1370,20 +1370,20 @@ class TestProjectResources(cloudstackTestCase):
)
self.cleanup.append(self.user)
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
project.name
))
# Add user to the project
project.addAccount(
self.apiclient,
- self.user.account.name
+ self.user.name
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
@@ -1543,20 +1543,20 @@ class TestProjectSuspendActivate(cloudstackTestCase):
# account deletion.
self.debug("Adding %s user to project: %s" % (
- self.user.account.name,
+ self.user.name,
self.project.name
))
# Add user to the project
self.project.addAccount(
self.apiclient,
- self.user.account.name,
+ self.user.name,
)
# listProjectAccount to verify the user is added to project or not
accounts_reponse = Project.listAccounts(
self.apiclient,
projectid=self.project.id,
- account=self.user.account.name,
+ account=self.user.name,
)
self.assertEqual(
isinstance(accounts_reponse, list),
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1fe50a8d/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 322e8c2..4a7bb44 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -151,8 +151,8 @@ class TestPublicIP(cloudstackTestCase):
cls.user_network = Network.create(
cls.api_client,
cls.services["network"],
- cls.user.account.name,
- cls.user.account.domainid
+ cls.user.name,
+ cls.user.domainid
)
# Create Source NAT IP addresses
@@ -164,9 +164,9 @@ class TestPublicIP(cloudstackTestCase):
)
user_src_nat_ip = PublicIPAddress.create(
cls.api_client,
- cls.user.account.name,
+ cls.user.name,
cls.zone.id,
- cls.user.account.domainid
+ cls.user.domainid
)
cls._cleanup = [
cls.account_network,
@@ -248,9 +248,9 @@ class TestPublicIP(cloudstackTestCase):
ip_address = PublicIPAddress.create(
self.apiclient,
- self.user.account.name,
+ self.user.name,
self.zone.id,
- self.user.account.domainid
+ self.user.domainid
)
#listPublicIpAddresses should return newly created public IP
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1fe50a8d/test/integration/smoke/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_templates.py b/test/integration/smoke/test_templates.py
index b2ad4ca..382f56f 100644
--- a/test/integration/smoke/test_templates.py
+++ b/test/integration/smoke/test_templates.py
@@ -752,8 +752,8 @@ class TestTemplates(cloudstackTestCase):
list_template_response = list_templates(
self.apiclient,
templatefilter='featured',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(list_template_response, list),
@@ -784,8 +784,8 @@ class TestTemplates(cloudstackTestCase):
list_template_response = list_templates(
self.apiclient,
templatefilter='featured',
- account=self.user.account.name,
- domainid=self.user.account.domainid
+ account=self.user.name,
+ domainid=self.user.domainid
)
self.assertEqual(
isinstance(list_template_response, list),
[20/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2364: fixed private gateway creation in VPC - the vnet for the private gateway network is not stored in data_center_vnet table
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/732566e7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/732566e7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/732566e7
Branch: refs/heads/vmware-datamodel
Commit: 732566e70368ef771d2f29f951bfba3b8272f9c3
Parents: 43fdb14
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Tue May 7 13:02:29 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Tue May 7 13:07:47 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/network/NetworkManagerImpl.java | 39 ++++++++------
1 files changed, 22 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/732566e7/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 a995661..4fffbc1 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -2005,23 +2005,28 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
if (_networksDao.countByZoneAndUri(zoneId, uri) > 0) {
throw new InvalidParameterValueException("Network with vlan " + vlanId + " already exists in zone " + zoneId);
} else {
- DataCenterVnetVO dcVnet = _datacenterVnetDao.findVnet(zoneId, vlanId.toString()).get(0);
- // Fail network creation if specified vlan is dedicated to a different account
- if (dcVnet.getAccountGuestVlanMapId() != null) {
- Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId();
- AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId);
- if (map.getAccountId() != owner.getAccountId()) {
- throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account");
- }
- // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool
- } else {
- List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId());
- if (maps != null && !maps.isEmpty()) {
- int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId());
- int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId());
- if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) {
- throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" +
- " to the vlan range dedicated to the owner "+ owner.getAccountName());
+ List<DataCenterVnetVO> dcVnets = _datacenterVnetDao.findVnet(zoneId, vlanId.toString());
+ //for the network that is created as part of private gateway,
+ //the vnet is not coming from the data center vnet table, so the list can be empty
+ if (!dcVnets.isEmpty()) {
+ DataCenterVnetVO dcVnet = dcVnets.get(0);
+ // Fail network creation if specified vlan is dedicated to a different account
+ if (dcVnet.getAccountGuestVlanMapId() != null) {
+ Long accountGuestVlanMapId = dcVnet.getAccountGuestVlanMapId();
+ AccountGuestVlanMapVO map = _accountGuestVlanMapDao.findById(accountGuestVlanMapId);
+ if (map.getAccountId() != owner.getAccountId()) {
+ throw new InvalidParameterValueException("Vlan " + vlanId + " is dedicated to a different account");
+ }
+ // Fail network creation if owner has a dedicated range of vlans but the specified vlan belongs to the system pool
+ } else {
+ List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(owner.getAccountId());
+ if (maps != null && !maps.isEmpty()) {
+ int vnetsAllocatedToAccount = _datacenterVnetDao.countVnetsAllocatedToAccount(zoneId, owner.getAccountId());
+ int vnetsDedicatedToAccount = _datacenterVnetDao.countVnetsDedicatedToAccount(zoneId, owner.getAccountId());
+ if (vnetsAllocatedToAccount < vnetsDedicatedToAccount) {
+ throw new InvalidParameterValueException("Specified vlan " + vlanId + " doesn't belong" +
+ " to the vlan range dedicated to the owner "+ owner.getAccountName());
+ }
}
}
}
[18/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Fixing the gmaven configuration for marvin/pom.xml
For the marvin checkin test custom properties had a typo when run for
the *nix environment.
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/b9f262aa
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b9f262aa
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b9f262aa
Branch: refs/heads/vmware-datamodel
Commit: b9f262aa1c30b38b5a2135faa62818fcb32e73d6
Parents: 887f405
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 17:06:15 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 17:06:15 2013 +0530
----------------------------------------------------------------------
tools/marvin/pom.xml | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b9f262aa/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index 089c445..b8f7d74 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -232,9 +232,13 @@
<goal>execute</goal>
</goals>
<configuration>
+ <properties>
+ <resolved.user.dir>${user.dir}</resolved.user.dir>
+ <resolved.marvin.config>${marvin.config}</resolved.marvin.config>
+ </properties>
<source>
- pom.properties['resolved.userdir']='${user.dir}'.replace('\','/').replace('D:','/cyg/d');
- pom.properties['resolved.marvin.config']='${marvin.config}'.replace('\','/').replace('D:','/cyg/d');
+ project.properties['resolved.user.dir']='${user.dir}'.replace('\','/').replace('D:','/cyg/d');
+ project.properties['resolved.marvin.config']='${marvin.config}'.replace('\','/').replace('D:','/cyg/d');
</source>
</configuration>
</execution>
[30/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2362: correct list append method
fix userdata integration test
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/731cc439
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/731cc439
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/731cc439
Branch: refs/heads/vmware-datamodel
Commit: 731cc439a363fd3b17b1ed5eeca51f92f9e993cc
Parents: 8be3044
Author: Talluri <Sr...@citrix.com>
Authored: Wed May 8 14:12:46 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:26:43 2013 +0530
----------------------------------------------------------------------
.../smoke/test_deploy_vm_with_userdata.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/731cc439/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 fd9e320..8ca9bd0 100644
--- a/test/integration/smoke/test_deploy_vm_with_userdata.py
+++ b/test/integration/smoke/test_deploy_vm_with_userdata.py
@@ -111,6 +111,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
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):
@@ -134,6 +135,7 @@ class TestDeployVmWithUserData(cloudstackTestCase):
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):
[04/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Fixed up the simulator to run with windows paths in cygwin
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bc823f94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bc823f94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bc823f94
Branch: refs/heads/vmware-datamodel
Commit: bc823f946c2493ab315a2b7e7ef7dccce9950994
Parents: 2639b9f
Author: Alex Huang <al...@gmail.com>
Authored: Mon May 6 16:34:03 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon May 6 16:34:41 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/simulator/MockSecStorageVO.java | 3 +-
.../src/com/cloud/simulator/MockStoragePoolVO.java | 3 +-
.../src/com/cloud/simulator/MockVolumeVO.java | 3 +-
server/pom.xml | 5 ---
test/integration/smoke/test_vm_life_cycle.py | 2 +
tools/marvin/pom.xml | 24 +++++++++++++-
6 files changed, 30 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
index 532d2a7..87905ee 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java
@@ -48,6 +48,7 @@ public class MockSecStorageVO implements InternalIdentity {
}
+ @Override
public long getId() {
return this.id;
}
@@ -57,7 +58,7 @@ public class MockSecStorageVO implements InternalIdentity {
}
public void setMountPoint(String mountPoint) {
- this.mountPoint = mountPoint;
+ this.mountPoint = mountPoint.replace('\\', '/');
}
public String getUrl() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
index 06aa169..7f1b7cc 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java
@@ -66,6 +66,7 @@ public class MockStoragePoolVO implements InternalIdentity {
this.hostGuid = hostGuid;
}
+ @Override
public long getId() {
return this.id;
}
@@ -91,7 +92,7 @@ public class MockStoragePoolVO implements InternalIdentity {
}
public void setMountPoint(String mountPoint) {
- this.mountPoint = mountPoint;
+ this.mountPoint = mountPoint.replace('\\', '/');
}
public long getCapacity() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
index 6dd59e8..b7191b8 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java
@@ -66,6 +66,7 @@ public class MockVolumeVO implements InternalIdentity {
@Enumerated(value=EnumType.STRING)
private VMTemplateStorageResourceAssoc.Status status;
+ @Override
public long getId() {
return id;
}
@@ -90,7 +91,7 @@ public class MockVolumeVO implements InternalIdentity {
}
public void setPath(String path) {
- this.path = path;
+ this.path = path.replace('\\', '/');
}
public long getPoolId() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 429d608..808dd3e 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -95,11 +95,6 @@
<artifactId>cloud-framework-events</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.cloudstack</groupId>
- <artifactId>cloud-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/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 ae36c64..21c2635 100644
--- a/test/integration/smoke/test_vm_life_cycle.py
+++ b/test/integration/smoke/test_vm_life_cycle.py
@@ -163,6 +163,8 @@ class TestDeployVM(cloudstackTestCase):
cls.services["account"],
domainid=domain.id
)
+ cls.debug(str("============" ))
+ cls.debug(cls.account.id)
cls.service_offering = ServiceOffering.create(
cls.apiclient,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc823f94/tools/marvin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index 25134a8..089c445 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -221,6 +221,26 @@
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>setproperty</id>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
+ pom.properties['resolved.userdir']='${user.dir}'.replace('\','/').replace('D:','/cyg/d');
+ pom.properties['resolved.marvin.config']='${marvin.config}'.replace('\','/').replace('D:','/cyg/d');
+ </source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
@@ -237,11 +257,11 @@
<arguments>
<argument>--with-marvin</argument>
<argument>--marvin-config</argument>
- <argument>${user.dir}/${marvin.config}</argument>
+ <argument>${resolved.user.dir}/${resolved.marvin.config}</argument>
<argument>--load</argument>
<argument>-a</argument>
<argument>tags=${tag}</argument>
- <argument>${user.dir}/${test}</argument>
+ <argument>${resolved.user.dir}/${test}</argument>
<argument>-v</argument>
</arguments>
</configuration>
[22/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Fix typo
Reported by Soheil Eizadi <se...@infoblox.com>
at dev@cloudstack.apache.org
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/64dc39a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/64dc39a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/64dc39a2
Branch: refs/heads/vmware-datamodel
Commit: 64dc39a2b068e0cb82ad300a98ae83e323137364
Parents: 5b74b4d
Author: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Authored: Wed May 8 10:06:44 2013 +0900
Committer: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Committed: Wed May 8 10:06:44 2013 +0900
----------------------------------------------------------------------
.../api/commands/DeleteNiciraNvpDeviceCmd.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/64dc39a2/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
old mode 100644
new mode 100755
index 8d21a55..9ba1c83
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java
@@ -95,7 +95,7 @@ public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd {
@Override
public String getEventType() {
- return EventTypes.EVENT_EXTERNAL_LB_DEVICE_DELETE;
+ return EventTypes.EVENT_EXTERNAL_NVP_CONTROLLER_DELETE;
}
@Override
[49/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-1963 New mapping model for CloudStack zone and Vmware datacenter Upgrade changes with legacy zone support
DC-Zone mapping constraints should allow multiple hypervisors per zone.
Such zones would just be ignored.
Looking for only VMware clusters in the zone while associating a VMware DC with a zone.
Fixed upgrade path for zones with 1 cluster from 1 DC/vCenter. Auto-associating in this case.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9b082947
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9b082947
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9b082947
Branch: refs/heads/vmware-datamodel
Commit: 9b0829476b62452c0ea3d3d24b53842cf908980d
Parents: 47d4088
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Thu May 9 23:13:28 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu May 9 23:22:59 2013 +0530
----------------------------------------------------------------------
.../src/com/cloud/upgrade/dao/Upgrade410to420.java | 42 ++++++++++----
.../vmware/manager/VmwareManagerImpl.java | 32 +++---------
setup/db/db/schema-410to420.sql | 1 -
3 files changed, 37 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b082947/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index c3e37de..1ea3287 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -260,11 +260,13 @@ public class Upgrade410to420 implements DbUpgrade {
String dcOfCurrentCluster = null;
String[] tokens;
String url;
- String user;
- String password;
+ String user = "";
+ String password = "";
String vc = "";
String dcName = "";
String guid;
+ String key;
+ String value;
try {
clustersQuery = conn.prepareStatement("select id, hypervisor_type from `cloud`.`cluster` where removed is NULL");
@@ -289,15 +291,16 @@ public class Upgrade410to420 implements DbUpgrade {
clusterId = clusters.getLong("id");
if (clusterHypervisorType.equalsIgnoreCase("VMware")) {
ignoreZone = false;
+ clusterDetailsQuery = conn.prepareStatement("select value from `cloud`.`cluster_details` where name='url' and cluster_id=?");
+ clusterDetailsQuery.setLong(1, clusterId);
+ clusterDetails = clusterDetailsQuery.executeQuery();
+ clusterDetails.next();
+ url = clusterDetails.getString("value");
+ tokens = url.split("/"); // url format - http://vcenter/dc/cluster
+ vc = tokens[2];
+ dcName = tokens[3];
if (count > 0) {
dcOfPreviousCluster = dcOfCurrentCluster;
- clusterDetailsQuery = conn.prepareStatement("select value,username,password from `cloud`.`cluster_details` where name='url' and cluster_id=?");
- clusterDetailsQuery.setLong(1, clusterId);
- clusterDetails = clusterDetailsQuery.executeQuery();
- url = clusterDetails.getString("value");
- tokens = url.split("/"); // url format - http://vcenter/dc/cluster
- vc = tokens[2];
- dcName = tokens[3];
dcOfCurrentCluster = dcName + "@" + vc;
if (!dcOfPreviousCluster.equals(dcOfCurrentCluster)) {
legacyZone = true;
@@ -317,8 +320,21 @@ public class Upgrade410to420 implements DbUpgrade {
if (legacyZone) {
listOfLegacyZones.add(zoneId);
} else {
- user = clusterDetails.getString("username");
- password = clusterDetails.getString("password");
+ assert(clusterDetails != null) : "Couldn't retrieve details of cluster!";
+ s_logger.debug("Discovered non-legacy zone " + zoneId + ". Processing the zone to associate with VMware datacenter.");
+
+ clusterDetailsQuery = conn.prepareStatement("select name, value from `cloud`.`cluster_details` where cluster_id=?");
+ clusterDetailsQuery.setLong(1, clusterId);
+ clusterDetails = clusterDetailsQuery.executeQuery();
+ while (clusterDetails.next()) {
+ key = clusterDetails.getString(1);
+ value = clusterDetails.getString(2);
+ if (key.equalsIgnoreCase("username")) {
+ user = value;
+ } else if (key.equalsIgnoreCase("password")) {
+ password = value;
+ }
+ }
guid = dcName + "@" + vc;
pstmt = conn.prepareStatement("INSERT INTO `cloud`.`vmware_data_center` (uuid, name, guid, vcenter_host, username, password) values(?, ?, ?, ?, ?, ?)");
@@ -345,7 +361,9 @@ public class Upgrade410to420 implements DbUpgrade {
}
updateLegacyZones(conn, listOfLegacyZones);
} catch (SQLException e) {
- throw new CloudRuntimeException("Unable to load legacy zones into cloud.legacy_zones table.", e);
+ String msg = "Unable to discover legacy zones." + e.getMessage();
+ s_logger.error(msg);
+ throw new CloudRuntimeException(msg, e);
} finally {
try {
if (rs != null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b082947/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
index 3e90312..21c6cda 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java
@@ -910,35 +910,12 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
// Zone validation
validateZone(zoneId, "add VMware datacenter to zone");
- // Check if the zone exists in the system
- // If no, throw invalid param value exception
- DataCenterVO zone = _dcDao.findById(zoneId);
- if (zone == null) {
- InvalidParameterValueException ex = new InvalidParameterValueException(
- "Can't find zone by the id specified");
- ex.addProxyObject(zone, zoneId, "dcId");
- throw ex;
- }
-
VmwareDatacenterZoneMapVO vmwareDcZoneMap = _vmwareDcZoneMapDao.findByZoneId(zoneId);
// Check if zone is associated with VMware DC
if (vmwareDcZoneMap != null) {
throw new CloudRuntimeException("Zone " + zoneId + " is already associated with a VMware datacenter.");
}
- // Check if zone has resources? - For now look for clusters
- // If yes, throw resource in use execption
- List<ClusterVO> clusters = _clusterDao.listByZoneId(zoneId);
- if (clusters != null) {
- try {
- if (clusters.size() > 0) {
- throw new ResourceInUseException("Zone has one or more clusters."
- + " Can't add VMware datacenter to zone which already has clusters.");
- }}catch(Throwable t) {
- s_logger.error(t);
- }
- }
-
// Validate url and get uri
URI uri = getUri(url);
@@ -1131,9 +1108,14 @@ public class VmwareManagerImpl extends ManagerBase implements VmwareManager, Vmw
// Check if zone has resources? - For now look for clusters
List<ClusterVO> clusters = _clusterDao.listByZoneId(zoneId);
- if(clusters != null && clusters.size() != 0) {
- throw new ResourceInUseException("Zone has one or more clusters."
+ if (clusters != null && clusters.size() > 0) {
+ // Look for VMware hypervisor.
+ for (ClusterVO cluster : clusters) {
+ if (cluster.getHypervisorType().equals(HypervisorType.VMware)) {
+ throw new ResourceInUseException("Zone has one or more clusters."
+ " Can't " + errStr + " which already has clusters.");
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9b082947/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index d19ed4d..9411231 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1001,7 +1001,6 @@ CREATE VIEW `cloud`.`account_view` AS
select
account.id,
account.uuid,
- account.uuid,
account.account_name,
account.type,
account.state,
[06/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Add docs for MidoNet networking plugin [CLOUDSTACK-996]
Signed-off-by: Dave Cahill <dc...@midokura.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5a6a1158
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5a6a1158
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5a6a1158
Branch: refs/heads/vmware-datamodel
Commit: 5a6a1158fd1f99caf65718810a467562e09cba03
Parents: bc823f9
Author: Dave Cahill <dc...@midokura.com>
Authored: Fri Apr 19 17:31:44 2013 +0900
Committer: Radhika PC <ra...@citrix.com>
Committed: Tue May 7 11:08:16 2013 +0530
----------------------------------------------------------------------
docs/en-US/MidoNet_Plugin_Guide.ent | 22 ++++++
docs/en-US/MidoNet_Plugin_Guide.xml | 52 +++++++++++++
docs/en-US/plugin-midonet-about.xml | 27 +++++++
docs/en-US/plugin-midonet-features.xml | 57 ++++++++++++++
docs/en-US/plugin-midonet-introduction.xml | 26 +++++++
docs/en-US/plugin-midonet-preparations.xml | 90 +++++++++++++++++++++++
docs/en-US/plugin-midonet-provider.xml | 39 ++++++++++
docs/en-US/plugin-midonet-revisions.xml | 45 +++++++++++
docs/en-US/plugin-midonet-ui.xml | 65 ++++++++++++++++
docs/en-US/plugin-midonet-usage.xml | 29 +++++++
docs/publican-plugin-midonet.cfg | 28 +++++++
11 files changed, 480 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/MidoNet_Plugin_Guide.ent
----------------------------------------------------------------------
diff --git a/docs/en-US/MidoNet_Plugin_Guide.ent b/docs/en-US/MidoNet_Plugin_Guide.ent
new file mode 100644
index 0000000..f31c407
--- /dev/null
+++ b/docs/en-US/MidoNet_Plugin_Guide.ent
@@ -0,0 +1,22 @@
+<!-- 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.
+-->
+
+<!ENTITY PRODUCT "CloudStack">
+<!ENTITY BOOKID "Technical Documentation">
+<!ENTITY YEAR "2013">
+<!ENTITY HOLDER "Apache Software Foundation">
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/MidoNet_Plugin_Guide.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/MidoNet_Plugin_Guide.xml b/docs/en-US/MidoNet_Plugin_Guide.xml
new file mode 100644
index 0000000..86182e6
--- /dev/null
+++ b/docs/en-US/MidoNet_Plugin_Guide.xml
@@ -0,0 +1,52 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+
+<!-- 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.
+-->
+
+<book>
+ <bookinfo id="midonet_plugin">
+ <title>&PRODUCT; Plugin Guide for the MidoNet Plugin</title>
+ <productname>Apache CloudStack</productname>
+ <productnumber>4.2.0</productnumber>
+ <edition>1</edition>
+ <pubsnumber></pubsnumber>
+ <abstract>
+ <para>
+ Plugin Guide for the MidoNet Plugin.
+ </para>
+ </abstract>
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject>
+ <imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
+ </imageobject>
+ </inlinemediaobject>
+ </corpauthor>
+ <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </bookinfo>
+ <xi:include href="plugin-midonet-about.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="plugin-midonet-usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="plugin-midonet-revisions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-about.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-about.xml b/docs/en-US/plugin-midonet-about.xml
new file mode 100644
index 0000000..dd9b3ad
--- /dev/null
+++ b/docs/en-US/plugin-midonet-about.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<chapter id="About-the-MidoNet-Plugin" >
+ <title>The MidoNet Plugin</title>
+ <xi:include href="plugin-midonet-introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-midonet-features.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+</chapter>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-features.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-features.xml b/docs/en-US/plugin-midonet-features.xml
new file mode 100644
index 0000000..f242d63
--- /dev/null
+++ b/docs/en-US/plugin-midonet-features.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Features-of-the-MidoNet-Plugin">
+ <title>Features of the MidoNet Plugin</title>
+
+ <note>
+ <para>
+ In &PRODUCT; 4.2.0 only the KVM hypervisor is supported for use in combination with MidoNet.
+ </para>
+ </note>
+
+ <para>In &PRODUCT; release 4.2.0 this plugin supports several services in the Advanced Isolated network mode.
+ </para>
+
+ <para>
+ When tenants create new isolated layer 3 networks, instead of spinning up extra Virtual Router VMs, the relevant L3 elements (routers etc) are created in the MidoNet virtual topology by making the appropriate calls to the MidoNet API. Instead of using VLANs, isolation is provided by MidoNet.
+ </para>
+
+ <para>
+ Aside from the above service (Connectivity), several extra features are supported in the 4.2.0 release:
+ </para>
+
+ <itemizedlist>
+ <listitem><para>DHCP</para></listitem>
+ <listitem><para>Firewall (ingress)</para></listitem>
+ <listitem><para>Source NAT</para></listitem>
+ <listitem><para>Static NAT</para></listitem>
+ <listitem><para>Port Forwarding</para></listitem>
+ </itemizedlist>
+
+ <para>
+ The plugin has been tested with MidoNet version 12.12. (Caddo).
+ </para>
+
+
+
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-introduction.xml b/docs/en-US/plugin-midonet-introduction.xml
new file mode 100644
index 0000000..7793ecb
--- /dev/null
+++ b/docs/en-US/plugin-midonet-introduction.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Introduction-to-the-MidoNet-Plugin">
+ <title>Introduction to the MidoNet Plugin</title>
+ <para>The MidoNet plugin allows &PRODUCT; to use the MidoNet virtualized networking solution as a provider for &PRODUCT; networks and services. For more information on MidoNet and how it works, see <ulink url="http://www.midokura.com/midonet/">http://www.midokura.com/midonet/</ulink>.</para>
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-preparations.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-preparations.xml b/docs/en-US/plugin-midonet-preparations.xml
new file mode 100644
index 0000000..cf78774
--- /dev/null
+++ b/docs/en-US/plugin-midonet-preparations.xml
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Prerequisites">
+ <title>Prerequisites</title>
+
+ <para>In order to use the MidoNet plugin, the compute hosts must be running the MidoNet Agent, and the MidoNet API server must be available. Please consult the MidoNet User Guide for more information. The following section describes the &PRODUCT; side setup.</para>
+
+ <orderedlist>
+ <listitem>
+ <para>&PRODUCT; needs to have at least one physical network with the isolation method set to "MIDO". This network should be enabled for the Guest and Public traffic types.</para>
+ </listitem>
+
+<listitem>
+ <para>Next, we need to set the following &PRODUCT; settings under "Global Settings" in the UI:</para>
+
+<table frame='all'><title>&PRODUCT; settings</title>
+<tgroup cols='3' align='left' colsep='1' rowsep='1'>
+<thead>
+<row>
+ <entry>Setting Name</entry>
+ <entry>Description</entry>
+ <entry>Example</entry>
+</row>
+</thead>
+<tbody>
+<row>
+ <entry>midonet.apiserver.address</entry>
+ <entry>Specify the address at which the Midonet API server can be contacted</entry>
+ <entry>http://192.168.1.144:8081/midolmanj-mgmt</entry>
+</row>
+<row>
+ <entry>midonet.providerrouter.id</entry>
+ <entry>Specifies the UUID of the Midonet provider router</entry>
+ <entry>d7c5e6a3-e2f4-426b-b728-b7ce6a0448e5</entry>
+</row>
+</tbody>
+</tgroup>
+</table>
+</listitem>
+
+<listitem>
+ <para>
+ We also want MidoNet to take care of public traffic, so in <emphasis>componentContext.xml</emphasis> we need to replace this line:
+
+ <programlisting><![CDATA[<bean id="PublicNetworkGuru" class="com.cloud.network.guru.PublicNetworkGuru">]]>
+ </programlisting>
+
+ With this:
+
+ <programlisting><![CDATA[<bean id="PublicNetworkGuru" class="com.cloud.network.guru.MidoNetPublicNetworkGuru">]]>
+ </programlisting>
+</para>
+</listitem>
+</orderedlist>
+
+ <note>
+ <para>
+ On the compute host, MidoNet takes advantage of per-traffic type VIF driver support in &PRODUCT; KVM.
+ </para>
+ <para>
+ In agent.properties, we set the following to make MidoNet take care of Guest and Public traffic:
+
+<programlisting>libvirt.vif.driver.Guest=com.cloud.network.resource.MidoNetVifDriver
+libvirt.vif.driver.Public=com.cloud.network.resource.MidoNetVifDriver</programlisting>
+
+ This is explained further in MidoNet User Guide.
+ </para>
+ </note>
+
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-provider.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-provider.xml b/docs/en-US/plugin-midonet-provider.xml
new file mode 100644
index 0000000..904828c
--- /dev/null
+++ b/docs/en-US/plugin-midonet-provider.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="Enabling-the-service-provider">
+ <title>Enabling the MidoNet service provider via the API</title>
+ <para>
+ To enable via the API, use the following API calls:</para>
+ <para><emphasis>addNetworkServiceProvider</emphasis></para>
+ <itemizedlist>
+ <listitem><para>name = "MidoNet"</para></listitem>
+ <listitem><para>physicalnetworkid = <the uuid of the physical network></para></listitem>
+ </itemizedlist>
+ <para><emphasis>updateNetworkServiceProvider</emphasis></para>
+ <itemizedlist>
+ <listitem><para>id = <the provider uuid returned by the previous call></para></listitem>
+ <listitem><para>state = "Enabled"</para></listitem>
+ </itemizedlist>
+
+
+</section>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-revisions.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-revisions.xml b/docs/en-US/plugin-midonet-revisions.xml
new file mode 100644
index 0000000..73def23
--- /dev/null
+++ b/docs/en-US/plugin-midonet-revisions.xml
@@ -0,0 +1,45 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+
+<appendix id="appe-cloudstack-Revision_History">
+ <title>Revision History</title>
+ <simpara>
+ <revhistory>
+ <revision>
+ <revnumber>0-0</revnumber>
+ <date>Wed Mar 13 2013</date>
+ <author>
+ <firstname>Dave</firstname>
+ <surname>Cahill</surname>
+ <email>dcahill@midokura.com</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Documentation created for 4.2.0 version of the MidoNet Plugin</member>
+ </simplelist>
+ </revdescription>
+ </revision>
+ </revhistory>
+ </simpara>
+</appendix>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-ui.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-ui.xml b/docs/en-US/plugin-midonet-ui.xml
new file mode 100644
index 0000000..8ee9850
--- /dev/null
+++ b/docs/en-US/plugin-midonet-ui.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="plugin-midonet-ui">
+ <title>Enabling the MidoNet service provider via the UI</title>
+ <para>To allow &PRODUCT; to use the MidoNet Plugin the network service provider needs to be enabled on the physical network.
+ </para>
+
+ <para>
+ The steps to enable via the UI are as follows:
+ <orderedlist>
+ <listitem><para>
+ In the left navbar, click Infrastructure
+ </para></listitem>
+
+ <listitem><para>
+ In Zones, click View All
+ </para></listitem>
+
+ <listitem><para>
+ Click the name of the Zone on which you are setting up MidoNet
+ </para></listitem>
+
+ <listitem><para>
+ Click the Physical Network tab
+ </para></listitem>
+
+ <listitem><para>
+ Click the Name of the Network on which you are setting up MidoNet
+ </para></listitem>
+
+ <listitem><para>
+ Click Configure on the Network Service Providers box
+ </para></listitem>
+
+ <listitem><para>
+ Click on the name MidoNet
+ </para></listitem>
+
+ <listitem><para>
+ Click the Enable Provider button in the Network tab
+ </para></listitem>
+
+ </orderedlist>
+ </para>
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/en-US/plugin-midonet-usage.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-midonet-usage.xml b/docs/en-US/plugin-midonet-usage.xml
new file mode 100644
index 0000000..a314581
--- /dev/null
+++ b/docs/en-US/plugin-midonet-usage.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<chapter id="Using-the-MidoNet-Plugin" >
+ <title>Using the MidoNet Plugin</title>
+
+ <xi:include href="plugin-midonet-preparations.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-midonet-ui.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-midonet-provider.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+</chapter>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5a6a1158/docs/publican-plugin-midonet.cfg
----------------------------------------------------------------------
diff --git a/docs/publican-plugin-midonet.cfg b/docs/publican-plugin-midonet.cfg
new file mode 100644
index 0000000..6558d99
--- /dev/null
+++ b/docs/publican-plugin-midonet.cfg
@@ -0,0 +1,28 @@
+# Publican configuration file for CloudStack Complete Documentation Set
+# Contains all technical docs except release notes
+# Config::Simple 4.58
+# Tue May 29 00:57:27 2012
+#
+# 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.
+
+xml_lang: en-US
+type: Book
+docname: MidoNet_Plugin_Guide
+brand: cloudstack
+chunk_first: 1
+chunk_section_depth: 1
+condition: install
[32/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2377: change memory size to 128 mb for the tiny service offering in the integration tests
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/b8358e10
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b8358e10
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b8358e10
Branch: refs/heads/vmware-datamodel
Commit: b8358e109e737c454a351942c0f3d66f674febd7
Parents: 1fe50a8
Author: Srikanteswararao Talluri <sr...@citrix.com>
Authored: Wed May 8 12:23:15 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:26:44 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_accounts.py | 2 +-
.../component/test_allocation_states.py | 2 +-
test/integration/component/test_blocker_bugs.py | 2 +-
test/integration/component/test_egress_rules.py | 2 +-
test/integration/component/test_eip_elb.py | 2 +-
.../integration/component/test_network_offering.py | 2 +-
test/integration/component/test_project_configs.py | 2 +-
test/integration/component/test_project_limits.py | 2 +-
.../component/test_project_resources.py | 2 +-
test/integration/component/test_project_usage.py | 2 +-
test/integration/component/test_projects.py | 2 +-
test/integration/component/test_resource_limits.py | 2 +-
test/integration/component/test_routers.py | 2 +-
test/integration/component/test_security_groups.py | 2 +-
test/integration/component/test_templates.py | 2 +-
test/integration/component/test_usage.py | 2 +-
test/integration/component/test_volumes.py | 2 +-
test/integration/smoke/test_affinity_groups.py | 2 +-
18 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index fb38e62..9cbefe5 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -60,7 +60,7 @@ class Services:
"cpunumber": 1,
"cpuspeed": 100,
# in MHz
- "memory": 64,
+ "memory": 128,
# In MBs
},
"virtual_machine": {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_allocation_states.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_allocation_states.py b/test/integration/component/test_allocation_states.py
index fe4c35f..5ce0b21 100644
--- a/test/integration/component/test_allocation_states.py
+++ b/test/integration/component/test_allocation_states.py
@@ -49,7 +49,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_blocker_bugs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_blocker_bugs.py b/test/integration/component/test_blocker_bugs.py
index a6ea25a..d099bf1 100644
--- a/test/integration/component/test_blocker_bugs.py
+++ b/test/integration/component/test_blocker_bugs.py
@@ -51,7 +51,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_egress_rules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_egress_rules.py b/test/integration/component/test_egress_rules.py
index 4af6eee..872ca2c 100644
--- a/test/integration/component/test_egress_rules.py
+++ b/test/integration/component/test_egress_rules.py
@@ -69,7 +69,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"security_group": {
"name": 'SSH',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_eip_elb.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_eip_elb.py b/test/integration/component/test_eip_elb.py
index cb41859..b01371b 100644
--- a/test/integration/component/test_eip_elb.py
+++ b/test/integration/component/test_eip_elb.py
@@ -49,7 +49,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"lbrule": {
"name": "SSH",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_network_offering.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_network_offering.py b/test/integration/component/test_network_offering.py
index 00566a0..e33c376 100644
--- a/test/integration/component/test_network_offering.py
+++ b/test/integration/component/test_network_offering.py
@@ -49,7 +49,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"network_offering": {
"name": 'Network offering-VR services',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_project_configs.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_configs.py b/test/integration/component/test_project_configs.py
index 33409ac..1eef123 100644
--- a/test/integration/component/test_project_configs.py
+++ b/test/integration/component/test_project_configs.py
@@ -70,7 +70,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"virtual_machine": {
"displayname": "Test VM",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_project_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py
index c5d2d6d..17ddfc6 100644
--- a/test/integration/component/test_project_limits.py
+++ b/test/integration/component/test_project_limits.py
@@ -63,7 +63,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Tiny Disk Offering",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_project_resources.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_resources.py b/test/integration/component/test_project_resources.py
index e79254c..8414188 100644
--- a/test/integration/component/test_project_resources.py
+++ b/test/integration/component/test_project_resources.py
@@ -64,7 +64,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Tiny Disk Offering",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_project_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py
index 44ef2f9..ab789e1 100644
--- a/test/integration/component/test_project_usage.py
+++ b/test/integration/component/test_project_usage.py
@@ -52,7 +52,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_projects.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_projects.py b/test/integration/component/test_projects.py
index ccfc8ef..f013e99 100644
--- a/test/integration/component/test_projects.py
+++ b/test/integration/component/test_projects.py
@@ -78,7 +78,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"virtual_machine": {
"displayname": "Test VM",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_resource_limits.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_resource_limits.py b/test/integration/component/test_resource_limits.py
index 418080a..1d876b6 100644
--- a/test/integration/component/test_resource_limits.py
+++ b/test/integration/component/test_resource_limits.py
@@ -51,7 +51,7 @@ class Services:
"cpunumber": 1,
"cpuspeed": 100,
# in MHz
- "memory": 64,
+ "memory": 128,
# In MBs
},
"disk_offering": {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_routers.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_routers.py b/test/integration/component/test_routers.py
index 96eb9aa..bc33d75 100644
--- a/test/integration/component/test_routers.py
+++ b/test/integration/component/test_routers.py
@@ -41,7 +41,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"virtual_machine":
{
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_security_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_security_groups.py b/test/integration/component/test_security_groups.py
index fe2561a..54b5c67 100644
--- a/test/integration/component/test_security_groups.py
+++ b/test/integration/component/test_security_groups.py
@@ -74,7 +74,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"security_group": {
"name": 'SSH',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_templates.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py
index 3867fb4..1a60123 100644
--- a/test/integration/component/test_templates.py
+++ b/test/integration/component/test_templates.py
@@ -51,7 +51,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_usage.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py
index dbd0be9..a3779e4 100644
--- a/test/integration/component/test_usage.py
+++ b/test/integration/component/test_usage.py
@@ -48,7 +48,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/component/test_volumes.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py
index f7eb9f9..34a0679 100644
--- a/test/integration/component/test_volumes.py
+++ b/test/integration/component/test_volumes.py
@@ -52,7 +52,7 @@ class Services:
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
- "memory": 64, # In MBs
+ "memory": 128, # In MBs
},
"disk_offering": {
"displaytext": "Small",
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8358e10/test/integration/smoke/test_affinity_groups.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_affinity_groups.py b/test/integration/smoke/test_affinity_groups.py
index 6ccd478..e0e1a17 100644
--- a/test/integration/smoke/test_affinity_groups.py
+++ b/test/integration/smoke/test_affinity_groups.py
@@ -48,7 +48,7 @@ class Services:
"cpunumber": 1,
"cpuspeed": 100,
# in MHz
- "memory": 64,
+ "memory": 128,
# In MBs
},
"ostype": 'CentOS 5.3 (64-bit)',
[03/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Missing file and updated .gitignore
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e5d331ee
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e5d331ee
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e5d331ee
Branch: refs/heads/vmware-datamodel
Commit: e5d331ee58738dde8aa50d8a119d979b6d04d822
Parents: 3722d66
Author: Alex Huang <al...@gmail.com>
Authored: Mon May 6 06:31:47 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon May 6 16:34:40 2013 -0700
----------------------------------------------------------------------
.gitignore | 6 ++----
services/pom.xml | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5d331ee/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index f418628..016554a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,10 +18,7 @@
build/replace.properties
build/build.number
bin/
-cloudstack-proprietary/
-premium/
.lock-wscript
-artifacts/
.waf-*
waf-*
target/
@@ -37,7 +34,7 @@ cloud-*.tar.bz2
*.egg-info/
*.prefs
build.number
-api.log.*.gz
+*.log.*.gz
cloud.log.*.*
unittest
deps/cloud.userlibraries
@@ -59,6 +56,7 @@ tools/cli/build/
*.iso
*.tar.gz
*.tgz
+.*
target-eclipse
awsapi/modules/*
!.gitignore
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e5d331ee/services/pom.xml
----------------------------------------------------------------------
diff --git a/services/pom.xml b/services/pom.xml
new file mode 100644
index 0000000..805bcdb
--- /dev/null
+++ b/services/pom.xml
@@ -0,0 +1,37 @@
+<!--
+ 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>cloudstack-services</artifactId>
+ <name>Apache CloudStack Cloud Services</name>
+ <packaging>pom</packaging>
+ <parent>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloudstack</artifactId>
+ <version>4.2.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ </build>
+ <modules>
+ <module>console-proxy</module>
+ <module>secondary-storage</module>
+ </modules>
+</project>
[02/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Fixed up unit testing to use only an in class TestConfiguration
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3722d66a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3722d66a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3722d66a
Branch: refs/heads/vmware-datamodel
Commit: 3722d66aae90c26bb315dfbebf8489256c7f46e9
Parents: 074df0b
Author: Alex Huang <al...@gmail.com>
Authored: Mon May 6 06:29:59 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon May 6 16:34:27 2013 -0700
----------------------------------------------------------------------
engine/api/pom.xml | 10 +-
.../src/com/cloud/storage/StoragePoolHostVO.java | 4 +-
.../StorageAllocatorTestConfiguration.java | 4 +-
.../storage/test/ChildTestConfiguration.java | 4 +-
.../cloud/agent/manager/SimulatorManagerImpl.java | 78 +++-
pom.xml | 62 ++-
server/pom.xml | 5 +
.../src/com/cloud/network/NetworkServiceImpl.java | 399 +++++++++------
.../src/com/cloud/servlet/ConsoleProxyServlet.java | 29 +-
.../SecurityGroupManagerTestConfiguration.java | 4 +-
.../snapshot/SnapshotDaoTestConfiguration.java | 4 +-
.../dao/StoragePoolDaoTestConfiguration.java | 4 +-
.../UserVmCloneSettingDaoTestConfiguration.java | 4 +-
.../cloud/vm/dao/UserVmDaoTestConfiguration.java | 4 +-
.../test/com/cloud/vpc/VpcTestConfiguration.java | 4 +-
.../cloudstack/affinity/AffinityApiUnitTest.java | 67 +++-
.../networkoffering/ChildTestConfiguration.java | 4 +-
server/test/resources/affinityContext.xml | 42 --
services/console-proxy/pom.xml | 4 +-
services/secondary-storage/pom.xml | 6 +-
tools/marvin/pom.xml | 49 ++-
.../cloud/usage/UsageManagerTestConfiguration.java | 5 +-
utils/src/com/cloud/utils/AnnotationHelper.java | 28 +-
.../utils/component/SpringComponentScanUtils.java | 41 --
.../apache/cloudstack/test/utils/SpringUtils.java | 113 ++++
25 files changed, 611 insertions(+), 367 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/engine/api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index 1e8e8c3..1b8f26c 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -31,11 +31,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.apache.cloudstack</groupId>
- <artifactId>cloud-framework-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle-jaxrs</artifactId>
<version>2.7.0</version>
@@ -55,6 +50,11 @@
<artifactId>cloud-framework-rest</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java b/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
index 1a4b9b8..1b02f6d 100644
--- a/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
+++ b/engine/schema/src/com/cloud/storage/StoragePoolHostVO.java
@@ -50,11 +50,11 @@ public class StoragePoolHostVO implements StoragePoolHostAssoc {
private String localPath;
@Column(name=GenericDaoBase.CREATED_COLUMN)
- private final Date created = null;
+ private Date created = null;
@Column(name="last_updated")
@Temporal(value=TemporalType.TIMESTAMP)
- private final Date lastUpdated = null;
+ private Date lastUpdated = null;
public StoragePoolHostVO() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
index b815fc1..4790086 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/allocator/StorageAllocatorTestConfiguration.java
@@ -20,6 +20,7 @@ import java.io.IOException;
import org.apache.cloudstack.storage.allocator.StorageAllocatorTestConfiguration.Library;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -36,7 +37,6 @@ import com.cloud.host.dao.HostDaoImpl;
import com.cloud.storage.StorageManager;
import com.cloud.storage.dao.StoragePoolDetailsDaoImpl;
import com.cloud.storage.dao.VMTemplateDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.UserVmManager;
@@ -67,7 +67,7 @@ public class StorageAllocatorTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = StorageAllocatorTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
index a063bdd..0dcdebd 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java
@@ -24,6 +24,7 @@ import org.apache.cloudstack.framework.rpc.RpcProvider;
import org.apache.cloudstack.storage.HostEndpointRpcServer;
import org.apache.cloudstack.storage.endpoint.EndPointSelector;
import org.apache.cloudstack.storage.test.ChildTestConfiguration.Library;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -75,7 +76,6 @@ import com.cloud.storage.swift.SwiftManager;
import com.cloud.tags.dao.ResourceTagsDaoImpl;
import com.cloud.template.TemplateManager;
import com.cloud.user.dao.UserDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.dao.ConsoleProxyDaoImpl;
import com.cloud.vm.dao.DomainRouterDao;
@@ -222,7 +222,7 @@ public class ChildTestConfiguration extends TestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = ChildTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
index c234cc5..ab6eec3 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
@@ -16,12 +16,74 @@
// under the License.
package com.cloud.agent.manager;
-import com.cloud.agent.api.*;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.springframework.stereotype.Component;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.AttachIsoCommand;
+import com.cloud.agent.api.AttachVolumeCommand;
+import com.cloud.agent.api.BackupSnapshotCommand;
+import com.cloud.agent.api.BumpUpPriorityCommand;
+import com.cloud.agent.api.CheckHealthCommand;
+import com.cloud.agent.api.CheckNetworkCommand;
+import com.cloud.agent.api.CheckRouterCommand;
+import com.cloud.agent.api.CheckVirtualMachineCommand;
+import com.cloud.agent.api.CleanupNetworkRulesCmd;
+import com.cloud.agent.api.ClusterSyncCommand;
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.ComputeChecksumCommand;
+import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
+import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
+import com.cloud.agent.api.CreateStoragePoolCommand;
+import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
+import com.cloud.agent.api.DeleteSnapshotBackupCommand;
+import com.cloud.agent.api.DeleteStoragePoolCommand;
+import com.cloud.agent.api.GetDomRVersionCmd;
+import com.cloud.agent.api.GetHostStatsCommand;
+import com.cloud.agent.api.GetStorageStatsCommand;
+import com.cloud.agent.api.GetVmStatsCommand;
+import com.cloud.agent.api.GetVncPortCommand;
+import com.cloud.agent.api.MaintainCommand;
+import com.cloud.agent.api.ManageSnapshotCommand;
+import com.cloud.agent.api.MigrateCommand;
+import com.cloud.agent.api.ModifyStoragePoolCommand;
+import com.cloud.agent.api.NetworkUsageCommand;
+import com.cloud.agent.api.PingTestCommand;
+import com.cloud.agent.api.PrepareForMigrationCommand;
+import com.cloud.agent.api.RebootCommand;
+import com.cloud.agent.api.SecStorageSetupCommand;
+import com.cloud.agent.api.SecStorageVMSetupCommand;
+import com.cloud.agent.api.SecurityGroupRulesCmd;
+import com.cloud.agent.api.StartCommand;
+import com.cloud.agent.api.StopCommand;
+import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.api.check.CheckSshCommand;
import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand;
import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand;
-import com.cloud.agent.api.routing.*;
-import com.cloud.agent.api.storage.*;
+import com.cloud.agent.api.routing.DhcpEntryCommand;
+import com.cloud.agent.api.routing.IpAssocCommand;
+import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
+import com.cloud.agent.api.routing.SavePasswordCommand;
+import com.cloud.agent.api.routing.SetFirewallRulesCommand;
+import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
+import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
+import com.cloud.agent.api.routing.VmDataCommand;
+import com.cloud.agent.api.storage.CopyVolumeCommand;
+import com.cloud.agent.api.storage.CreateCommand;
+import com.cloud.agent.api.storage.DeleteTemplateCommand;
+import com.cloud.agent.api.storage.DestroyCommand;
+import com.cloud.agent.api.storage.DownloadCommand;
+import com.cloud.agent.api.storage.DownloadProgressCommand;
+import com.cloud.agent.api.storage.ListTemplateCommand;
+import com.cloud.agent.api.storage.ListVolumeCommand;
+import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
import com.cloud.simulator.MockConfigurationVO;
import com.cloud.simulator.MockHost;
import com.cloud.simulator.MockVMVO;
@@ -34,14 +96,6 @@ import com.cloud.utils.db.DB;
import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine.State;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-import java.util.HashMap;
-import java.util.Map;
@Component
@Local(value = { SimulatorManager.class })
@@ -256,7 +310,7 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage
return Answer.createUnsupportedCommandAnswer(cmd);
}
} catch(Exception e) {
- s_logger.error("Failed execute cmd: " + e.toString());
+ s_logger.error("Failed execute cmd: ", e);
txn.rollback();
return new Answer(cmd, false, e.toString());
} finally {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f20e4af..9dbd1bf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,13 +1,12 @@
<!-- 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. -->
+ 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -171,6 +170,7 @@
<module>framework</module>
<module>test</module>
<module>client</module>
+ <module>services</module>
</modules>
<dependencyManagement>
@@ -206,22 +206,18 @@
<version>${org.springframework.version}</version>
</dependency>
<!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-oxm</artifactId>
- <version>${org.springframework.version}</version> </dependency> <dependency>
- <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId>
+ <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId> <version>${org.springframework.version}</version>
+ </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId>
+ <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId> <version>${org.springframework.version}</version>
+ </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId>
+ <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
+ <artifactId>spring-jdbc</artifactId> <version>${org.springframework.version}</version>
+ </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId>
+ <version>${org.springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId>
+ <artifactId>spring-oxm</artifactId> <version>${org.springframework.version}</version>
+ </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version> </dependency> -->
<dependency>
<groupId>org.mockito</groupId>
@@ -266,6 +262,20 @@
<pluginManagement>
<plugins>
<plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <configuration>
+ <excludeDefaultDirectories>true</excludeDefaultDirectories>
+ <filesets>
+ <fileset>
+ <directory>target</directory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileset>
+ </filesets>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.1</version>
@@ -504,7 +514,7 @@
<cs.target.dir>target-eclipse</cs.target.dir>
</properties>
</profile>
- <profile>
+ <profile>
<id>developer</id>
<properties>
<marvin.config>tools/devcloud/devcloud.cfg</marvin.config>
@@ -521,7 +531,7 @@
</properties>
<modules>
<module>developer</module>
- <!--module>tools/devcloud</module-->
+ <!--module>tools/devcloud</module -->
</modules>
</profile>
<profile>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 808dd3e..429d608 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -95,6 +95,11 @@
<artifactId>cloud-framework-events</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/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 230d907..5e8be92 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -5,7 +5,7 @@
// 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,
@@ -16,13 +16,55 @@
// under the License.
package com.cloud.network;
+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.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.UUID;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+import javax.naming.ConfigurationException;
+
+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 com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.*;
+import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.DataCenterVnetVO;
+import com.cloud.dc.Pod;
import com.cloud.dc.Vlan.VlanType;
-import com.cloud.dc.dao.*;
+import com.cloud.dc.VlanVO;
+import com.cloud.dc.dao.AccountVlanMapDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.DataCenterVnetDao;
+import com.cloud.dc.dao.HostPodDao;
+import com.cloud.dc.dao.VlanDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
@@ -32,7 +74,14 @@ import com.cloud.event.EventTypes;
import com.cloud.event.UsageEventUtils;
import com.cloud.event.dao.EventDao;
import com.cloud.event.dao.UsageEventDao;
-import com.cloud.exception.*;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.UnsupportedServiceException;
import com.cloud.host.dao.HostDao;
import com.cloud.network.IpAddress.State;
import com.cloud.network.Network.Capability;
@@ -44,7 +93,22 @@ import com.cloud.network.Networks.TrafficType;
import com.cloud.network.PhysicalNetwork.BroadcastDomainRange;
import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
import com.cloud.network.addr.PublicIp;
-import com.cloud.network.dao.*;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkDomainDao;
+import com.cloud.network.dao.NetworkDomainVO;
+import com.cloud.network.dao.NetworkServiceMapDao;
+import com.cloud.network.dao.NetworkVO;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
+import com.cloud.network.dao.PhysicalNetworkServiceProviderVO;
+import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao;
+import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO;
+import com.cloud.network.dao.PhysicalNetworkVO;
import com.cloud.network.element.NetworkElement;
import com.cloud.network.element.VirtualRouterElement;
import com.cloud.network.element.VpcVirtualRouterElement;
@@ -68,7 +132,14 @@ import com.cloud.projects.ProjectManager;
import com.cloud.server.ResourceTag.TaggedResourceType;
import com.cloud.tags.ResourceTagVO;
import com.cloud.tags.dao.ResourceTagDao;
-import com.cloud.user.*;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.DomainManager;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.User;
+import com.cloud.user.UserContext;
+import com.cloud.user.UserVO;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserDao;
import com.cloud.utils.AnnotationHelper;
@@ -76,36 +147,29 @@ import com.cloud.utils.Journal;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.component.ManagerBase;
-import com.cloud.utils.db.*;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Filter;
+import com.cloud.utils.db.JoinBuilder;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.Transaction;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.NetUtils;
-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.*;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicSecondaryIp;
+import com.cloud.vm.NicVO;
+import com.cloud.vm.ReservationContext;
+import com.cloud.vm.ReservationContextImpl;
+import com.cloud.vm.SecondaryStorageVmVO;
+import com.cloud.vm.UserVmVO;
+import com.cloud.vm.VMInstanceVO;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.NicDao;
+import com.cloud.vm.dao.NicSecondaryIpDao;
+import com.cloud.vm.dao.NicSecondaryIpVO;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
/**
* NetworkServiceImpl implements NetworkService.
@@ -151,9 +215,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
@Inject
UsageEventDao _usageEventDao;
-
+
@Inject List<NetworkGuru> _networkGurus;
-
+
@Inject
NetworkDomainDao _networkDomainDao;
@Inject
@@ -161,10 +225,10 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
@Inject
FirewallRulesDao _firewallDao;
-
+
@Inject
ResourceLimitService _resourceLimitMgr;
-
+
@Inject
DomainManager _domainMgr;
@Inject
@@ -175,7 +239,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkDao _physicalNetworkDao;
@Inject
PhysicalNetworkServiceProviderDao _pNSPDao;
-
+
@Inject
PhysicalNetworkTrafficTypeDao _pNTrafficTypeDao;
@@ -255,7 +319,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (purposes == null || purposes.isEmpty()) {
// since no active rules are there check if any rules are applied on the public IP but are in
// revoking state
-
+
purposes = getPublicIpPurposeInRules(ip, true, includingFirewall);
if (ip.isOneToOneNat()) {
if (purposes == null) {
@@ -372,9 +436,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
return true;
}
-
-
+
+
private Set<Purpose> getPublicIpPurposeInRules(PublicIp ip, boolean includeRevoked, boolean includingFirewall) {
Set<Purpose> result = new HashSet<Purpose>();
@@ -403,15 +467,15 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return _networksDao.listByZoneAndGuestType(owner.getId(), zoneId, Network.GuestType.Isolated, false);
}
-
+
@Override
public List<? extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner) {
return _networksDao.listSourceNATEnabledNetworks(owner.getId(), zoneId, Network.GuestType.Isolated);
}
-
-
+
+
@Override
@ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "allocating Ip", create = true)
@@ -457,7 +521,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
_accountMgr.checkAccess(caller, null, false, ipOwner);
long callerUserId = UserContext.current().getCallerUserId();
DataCenter zone = _configMgr.getZone(zoneId);
-
+
return _networkMgr.allocateIp(ipOwner, isSystem, caller, callerUserId, zone);
}
@@ -489,6 +553,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
+ @Override
public NicSecondaryIp allocateSecondaryGuestIP (Account ipOwner, long zoneId, Long nicId, Long networkId, String requestedIp) throws InsufficientAddressCapacityException {
Long accountId = null;
@@ -596,6 +661,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
+ @Override
@DB
public boolean releaseSecondaryIpFromNic (long ipAddressId) {
Account caller = UserContext.current().getCaller();
@@ -757,7 +823,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
public Network getNetwork(long id) {
return _networksDao.findById(id);
}
-
+
private void checkSharedNetworkCidrOverlap(Long zoneId, long physicalNetworkId, String cidr) {
if (zoneId == null || cidr == null) {
@@ -808,7 +874,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
}
-
+
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_CREATE, eventDescription = "creating network")
@@ -840,15 +906,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (ntwkOff == null || ntwkOff.isSystemOnly()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering by specified id");
if (ntwkOff != null) {
- ex.addProxyObject(ntwkOff, networkOfferingId, "networkOfferingId");
+ ex.addProxyObject(ntwkOff, networkOfferingId, "networkOfferingId");
// Get the VO object's table name.
String tablename = AnnotationHelper.getTableName(ntwkOff);
if (tablename != null) {
ex.addProxyObject(tablename, networkOfferingId, "networkOfferingId");
- } else {
- s_logger.info("\nCould not retrieve table name (annotation) from " + tablename + " VO proxy object\n");
}
- throw ex;
}
throw ex;
}
@@ -870,12 +933,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (zone == null) {
throw new InvalidParameterValueException("Specified zone id was not found");
}
-
+
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
// See DataCenterVO.java
PermissionDeniedException ex = new PermissionDeniedException("Cannot perform this operation since specified Zone is currently disabled");
ex.addProxyObject(zone, zoneId, "zoneId");
- throw ex;
+ throw ex;
}
// Only domain and account ACL types are supported in Acton.
@@ -895,7 +958,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
} else if (ntwkOff.getGuestType() == GuestType.Shared) {
if (!(aclType == ACLType.Domain || aclType == ACLType.Account)) {
- throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " or " +
+ throw new InvalidParameterValueException("AclType should be " + ACLType.Domain + " or " +
ACLType.Account + " for network of type " + Network.GuestType.Shared);
}
}
@@ -931,7 +994,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
DomainVO domain = _domainDao.findById(domainId);
- if (domain == null) {
+ if (domain == null) {
throw new InvalidParameterValueException("Unable to find domain by specified id");
}
_accountMgr.checkAccess(caller, domain);
@@ -957,7 +1020,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (startIPv6 != null) {
ipv6 = true;
}
-
+
if (gateway != null) {
try {
// getByName on a literal representation will only check validity of the address
@@ -974,8 +1037,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
throw new InvalidParameterValueException("Gateway parameter is invalid");
}
}
-
-
+
+
String cidr = null;
if (ipv4) {
// if end ip is not specified, default it to startIp
@@ -1008,18 +1071,18 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
-
+
if (ipv6) {
if (endIPv6 == null) {
endIPv6 = startIPv6;
}
_networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
-
+
if (zone.getNetworkType() != NetworkType.Advanced || ntwkOff.getGuestType() != Network.GuestType.Shared) {
throw new InvalidParameterValueException("Can only support create IPv6 network with advance shared network!");
}
}
-
+
// Regular user can create Guest Isolated Source Nat enabled network only
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL
&& (ntwkOff.getTrafficType() != TrafficType.Guest || ntwkOff.getGuestType() != Network.GuestType.Isolated
@@ -1033,7 +1096,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL && (ntwkOff.getSpecifyVlan() || vlanId != null)) {
throw new InvalidParameterValueException("Regular user is not allowed to specify vlanId");
}
-
+
if (ipv4) {
// For non-root admins check cidr limit - if it's allowed by global config value
if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN && cidr != null) {
@@ -1051,7 +1114,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (ipv6 && providersConfiguredForExternalNetworking(ntwkProviders)) {
throw new InvalidParameterValueException("Cannot support IPv6 on network offering with external devices!");
}
-
+
if (cidr != null && providersConfiguredForExternalNetworking(ntwkProviders)) {
if (ntwkOff.getGuestType() == GuestType.Shared && (zone.getNetworkType() == NetworkType.Advanced) &&
isSharedNetworkOfferingWithServices(networkOfferingId)) {
@@ -1067,9 +1130,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// 2) GuestType is Isolated, but SourceNat service is disabled
boolean createVlan = (startIP != null && endIP != null && zone.getNetworkType() == NetworkType.Advanced
&& ((ntwkOff.getGuestType() == Network.GuestType.Shared)
- || (ntwkOff.getGuestType() == GuestType.Isolated &&
+ || (ntwkOff.getGuestType() == GuestType.Isolated &&
!areServicesSupportedByNetworkOffering(ntwkOff.getId(), Service.SourceNat))));
-
+
if (!createVlan) {
// Only support advance shared network in IPv6, which means createVlan is a must
if (ipv6) {
@@ -1087,7 +1150,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
s_logger.info("\nCould not retrieve table name (annotation) from " + tablename + " VO proxy object\n");
}
- throw ex;
+ throw ex;
}
Transaction txn = Transaction.currentTxn();
@@ -1114,15 +1177,15 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_configMgr.isOfferingForVpc(ntwkOff)){
throw new InvalidParameterValueException("Network offering can't be used for VPC networks");
}
- network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
+ network = _vpcMgr.createVpcGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, caller);
} else {
if (_configMgr.isOfferingForVpc(ntwkOff)){
throw new InvalidParameterValueException("Network offering can be used for VPC networks only");
}
- network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
+ network = _networkMgr.createGuestNetwork(networkOfferingId, name, displayText, gateway, cidr, vlanId,
networkDomain, owner, sharedDomainId, pNtwk, zoneId, aclType, subdomainAccess, vpcId, ip6Gateway, ip6Cidr);
- }
+ }
if (caller.getType() == Account.ACCOUNT_TYPE_ADMIN && createVlan) {
// Create vlan ip range
@@ -1232,13 +1295,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
permittedAccounts.clear();
Project project = _projectMgr.getProject(projectId);
- if (project == null) {
+ if (project == null) {
throw new InvalidParameterValueException("Unable to find project by specified id");
}
if (!_projectMgr.canAccessProjectAccount(caller, project.getProjectAccountId())) {
// getProject() returns type ProjectVO.
InvalidParameterValueException ex = new InvalidParameterValueException("Account " + caller + " cannot access specified project id");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project, projectId, "projectId");
throw ex;
}
permittedAccounts.add(project.getProjectAccountId());
@@ -1250,15 +1313,15 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
path = _domainDao.findById(domainId).getPath();
} else {
path = _domainDao.findById(caller.getDomainId()).getPath();
- }
-
+ }
+
if (listAll && domainId == null) {
isRecursive = true;
}
Filter searchFilter = new Filter(NetworkVO.class, "id", false, cmd.getStartIndex(), cmd.getPageSizeVal());
SearchBuilder<NetworkVO> sb = _networksDao.createSearchBuilder();
-
+
if (forVpc != null) {
if (forVpc) {
sb.and("vpc", sb.entity().getVpcId(), Op.NNULL);
@@ -1302,8 +1365,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
SearchBuilder<AccountVO> accountSearch = _accountDao.createSearchBuilder();
accountSearch.and("typeNEQ", accountSearch.entity().getType(), SearchCriteria.Op.NEQ);
accountSearch.and("typeEQ", accountSearch.entity().getType(), SearchCriteria.Op.EQ);
-
-
+
+
sb.join("accountSearch", accountSearch, sb.entity().getAccountId(), accountSearch.entity().getId(), JoinBuilder.JoinType.INNER);
List<NetworkVO> networksToReturn = new ArrayList<NetworkVO>();
@@ -1312,7 +1375,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!permittedAccounts.isEmpty()) {
//get account level networks
networksToReturn.addAll(listAccountSpecificNetworks(
- buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+ buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
permittedAccounts));
//get domain level networks
@@ -1326,12 +1389,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
//add account specific networks
networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
- buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+ buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
isRecursive));
//add domain specific networks of domain + parent domains
networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
- buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
+ buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
isRecursive));
//add networks of subdomains
@@ -1371,7 +1434,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
networksToReturn=supportedNetworks;
}
-
+
if (canUseForDeploy != null) {
List<NetworkVO> networksForDeploy = new ArrayList<NetworkVO>();
for (NetworkVO network : networksToReturn) {
@@ -1379,16 +1442,16 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
networksForDeploy.add(network);
}
}
-
+
networksToReturn=networksForDeploy;
}
-
+
return networksToReturn;
}
-
- private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id,
+
+ private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id,
Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags, String zoneType) {
@@ -1413,9 +1476,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
if(zoneType != null) {
- sc.setJoinParameters("zoneSearch", "networkType", zoneType);
+ sc.setJoinParameters("zoneSearch", "networkType", zoneType);
}
-
+
if (guestIpType != null) {
sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
}
@@ -1445,11 +1508,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (specifyIpRanges != null) {
sc.addAnd("specifyIpRanges", SearchCriteria.Op.EQ, specifyIpRanges);
}
-
+
if (vpcId != null) {
sc.addAnd("vpcId", SearchCriteria.Op.EQ, vpcId);
}
-
+
if (tags != null && !tags.isEmpty()) {
int count = 0;
sc.setJoinParameters("tagSearch", "resourceType", TaggedResourceType.Network.toString());
@@ -1532,7 +1595,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
List<Long> networkIds = new ArrayList<Long>();
-
+
List<NetworkDomainVO> maps = _networkDomainDao.listDomainNetworkMapByDomain(allowedDomains.toArray());
for (NetworkDomainVO map : maps) {
@@ -1561,16 +1624,16 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
NetworkVO network = _networksDao.findById(networkId);
if (network == null) {
// see NetworkVO.java
-
+
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find network with specified id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network, networkId, "networkId");
throw ex;
}
// don't allow to delete system network
if (isNetworkSystem(network)) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id is system and can't be removed");
- ex.addProxyObject(network, network.getId(), "networkId");
+ ex.addProxyObject(network, network.getId(), "networkId");
throw ex;
}
@@ -1585,7 +1648,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return _networkMgr.destroyNetwork(networkId, context);
}
-
+
@Override
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_RESTART, eventDescription = "restarting network", async = true)
public boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
@@ -1597,7 +1660,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// Check if network exists
NetworkVO network = _networksDao.findById(networkId);
- if (network == null) {
+ if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network with specified id doesn't exist");
ex.addProxyObject("networks", networkId, "networkId");
throw ex;
@@ -1607,9 +1670,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!(network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup)) {
throw new InvalidParameterValueException("Network is not in the right state to be restarted. Correct states are: " + Network.State.Implemented + ", " + Network.State.Setup);
}
-
+
if (network.getBroadcastDomainType() == BroadcastDomainType.Lswitch ) {
- /**
+ /**
* Unable to restart these networks now.
* TODO Restarting a SDN based network requires updating the nics and the configuration
* in the controller. This requires a non-trivial rewrite of the restart procedure.
@@ -1635,15 +1698,15 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return _networksDao.getActiveNicsIn(networkId);
}
-
-
-
+
+
+
protected Map<Capability, String> getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service) {
if (!areServicesSupportedByNetworkOffering(offering.getId(), service)) {
- // TBD: We should be sending networkOfferingId and not the offering object itself.
+ // TBD: We should be sending networkOfferingId and not the offering object itself.
throw new UnsupportedServiceException("Service " + service.getName() + " is not supported by the network offering " + offering);
}
@@ -1676,14 +1739,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return serviceCapabilities;
}
-
-
+
+
@Override
public IpAddress getIp(long ipAddressId) {
return _ipAddressDao.findById(ipAddressId);
}
-
+
protected boolean providersConfiguredForExternalNetworking(Collection<String> providers) {
for(String providerStr : providers){
Provider provider = Network.Provider.getProvider(providerStr);
@@ -1707,32 +1770,32 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return false;
}
-
+
protected boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services) {
return (_ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(networkOfferingId, services));
}
-
+
protected boolean areServicesSupportedInNetwork(long networkId, Service... services) {
return (_ntwkSrvcDao.areServicesSupportedInNetwork(networkId, services));
}
-
-
-
-
+
+
+
+
private boolean checkForNonStoppedVmInNetwork(long networkId) {
- List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting,
+ List<UserVmVO> vms = _userVmDao.listByNetworkIdAndStates(networkId, VirtualMachine.State.Starting,
VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping);
return vms.isEmpty();
}
-
+
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
- public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
+ public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
User callerUser, String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr) {
boolean restartNetwork = false;
@@ -1744,7 +1807,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
ex.addProxyObject("networks", networkId, "networkId");
throw ex;
}
-
+
//perform below validation if the network is vpc network
if (network.getVpcId() != null && networkOfferingId != null) {
Vpc vpc = _vpcMgr.getVpc(network.getVpcId());
@@ -1766,7 +1829,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (network.getTrafficType() != Networks.TrafficType.Guest) {
throw new InvalidParameterValueException("Can't allow networks which traffic type is not " + TrafficType.Guest);
}
-
+
_accountMgr.checkAccess(callerAccount, null, true, network);
if (name != null) {
@@ -1790,14 +1853,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (networkOfferingId != null) {
if (networkOffering == null || networkOffering.isSystemOnly()) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to find network offering with specified id");
- ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
+ ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
throw ex;
}
-
+
// network offering should be in Enabled state
if (networkOffering.getState() != NetworkOffering.State.Enabled) {
InvalidParameterValueException ex = new InvalidParameterValueException("Network offering with specified id is not in " + NetworkOffering.State.Enabled + " state, can't upgrade to it");
- ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
+ ex.addProxyObject(networkOffering, networkOfferingId, "networkOfferingId");
throw ex;
}
//can't update from vpc to non-vpc network offering
@@ -1811,7 +1874,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (networkOfferingId != oldNetworkOfferingId) {
Collection<String> newProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(networkOffering, network.getPhysicalNetworkId()).values();
Collection<String> oldProviders = _networkMgr.finalizeServicesAndProvidersForNetwork(oldNtwkOff, network.getPhysicalNetworkId()).values();
-
+
if (providersConfiguredForExternalNetworking(newProviders) != providersConfiguredForExternalNetworking(oldProviders)
&& !changeCidr) {
throw new InvalidParameterValueException("Updating network failed since guest CIDR needs to be changed!");
@@ -1819,7 +1882,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (changeCidr) {
if (!checkForNonStoppedVmInNetwork(network.getId())) {
InvalidParameterValueException ex = new InvalidParameterValueException("All user vm of network of specified id should be stopped before changing CIDR!");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network, networkId, "networkId");
throw ex;
}
}
@@ -1952,7 +2015,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_networkMgr.shutdownNetworkElementsAndResources(context, true, network)) {
s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network);
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network of specified id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network, networkId, "networkId");
throw ex;
}
} else {
@@ -1971,13 +2034,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (!_networkMgr.shutdownNetwork(network.getId(), context, true)) {
s_logger.warn("Failed to shutdown the network as a part of update to network with specified id");
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network as a part of update of specified network id");
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network, networkId, "networkId");
throw ex;
}
}
} else {
CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network with specified id; network is in wrong state: " + network.getState());
- ex.addProxyObject(network, networkId, "networkId");
+ ex.addProxyObject(network, networkId, "networkId");
throw ex;
}
}
@@ -2039,7 +2102,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} catch (Exception ex) {
s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id) elements and resources as a part of network update");
- e.addProxyObject(network, networkId, "networkId");
+ e.addProxyObject(network, networkId, "networkId");
throw e;
}
}
@@ -2072,7 +2135,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
protected Set<Long> getAvailableIps(Network network, String requestedIp) {
String[] cidr = network.getCidr().split("/");
List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
- Set<Long> usedIps = new TreeSet<Long>();
+ Set<Long> usedIps = new TreeSet<Long>();
for (String ip : ips) {
if (requestedIp != null && requestedIp.equals(ip)) {
@@ -2092,7 +2155,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
-
+
protected boolean canUpgrade(Network network, long oldNetworkOfferingId, long newNetworkOfferingId) {
NetworkOffering oldNetworkOffering = _networkOfferingDao.findByIdIncludingRemoved(oldNetworkOfferingId);
NetworkOffering newNetworkOffering = _networkOfferingDao.findById(newNetworkOfferingId);
@@ -2162,12 +2225,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return canIpsUseOffering(publicIps, newNetworkOfferingId);
}
-
+
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_PHYSICAL_NETWORK_CREATE, eventDescription = "Creating Physical Network", create = true)
- public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String>
+ public PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String>
isolationMethods, String broadcastDomainRangeStr, Long domainId, List<String> tags, String name) {
// Check if zone exists
@@ -2272,13 +2335,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// add security group provider to the physical network
addDefaultSecurityGroupProviderToPhysicalNetwork(pNetwork.getId());
-
+
// add VPCVirtualRouter as the defualt network service provider
addDefaultVpcVirtualRouterToPhysicalNetwork(pNetwork.getId());
// add baremetal as the defualt network service provider
/* addDefaultBaremetalProvidersToPhysicalNetwork(pNetwork.getId()); */
-
+
txn.commit();
return pNetwork;
} catch (Exception ex) {
@@ -2317,7 +2380,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO network = _physicalNetworkDao.findById(id);
if (network == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(network, id, "physicalNetworkId");
+ ex.addProxyObject(network, id, "physicalNetworkId");
throw ex;
}
@@ -2325,7 +2388,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
DataCenter zone = _dcDao.findById(network.getDataCenterId());
if (zone == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Zone with id=" + network.getDataCenterId() + " doesn't exist in the system");
- ex.addProxyObject(zone, network.getDataCenterId(), "dataCenterId");
+ ex.addProxyObject(zone, network.getDataCenterId(), "dataCenterId");
throw ex;
}
if (newVnetRangeString != null) {
@@ -2598,7 +2661,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
if (pNetwork == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(pNetwork, physicalNetworkId, "physicalNetworkId");
+ ex.addProxyObject(pNetwork, physicalNetworkId, "physicalNetworkId");
throw ex;
}
@@ -2625,7 +2688,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// delete service providers
List<PhysicalNetworkServiceProviderVO> providers = _pNSPDao.listBy(physicalNetworkId);
-
+
for(PhysicalNetworkServiceProviderVO provider : providers){
try {
deleteNetworkServiceProvider(provider.getId());
@@ -2642,7 +2705,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
_pNTrafficTypeDao.deleteTrafficTypes(physicalNetworkId);
boolean success = _physicalNetworkDao.remove(physicalNetworkId);
-
+
txn.commit();
return success;
@@ -2994,7 +3057,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
-
+
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_PROVIDER_CREATE, eventDescription = "Creating Physical Network ServiceProvider", create = true)
@@ -3013,7 +3076,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO destNetwork = _physicalNetworkDao.findById(destinationPhysicalNetworkId);
if (destNetwork == null) {
InvalidParameterValueException ex = new InvalidParameterValueException("Destination Physical Network with specified id doesn't exist in the system");
- ex.addProxyObject(destNetwork, destinationPhysicalNetworkId, "destinationPhysicalNetworkId");
+ ex.addProxyObject(destNetwork, destinationPhysicalNetworkId, "destinationPhysicalNetworkId");
throw ex;
}
}
@@ -3255,7 +3318,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
} else {
pNtwks = _physicalNetworkDao.listByZone(zoneId);
}
-
+
if (pNtwks.isEmpty()) {
throw new InvalidParameterValueException("Unable to find physical network in zone id=" + zoneId);
}
@@ -3282,8 +3345,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
-
-
+
+
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_TRAFFIC_TYPE_CREATE, eventDescription = "Creating Physical Network TrafficType", create = true)
@@ -3448,7 +3511,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return new Pair<List<? extends PhysicalNetworkTrafficType>, Integer>(result.first(), result.second());
}
-
+
@@ -3475,23 +3538,23 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (networkElement == null) {
throw new CloudRuntimeException("Unable to find the Network Element implementing the VirtualRouter Provider");
}
-
+
VirtualRouterElement element = (VirtualRouterElement)networkElement;
element.addElement(nsp.getId(), VirtualRouterProviderType.VirtualRouter);
return nsp;
}
-
+
protected PhysicalNetworkServiceProvider addDefaultVpcVirtualRouterToPhysicalNetwork(long physicalNetworkId) {
- PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
+ PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
Network.Provider.VPCVirtualRouter.getName(), null, null);
-
+
NetworkElement networkElement = _networkModel.getElementImplementingProvider(Network.Provider.VPCVirtualRouter.getName());
if (networkElement == null) {
throw new CloudRuntimeException("Unable to find the Network Element implementing the VPCVirtualRouter Provider");
}
-
+
VpcVirtualRouterElement element = (VpcVirtualRouterElement)networkElement;
element.addElement(nsp.getId(), VirtualRouterProviderType.VPCVirtualRouter);
@@ -3500,7 +3563,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
protected PhysicalNetworkServiceProvider addDefaultSecurityGroupProviderToPhysicalNetwork(long physicalNetworkId) {
- PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
+ PhysicalNetworkServiceProvider nsp = addProviderToPhysicalNetwork(physicalNetworkId,
Network.Provider.SecurityGroupProvider.getName(), null, null);
return nsp;
@@ -3510,13 +3573,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
PhysicalNetworkVO pvo = _physicalNetworkDao.findById(physicalNetworkId);
DataCenterVO dvo = _dcDao.findById(pvo.getDataCenterId());
if (dvo.getNetworkType() == NetworkType.Basic) {
-
+
// Baremetal is currently disabled
/*
addProviderToPhysicalNetwork(physicalNetworkId, "BaremetalDhcpProvider", null, null);
addProviderToPhysicalNetwork(physicalNetworkId, "BaremetalPxeProvider", null, null);
addProviderToPhysicalNetwork(physicalNetworkId, "BaremetaUserdataProvider", null, null);
-*/
+*/
}
return null;
}
@@ -3530,13 +3593,13 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
-
-
+
+
private boolean getAllowSubdomainAccessGlobal() {
return _allowSubdomainNetworkAccess;
}
-
+
@Override
public List<Pair<TrafficType, String>> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd) {
@@ -3561,7 +3624,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
return results;
}
-
+
@Override
@ActionEvent(eventType = EventTypes.EVENT_NET_IP_ASSIGN, eventDescription = "associating Ip", async = true)
public IpAddress associateIPToNetwork(long ipId, long networkId) throws InsufficientAddressCapacityException,
@@ -3577,20 +3640,20 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
" to VPC.Specify vpcId to associate ip address to VPC");
}
return _networkMgr.associateIPToGuestNetwork(ipId, networkId, true);
-
+
}
-
+
@Override @DB
public Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId,
String vlan, String startIp, String endIp, String gateway, String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat)
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException {
-
+
Account owner = _accountMgr.getAccount(networkOwnerId);
-
+
// Get system network offeirng
NetworkOfferingVO ntwkOff = findSystemNetworkOffering(NetworkOffering.SystemPrivateGatewayNetworkOffering);
-
+
// Validate physical network
PhysicalNetwork pNtwk = _physicalNetworkDao.findById(physicalNetworkId);
if (pNtwk == null) {
@@ -3599,7 +3662,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
ex.addProxyObject("physical_network", physicalNetworkId, "physicalNetworkId");
throw ex;
}
-
+
// VALIDATE IP INFO
// if end ip is not specified, default it to startIp
if (!NetUtils.isValidIp(startIp)) {
@@ -3620,49 +3683,49 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
cidr = NetUtils.ipAndNetMaskToCidr(gateway, netmask);
-
-
+
+
Transaction txn = Transaction.currentTxn();
txn.start();
-
+
//lock datacenter as we need to get mac address seq from there
DataCenterVO dc = _dcDao.lockRow(pNtwk.getDataCenterId(), true);
-
+
//check if we need to create guest network
Network privateNetwork = _networksDao.getPrivateNetwork(BroadcastDomainType.Vlan.toUri(vlan).toString(), cidr,
networkOwnerId, pNtwk.getDataCenterId());
if (privateNetwork == null) {
//create Guest network
- privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan,
+ privateNetwork = _networkMgr.createGuestNetwork(ntwkOff.getId(), networkName, displayText, gateway, cidr, vlan,
null, owner, null, pNtwk, pNtwk.getDataCenterId(), ACLType.Account, null, null, null, null);
s_logger.debug("Created private network " + privateNetwork);
} else {
s_logger.debug("Private network already exists: " + privateNetwork);
}
-
+
//add entry to private_ip_address table
PrivateIpVO privateIp = _privateIpDao.findByIpAndSourceNetworkId(privateNetwork.getId(), startIp);
if (privateIp != null) {
throw new InvalidParameterValueException("Private ip address " + startIp + " already used for private gateway" +
" in zone " + _configMgr.getZone(pNtwk.getDataCenterId()).getName());
}
-
+
Long mac = dc.getMacAddress();
Long nextMac = mac + 1;
dc.setMacAddress(nextMac);
privateIp = new PrivateIpVO(startIp, privateNetwork.getId(), nextMac, vpcId, sourceNat);
_privateIpDao.persist(privateIp);
-
+
_dcDao.update(dc.getId(), dc);
-
+
txn.commit();
s_logger.debug("Private network " + privateNetwork + " is created");
return privateNetwork;
}
-
+
private NetworkOfferingVO findSystemNetworkOffering(String offeringName) {
List<NetworkOfferingVO> allOfferings = _networkOfferingDao.listSystemNetworkOfferings();
for (NetworkOfferingVO offer: allOfferings){
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/src/com/cloud/servlet/ConsoleProxyServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/ConsoleProxyServlet.java b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
index ebb9174..097986b 100644
--- a/server/src/com/cloud/servlet/ConsoleProxyServlet.java
+++ b/server/src/com/cloud/servlet/ConsoleProxyServlet.java
@@ -73,7 +73,7 @@ public class ConsoleProxyServlet extends HttpServlet {
@Inject AccountManager _accountMgr;
@Inject VirtualMachineManager _vmMgr;
@Inject ManagementServer _ms;
- @Inject IdentityService _identityService;
+ @Inject IdentityService _identityService;
static ManagementServer s_ms;
@@ -81,13 +81,13 @@ public class ConsoleProxyServlet extends HttpServlet {
public ConsoleProxyServlet() {
}
-
+
@Override
public void init(ServletConfig config) throws ServletException {
- SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
+ SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
s_ms = _ms;
}
-
+
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
doGet(req, resp);
@@ -274,7 +274,7 @@ public class ConsoleProxyServlet extends HttpServlet {
private void handleAuthRequest(HttpServletRequest req, HttpServletResponse resp, long vmId) {
- // TODO authentication channel between console proxy VM and management server needs to be secured,
+ // TODO authentication channel between console proxy VM and management server needs to be secured,
// the data is now being sent through private network, but this is apparently not enough
VMInstanceVO vm = _vmMgr.findById(vmId);
if(vm == null) {
@@ -334,11 +334,11 @@ public class ConsoleProxyServlet extends HttpServlet {
private String getEncryptorPassword() {
String key = _ms.getEncryptionKey();
String iv = _ms.getEncryptionIV();
-
+
ConsoleProxyPasswordBasedEncryptor.KeyIVPair keyIvPair = new ConsoleProxyPasswordBasedEncryptor.KeyIVPair(key, iv);
return _gson.toJson(keyIvPair);
}
-
+
private String composeThumbnailUrl(String rootUrl, VMInstanceVO vm, HostVO hostVo, int w, int h) {
StringBuffer sb = new StringBuffer(rootUrl);
@@ -385,8 +385,7 @@ public class ConsoleProxyServlet extends HttpServlet {
Ternary<String, String, String> parsedHostInfo = parseHostInfo(portInfo.first());
String sid = vm.getVncPassword();
- String tag = String.valueOf(vm.getId());
- tag = _identityService.getIdentityUuid("vm_instance", tag);
+ String tag = vm.getUuid();
String ticket = genAccessTicket(host, String.valueOf(portInfo.second()), sid, tag);
ConsoleProxyPasswordBasedEncryptor encryptor = new ConsoleProxyPasswordBasedEncryptor(getEncryptorPassword());
ConsoleProxyClientParam param = new ConsoleProxyClientParam();
@@ -473,12 +472,12 @@ public class ConsoleProxyServlet extends HttpServlet {
} catch (PermissionDeniedException ex) {
if (accountObj.getType() == Account.ACCOUNT_TYPE_NORMAL) {
if (s_logger.isDebugEnabled()) {
- s_logger.debug("VM access is denied. VM owner account " + vm.getAccountId()
+ s_logger.debug("VM access is denied. VM owner account " + vm.getAccountId()
+ " does not match the account id in session " + accountObj.getId() + " and caller is a normal user");
}
} else if(accountObj.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN || accountObj.getType() == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN) {
if(s_logger.isDebugEnabled()) {
- s_logger.debug("VM access is denied. VM owner account " + vm.getAccountId()
+ s_logger.debug("VM access is denied. VM owner account " + vm.getAccountId()
+ " does not match the account id in session " + accountObj.getId() + " and the domain-admin caller does not manage the target domain");
}
}
@@ -515,7 +514,7 @@ public class ConsoleProxyServlet extends HttpServlet {
account = _accountMgr.getAccount(user.getAccountId());
}
- if ((user == null) || (user.getRemoved() != null) || !user.getState().equals(Account.State.enabled)
+ if ((user == null) || (user.getRemoved() != null) || !user.getState().equals(Account.State.enabled)
|| (account == null) || !account.getState().equals(Account.State.enabled)) {
s_logger.warn("Deleted/Disabled/Locked user with id=" + userId + " attempting to access public API");
return false;
@@ -586,7 +585,7 @@ public class ConsoleProxyServlet extends HttpServlet {
if (!user.getState().equals(Account.State.enabled) || !account.getState().equals(Account.State.enabled)) {
s_logger.debug("disabled or locked user accessing the api, userid = " + user.getId() + "; name = " + user.getUsername() + "; state: " + user.getState() + "; accountState: " + account.getState());
return false;
- }
+ }
// verify secret key exists
secretKey = user.getSecretKey();
@@ -632,10 +631,10 @@ public class ConsoleProxyServlet extends HttpServlet {
case '>': sb.append(">"); break;
case '&': sb.append("&"); break;
case '"': sb.append("""); break;
- case ' ': sb.append(" ");break;
+ case ' ': sb.append(" ");break;
default: sb.append(c); break;
}
}
return sb.toString();
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/network/security/SecurityGroupManagerTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/network/security/SecurityGroupManagerTestConfiguration.java b/server/test/com/cloud/network/security/SecurityGroupManagerTestConfiguration.java
index b3a9ff1..e2e9d68 100644
--- a/server/test/com/cloud/network/security/SecurityGroupManagerTestConfiguration.java
+++ b/server/test/com/cloud/network/security/SecurityGroupManagerTestConfiguration.java
@@ -19,6 +19,7 @@ package com.cloud.network.security;
import java.io.IOException;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -60,7 +61,6 @@ import com.cloud.tags.dao.ResourceTagsDaoImpl;
import com.cloud.user.AccountManager;
import com.cloud.user.DomainManager;
import com.cloud.user.dao.AccountDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.dao.NicDaoImpl;
@@ -151,7 +151,7 @@ public class SecurityGroupManagerTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = SecurityGroupManagerTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/snapshot/SnapshotDaoTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/snapshot/SnapshotDaoTestConfiguration.java b/server/test/com/cloud/snapshot/SnapshotDaoTestConfiguration.java
index cc410db..6695edc 100644
--- a/server/test/com/cloud/snapshot/SnapshotDaoTestConfiguration.java
+++ b/server/test/com/cloud/snapshot/SnapshotDaoTestConfiguration.java
@@ -19,6 +19,7 @@ package com.cloud.snapshot;
import java.io.IOException;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
@@ -36,7 +37,6 @@ import com.cloud.host.dao.HostTagsDaoImpl;
import com.cloud.storage.dao.SnapshotDaoImpl;
import com.cloud.storage.dao.VolumeDaoImpl;
import com.cloud.tags.dao.ResourceTagsDaoImpl;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.dao.NicDaoImpl;
import com.cloud.vm.dao.VMInstanceDaoImpl;
@@ -65,7 +65,7 @@ public class SnapshotDaoTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = SnapshotDaoTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/storage/dao/StoragePoolDaoTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/storage/dao/StoragePoolDaoTestConfiguration.java b/server/test/com/cloud/storage/dao/StoragePoolDaoTestConfiguration.java
index 58de4d2..2f79ff0 100644
--- a/server/test/com/cloud/storage/dao/StoragePoolDaoTestConfiguration.java
+++ b/server/test/com/cloud/storage/dao/StoragePoolDaoTestConfiguration.java
@@ -20,6 +20,7 @@ package com.cloud.storage.dao;
import java.io.IOException;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
@@ -28,7 +29,6 @@ import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
-import com.cloud.utils.component.SpringComponentScanUtils;
@Configuration
@ComponentScan(basePackageClasses={
@@ -46,7 +46,7 @@ public class StoragePoolDaoTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = StoragePoolDaoTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java b/server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java
index 6e22e17..3bd4df8 100644
--- a/server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java
+++ b/server/test/com/cloud/vm/dao/UserVmCloneSettingDaoTestConfiguration.java
@@ -19,6 +19,7 @@ package com.cloud.vm.dao;
import java.io.IOException;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
@@ -27,7 +28,6 @@ import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
-import com.cloud.utils.component.SpringComponentScanUtils;
import com.cloud.vm.dao.UserVmCloneSettingDaoImpl;
@Configuration
@@ -45,7 +45,7 @@ public class UserVmCloneSettingDaoTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = UserVmCloneSettingDaoTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3722d66a/server/test/com/cloud/vm/dao/UserVmDaoTestConfiguration.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vm/dao/UserVmDaoTestConfiguration.java b/server/test/com/cloud/vm/dao/UserVmDaoTestConfiguration.java
index 6a63fab..7af772c 100644
--- a/server/test/com/cloud/vm/dao/UserVmDaoTestConfiguration.java
+++ b/server/test/com/cloud/vm/dao/UserVmDaoTestConfiguration.java
@@ -19,6 +19,7 @@ package com.cloud.vm.dao;
import java.io.IOException;
+import org.apache.cloudstack.test.utils.SpringUtils;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
@@ -27,7 +28,6 @@ import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
-import com.cloud.utils.component.SpringComponentScanUtils;
@Configuration
@ComponentScan(basePackageClasses={
@@ -43,7 +43,7 @@ public class UserVmDaoTestConfiguration {
public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
mdr.getClassMetadata().getClassName();
ComponentScan cs = UserVmDaoTestConfiguration.class.getAnnotation(ComponentScan.class);
- return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
}
}
[24/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
[MARVIN] Fixing dedicate_guest_vlan_range test
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3a41a83f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3a41a83f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3a41a83f
Branch: refs/heads/vmware-datamodel
Commit: 3a41a83f885cfd05b9fd951738abab30353618df
Parents: 20bc334
Author: Likitha Shetty <li...@citrix.com>
Authored: Wed May 8 11:20:12 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Wed May 8 11:22:16 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_guest_vlan_range.py | 17 +++++++----------
tools/marvin/marvin/integration/lib/base.py | 2 +-
2 files changed, 8 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a41a83f/test/integration/smoke/test_guest_vlan_range.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_guest_vlan_range.py b/test/integration/smoke/test_guest_vlan_range.py
index 1723477..13cf335 100644
--- a/test/integration/smoke/test_guest_vlan_range.py
+++ b/test/integration/smoke/test_guest_vlan_range.py
@@ -149,15 +149,12 @@ class TestDedicateGuestVlanRange(cloudstackTestCase):
)
self.debug("Releasing guest vlan range");
- dedicated_guest_vlan_response.release(self.apiclient)
- list_dedicated_guest_vlan_range_response = PhysicalNetwork.listDedicated(
- self.apiclient,
- id=dedicate_guest_vlan_range_response.id
- )
- dedicated_guest_vlan_response = list_dedicated_guest_vlan_range_response[0]
+ dedicate_guest_vlan_range_response.release(self.apiclient)
+ list_dedicated_guest_vlan_range_response = PhysicalNetwork.listDedicated(self.apiclient)
self.assertEqual(
- dedicated_guest_vlan_response.account,
- "system",
- "Check account name is system account in listDedicatedGuestVlanRanges"
- )
+ list_dedicated_guest_vlan_range_response,
+ None,
+ "Check vlan range is not available in listDedicatedGuestVlanRanges"
+
+ )
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a41a83f/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 cdb6a36..92b8a2d 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -2202,7 +2202,7 @@ class PhysicalNetwork:
cmd = listDedicatedGuestVlanRanges.listDedicatedGuestVlanRangesCmd()
[setattr(cmd, k, v) for k, v in kwargs.items()]
- return map(lambda pn : PhysicalNetwork(pn.__dict__), apiclient.listDedicatedGuestVlanRanges(cmd))
+ return apiclient.listDedicatedGuestVlanRanges(cmd)
@classmethod
def list(cls, apiclient, **kwargs):
[38/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-1907: Debian Squeeze 6.0 (64-bit) is not experimental any more
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/738d35a6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/738d35a6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/738d35a6
Branch: refs/heads/vmware-datamodel
Commit: 738d35a61d12aa4ff11114aef89f546a077e8629
Parents: 99d0936
Author: Edison Su <su...@gmail.com>
Authored: Wed May 8 11:40:37 2013 -0700
Committer: Chip Childers <ch...@gmail.com>
Committed: Wed May 8 19:54:54 2013 +0100
----------------------------------------------------------------------
.../xen/discoverer/XcpServerDiscoverer.java | 7 +-
.../hypervisor/xen/resource/CitrixHelper.java | 87 +++++++++++++++
.../hypervisor/xen/resource/XcpServerResource.java | 11 ++-
3 files changed, 100 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/738d35a6/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 89bc1cf..562a7fe 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
@@ -427,8 +427,11 @@ 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") || prodVersion.startsWith("1.6")))
- return new XcpServerResource();
+ 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");
+ } 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();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/738d35a6/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 5bcec13..34b8f29 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
@@ -28,6 +28,7 @@ import org.apache.log4j.Logger;
public class CitrixHelper {
private static final Logger s_logger = Logger.getLogger(CitrixHelper.class);
private static final HashMap<String, String> _xcp100GuestOsMap = new HashMap<String, String>(70);
+ private static final HashMap<String, String> _xcp160GuestOsMap = new HashMap<String, String>(70);
private static final HashMap<String, String> _xenServerGuestOsMap = new HashMap<String, String>(70);
private static final HashMap<String, String> _xenServer56FP1GuestOsMap = new HashMap<String, String>(70);
private static final HashMap<String, String> _xenServer56FP2GuestOsMap = new HashMap<String, String>(70);
@@ -114,6 +115,83 @@ public class CitrixHelper {
_xcp100GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
}
+ static {
+ _xcp160GuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 4.6 (32-bit)", "CentOS 4.6 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 4.7 (32-bit)", "CentOS 4.7 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 4.8 (32-bit)", "CentOS 4.8 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.0 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.0 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.1 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.1 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.2 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.2 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.3 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.3 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.4 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.4 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.5 (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("CentOS 5.5 (64-bit)", "CentOS 5 (64-bit)");
+ _xcp160GuestOsMap.put("Debian GNU/Linux 5.0 (32-bit)", "Debian Lenny 5.0 (32-bit)");
+ _xcp160GuestOsMap.put("Debian GNU/Linux 6(32-bit)", "Debian Squeeze 6.0 (32-bit)");
+ _xcp160GuestOsMap.put("Debian GNU/Linux 6(64-bit)", "Debian Squeeze 6.0 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.0 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.1 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.2 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.3 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.4 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (32-bit)", "Oracle Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Oracle Enterprise Linux 5.5 (64-bit)", "Oracle Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.5 (32-bit)", "Red Hat Enterprise Linux 4.5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.6 (32-bit)", "Red Hat Enterprise Linux 4.6 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.7 (32-bit)", "Red Hat Enterprise Linux 4.7 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 4.8 (32-bit)", "Red Hat Enterprise Linux 4.8 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.0 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.1 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.2 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.3 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.4 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (32-bit)", "Red Hat Enterprise Linux 5 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 5.5 (64-bit)", "Red Hat Enterprise Linux 5 (64-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (32-bit)", "Red Hat Enterprise Linux 6 (32-bit)");
+ _xcp160GuestOsMap.put("Red Hat Enterprise Linux 6.0 (64-bit)", "Red Hat Enterprise Linux 6 (64-bit)");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 9 SP4 (32-bit)", "SUSE Linux Enterprise Server 9 SP4");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (32-bit)", "SUSE Linux Enterprise Server 10 SP1");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP1 (64-bit)", "SUSE Linux Enterprise Server 10 SP1 x64");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (32-bit)", "SUSE Linux Enterprise Server 10 SP2");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP2 (64-bit)", "SUSE Linux Enterprise Server 10 SP2 x64");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 10 SP3 (64-bit)", "Other install media");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (32-bit)", "SUSE Linux Enterprise Server 11");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 (64-bit)", "SUSE Linux Enterprise Server 11 x64");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (32-bit)", "SUSE Linux Enterprise Server 11 SP1 (32-bit)");
+ _xcp160GuestOsMap.put("SUSE Linux Enterprise Server 11 SP1 (64-bit)", "SUSE Linux Enterprise Server 11 SP1 (64-bit)");
+ _xcp160GuestOsMap.put("Windows 7 (32-bit)", "Windows 7 (32-bit)");
+ _xcp160GuestOsMap.put("Windows 7 (64-bit)", "Windows 7 (64-bit)");
+ _xcp160GuestOsMap.put("Windows Server 2003 (32-bit)", "Windows Server 2003 (32-bit)");
+ _xcp160GuestOsMap.put("Windows Server 2003 (64-bit)", "Windows Server 2003 (64-bit)");
+ _xcp160GuestOsMap.put("Windows Server 2008 (32-bit)", "Windows Server 2008 (32-bit)");
+ _xcp160GuestOsMap.put("Windows Server 2008 (64-bit)", "Windows Server 2008 (64-bit)");
+ _xcp160GuestOsMap.put("Windows Server 2008 R2 (64-bit)", "Windows Server 2008 R2 (64-bit)");
+ _xcp160GuestOsMap.put("Windows XP SP3 (32-bit)", "Windows XP SP3 (32-bit)");
+ _xcp160GuestOsMap.put("Windows Vista (32-bit)", "Windows Vista (32-bit)");
+ _xcp160GuestOsMap.put("Ubuntu 10.04 (32-bit)", "Ubuntu Lucid Lynx 10.04 (32-bit) (experimental)");
+ _xcp160GuestOsMap.put("Ubuntu 10.04 (64-bit)", "Ubuntu Lucid Lynx 10.04 (64-bit) (experimental)");
+ _xcp160GuestOsMap.put("Other Linux (32-bit)", "Other install media");
+ _xcp160GuestOsMap.put("Other Linux (64-bit)", "Other install media");
+ _xcp160GuestOsMap.put("Other PV (32-bit)", "CentOS 5 (32-bit)");
+ _xcp160GuestOsMap.put("Other PV (64-bit)", "CentOS 5 (64-bit)");
+ }
+
static {
_xenServerGuestOsMap.put("CentOS 4.5 (32-bit)", "CentOS 4.5 (32-bit)");
@@ -694,6 +772,15 @@ public class CitrixHelper {
return guestOS;
}
+ public static String getXcp160GuestOsType(String stdType) {
+ String guestOS = _xcp160GuestOsMap.get(stdType);
+ if (guestOS == null) {
+ s_logger.debug("Can't find the guest os: " + stdType + " mapping into XCP's guestOS type, start it as HVM guest");
+ guestOS = "Other install media";
+ }
+ return guestOS;
+ }
+
public static String getXenServerGuestOsType(String stdType, boolean bootFromCD) {
String guestOS = _xenServerGuestOsMap.get(stdType);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/738d35a6/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 7a95870..6baf6a0 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
@@ -39,9 +39,10 @@ import com.xensource.xenapi.Types.XenAPIException;
@Local(value=ServerResource.class)
public class XcpServerResource extends CitrixResourceBase {
private final static Logger s_logger = Logger.getLogger(XcpServerResource.class);
-
- public XcpServerResource() {
+ private String version;
+ public XcpServerResource(String version) {
super();
+ this.version = version;
}
@Override
@@ -55,7 +56,11 @@ public class XcpServerResource extends CitrixResourceBase {
@Override
protected String getGuestOsType(String stdType, boolean bootFromCD) {
- return CitrixHelper.getXcpGuestOsType(stdType);
+ if (version.equalsIgnoreCase("1.6")) {
+ return CitrixHelper.getXcp160GuestOsType(stdType);
+ } else {
+ return CitrixHelper.getXcpGuestOsType(stdType);
+ }
}
@Override
[25/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-957: Localization -- Add UK keyboard support.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b6cb23cb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b6cb23cb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b6cb23cb
Branch: refs/heads/vmware-datamodel
Commit: b6cb23cb99c9daee41b46a3fc13fffabfb791dc3
Parents: 3a41a83
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Wed Apr 3 11:56:17 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Wed May 8 12:06:07 2013 +0530
----------------------------------------------------------------------
services/console-proxy/server/css/ajaxviewer.css | 6 +-
services/console-proxy/server/js/ajaxkeys.js | 295 +++++++++++++--
services/console-proxy/server/js/ajaxviewer.js | 128 ++-----
.../cloud/consoleproxy/ConsoleProxyClientBase.java | 1 +
4 files changed, 295 insertions(+), 135 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/css/ajaxviewer.css
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/css/ajaxviewer.css b/services/console-proxy/server/css/ajaxviewer.css
index 5ea552b..fd2fb3c 100644
--- a/services/console-proxy/server/css/ajaxviewer.css
+++ b/services/console-proxy/server/css/ajaxviewer.css
@@ -91,12 +91,12 @@ body {
position: absolute;
top:32;
width: 260;
- height: 65;
+ height: 95;
display: block;
display: none;
border-top: 1px solid black;
- background-image:url(/resource/images/back.gif);
- background-repeat:repeat-x repeat-y;
+ background-image:url(/resource/images/back.gif);
+ background-repeat:repeat-x repeat-y;
}
#toolbar ul li ul li {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/js/ajaxkeys.js
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/js/ajaxkeys.js b/services/console-proxy/server/js/ajaxkeys.js
index 2ecf5b5..1ed41c5 100644
--- a/services/console-proxy/server/js/ajaxkeys.js
+++ b/services/console-proxy/server/js/ajaxkeys.js
@@ -23,55 +23,286 @@ under the License.
* They are used by the ajaxviewer.js
*/
-//client event type. corresponds to events in ajaxviewer.
-X11_KEY_CIRCUMFLEX_ACCENT = 0x5e; // ^
-X11_KEY_YEN_MARK = 0xa5;
+//client event type. corresponds to events in ajaxviewer.
+
+
+//use java AWT key modifier masks
+JS_KEY_BACKSPACE = 8;
+JS_KEY_TAB = 9;
+JS_KEY_ENTER = 13;
+JS_KEY_SHIFT = 16;
+JS_KEY_CTRL = 17;
+JS_KEY_ALT = 18;
+JS_KEY_CAPSLOCK = 20;
+JS_KEY_ESCAPE = 27;
+JS_KEY_PAGEUP = 33;
+JS_KEY_PAGEDOWN = 34;
+JS_KEY_END = 35;
+JS_KEY_HOME = 36;
+JS_KEY_LEFT = 37;
+JS_KEY_UP = 38;
+JS_KEY_RIGHT = 39;
+JS_KEY_DOWN = 40;
+JS_KEY_INSERT = 45;
+JS_KEY_DELETE = 46;
+JS_KEY_SELECT_KEY = 93;
+JS_KEY_NUMPAD0 = 96;
+JS_KEY_NUMPAD1 = 97;
+JS_KEY_NUMPAD2 = 98;
+JS_KEY_NUMPAD3 = 99;
+JS_KEY_NUMPAD4 = 100;
+JS_KEY_NUMPAD5 = 101;
+JS_KEY_NUMPAD6 = 102;
+JS_KEY_NUMPAD7 = 103;
+JS_KEY_NUMPAD8 = 104;
+JS_KEY_NUMPAD9 = 105;
+JS_KEY_MULTIPLY = 106;
+JS_KEY_ADD = 107;
+JS_KEY_SUBSTRACT = 109;
+JS_KEY_DECIMAL_POINT = 110;
+JS_KEY_DIVIDE = 111;
+JS_KEY_F1 = 112;
+JS_KEY_F2 = 113;
+JS_KEY_F3 = 114;
+JS_KEY_F4 = 115;
+JS_KEY_F5 = 116;
+JS_KEY_F6 = 117;
+JS_KEY_F7 = 118;
+JS_KEY_F8 = 119;
+JS_KEY_F9 = 120;
+JS_KEY_F10 = 121;
+JS_KEY_F11 = 122;
+JS_KEY_F12 = 123;
+JS_KEY_SEMI_COLON = 186; // ;
+JS_KEY_COMMA = 188; // ,
+JS_KEY_DASH = 189; // -
+JS_KEY_PERIOD = 190; // .
+JS_KEY_FORWARD_SLASH = 191; // /
+JS_KEY_GRAVE_ACCENT = 192; // `
+JS_KEY_OPEN_BRACKET = 219; // [
+JS_KEY_BACK_SLASH = 220; // \
+JS_KEY_CLOSE_BRACKET = 221; // ]
+JS_KEY_SINGLE_QUOTE = 222; // '
+
+
+//X11 keysym definitions
+X11_KEY_CAPSLOCK = 0xffe5;
+X11_KEY_BACKSPACE = 0xff08;
+X11_KEY_TAB = 0xff09;
+X11_KEY_ENTER = 0xff0d;
+X11_KEY_ESCAPE = 0xff1b;
+X11_KEY_INSERT = 0xff63;
+X11_KEY_DELETE = 0xffff;
+X11_KEY_HOME = 0xff50;
+X11_KEY_END = 0xff57;
+X11_KEY_PAGEUP = 0xff55;
+X11_KEY_PAGEDOWN = 0xff56;
+X11_KEY_LEFT = 0xff51;
+X11_KEY_UP = 0xff52;
+X11_KEY_RIGHT = 0xff53;
+X11_KEY_DOWN = 0xff54;
+X11_KEY_F1 = 0xffbe;
+X11_KEY_F2 = 0xffbf;
+X11_KEY_F3 = 0xffc0;
+X11_KEY_F4 = 0xffc1;
+X11_KEY_F5 = 0xffc2;
+X11_KEY_F6 = 0xffc3;
+X11_KEY_F7 = 0xffc4;
+X11_KEY_F8 = 0xffc5;
+X11_KEY_F9 = 0xffc6;
+X11_KEY_F10 = 0xffc7;
+X11_KEY_F11 = 0xffc8;
+X11_KEY_F12 = 0xffc9;
+X11_KEY_SHIFT = 0xffe1;
+X11_KEY_CTRL = 0xffe3;
+X11_KEY_ALT = 0xffe9;
+X11_KEY_GRAVE_ACCENT = 0x60;
+X11_KEY_SUBSTRACT = 0x2d;
+X11_KEY_ADD = 0x2b;
X11_KEY_OPEN_BRACKET = 0x5b;
X11_KEY_CLOSE_BRACKET = 0x5d;
+X11_KEY_BACK_SLASH = 0x7c;
+X11_KEY_REVERSE_SOLIUS = 0x5c; // another back slash (back slash on JP keyboard)
+X11_KEY_SINGLE_QUOTE = 0x22;
+X11_KEY_COMMA = 0x3c;
+X11_KEY_PERIOD = 0x3e;
+X11_KEY_FORWARD_SLASH = 0x3f;
+X11_KEY_DASH = 0x2d;
X11_KEY_COLON = 0x3a;
-X11_KEY_REVERSE_SOLIUS = 0x5c; // another back slash (back slash on JP keyboard)
-X11_KEY_CAPSLOCK = 0xffe5;
X11_KEY_SEMI_COLON = 0x3b;
-X11_KEY_SHIFT = 0xffe1;
-X11_KEY_ADD = 0x2b;
+X11_KEY_NUMPAD0 = 0x30;
+X11_KEY_NUMPAD1 = 0x31;
+X11_KEY_NUMPAD2 = 0x32;
+X11_KEY_NUMPAD3 = 0x33;
+X11_KEY_NUMPAD4 = 0x34;
+X11_KEY_NUMPAD5 = 0x35;
+X11_KEY_NUMPAD6 = 0x36;
+X11_KEY_NUMPAD7 = 0x37;
+X11_KEY_NUMPAD8 = 0x38;
+X11_KEY_NUMPAD9 = 0x39;
+X11_KEY_DECIMAL_POINT = 0x2e;
+X11_KEY_DIVIDE = 0x3f;
+X11_KEY_TILDE = 0x7e; // ~
+X11_KEY_CIRCUMFLEX_ACCENT = 0x5e; // ^
+X11_KEY_YEN_MARK = 0xa5; // Japanese YEN mark
+X11_KEY_ASTERISK = 0x2a;
KEY_DOWN = 5;
KEY_UP = 6;
+KEYBOARD_TYPE_COOKED = "us";
+KEYBOARD_TYPE_JP = "jp";
+KEYBOARD_TYPE_UK = "uk";
+
//JP keyboard type
-//
+//
var keyboardTables = [
- {tindex: 0, keyboardType: "EN-Cooked", mappingTable:
- {X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT},
+ {tindex: 0, keyboardType: KEYBOARD_TYPE_COOKED, mappingTable:
+ {X11: [ {keycode: 222, entry: X11_KEY_CIRCUMFLEX_ACCENT},
{keycode: 220, entry: X11_KEY_YEN_MARK},
- {keycode: 219, entry: X11_KEY_OPEN_BRACKET},
- {keycode: 221, entry: X11_KEY_CLOSE_BRACKET},
- {keycode: 59, entry: X11_KEY_COLON, browser: "Firefox"},
{keycode: 186, entry: X11_KEY_COLON, browser: "Chrome"},
{keycode: 9, entry: 9, guestos: "XenServer"},
{keycode: 226, entry: X11_KEY_REVERSE_SOLIUS},
+
{keycode: 240, entry: [
{type: KEY_DOWN, code: X11_KEY_CAPSLOCK, modifiers: 0 },
{type: KEY_UP, code: X11_KEY_CAPSLOCK, modifiers: 0 },
]
+ }
+ ],
+ keyPress: [
+ {keycode: 59, entry: [
+ {type: KEY_DOWN, code: X11_KEY_SEMI_COLON, modifiers: 0 },
+ {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers: 0 },
+ ]
},
- ],
- keyPress: [
- {keycode: 59, entry: [
- {type: KEY_DOWN, code: X11_KEY_SEMI_COLON, modifiers: 0 },
- {type: KEY_UP, code: X11_KEY_SEMI_COLON, modifiers: 0 },
- ]
- },
- {keycode: 43, entry: [
- {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
- {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
- {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false },
- {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
- {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true },
- {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true },
- ]
- },
- ]
- }
- } ]
+ {keycode: 43, entry: [
+ {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
+ {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
+ {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false },
+ {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
+ {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true },
+ {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true },
+ ]
+ }
+ ]
+ }
+ }, {tindex: 1, keyboardType: KEYBOARD_TYPE_JP, mappingTable:
+ // intialize keyboard mapping for RAW keyboard
+ {X11: [
+ {keycode: JS_KEY_CAPSLOCK, entry : X11_KEY_CAPSLOCK},
+ {keycode: JS_KEY_BACKSPACE, entry : X11_KEY_BACKSPACE},
+ {keycode: JS_KEY_TAB, entry : X11_KEY_TAB},
+ {keycode: JS_KEY_ENTER, entry : X11_KEY_ENTER},
+ {keycode: JS_KEY_ESCAPE, entry : X11_KEY_ESCAPE},
+ {keycode: JS_KEY_INSERT, entry : X11_KEY_INSERT},
+ {keycode: JS_KEY_DELETE, entry : X11_KEY_DELETE},
+ {keycode: JS_KEY_HOME, entry : X11_KEY_HOME},
+ {keycode: JS_KEY_END, entry : X11_KEY_END},
+ {keycode: JS_KEY_PAGEUP, entry : X11_KEY_PAGEUP},
+ {keycode: JS_KEY_PAGEDOWN, entry : X11_KEY_PAGEDOWN},
+ {keycode: JS_KEY_LEFT, entry : X11_KEY_LEFT},
+ {keycode: JS_KEY_UP, entry : X11_KEY_UP},
+ {keycode: JS_KEY_RIGHT, entry : X11_KEY_RIGHT},
+ {keycode: JS_KEY_DOWN, entry : X11_KEY_DOWN},
+ {keycode: JS_KEY_F1, entry : X11_KEY_F1},
+ {keycode: JS_KEY_F2, entry : X11_KEY_F2},
+ {keycode: JS_KEY_F3, entry : X11_KEY_F3},
+ {keycode: JS_KEY_F4, entry : X11_KEY_F4},
+ {keycode: JS_KEY_F5, entry : X11_KEY_F5},
+ {keycode: JS_KEY_F6, entry : X11_KEY_F6},
+ {keycode: JS_KEY_F7, entry : X11_KEY_F7},
+ {keycode: JS_KEY_F8, entry : X11_KEY_F8},
+ {keycode: JS_KEY_F9, entry : X11_KEY_F9},
+ {keycode: JS_KEY_F10, entry : X11_KEY_F10},
+ {keycode: JS_KEY_F11, entry : X11_KEY_F11},
+ {keycode: JS_KEY_F12, entry : X11_KEY_F12},
+ {keycode: JS_KEY_SHIFT, entry : X11_KEY_SHIFT},
+ {keycode: JS_KEY_CTRL, entry : X11_KEY_CTRL},
+ {keycode: JS_KEY_ALT, entry : X11_KEY_ALT},
+ {keycode: JS_KEY_GRAVE_ACCENT, entry : X11_KEY_GRAVE_ACCENT},
+ {keycode: JS_KEY_SUBSTRACT, entry : X11_KEY_SUBSTRACT},
+ {keycode: JS_KEY_ADD, entry : X11_KEY_ADD},
+ {keycode: JS_KEY_OPEN_BRACKET, entry : X11_KEY_OPEN_BRACKET},
+ {keycode: JS_KEY_CLOSE_BRACKET, entry : X11_KEY_CLOSE_BRACKET},
+ {keycode: JS_KEY_BACK_SLASH, entry : X11_KEY_BACK_SLASH},
+ {keycode: JS_KEY_SINGLE_QUOTE, entry : X11_KEY_SINGLE_QUOTE},
+ {keycode: JS_KEY_COMMA, entry : X11_KEY_COMMA},
+ {keycode: JS_KEY_PERIOD, entry : X11_KEY_PERIOD},
+ {keycode: JS_KEY_FORWARD_SLASH, entry : X11_KEY_FORWARD_SLASH},
+ {keycode: JS_KEY_DASH, entry : X11_KEY_DASH},
+ {keycode: JS_KEY_SEMI_COLON, entry : X11_KEY_SEMI_COLON},
+ {keycode: JS_KEY_NUMPAD0, entry : X11_KEY_NUMPAD0},
+ {keycode: JS_KEY_NUMPAD1, entry : X11_KEY_NUMPAD1},
+ {keycode: JS_KEY_NUMPAD2, entry : X11_KEY_NUMPAD2},
+ {keycode: JS_KEY_NUMPAD3, entry : X11_KEY_NUMPAD3},
+ {keycode: JS_KEY_NUMPAD4, entry : X11_KEY_NUMPAD4},
+ {keycode: JS_KEY_NUMPAD5, entry : X11_KEY_NUMPAD5},
+ {keycode: JS_KEY_NUMPAD6, entry : X11_KEY_NUMPAD6},
+ {keycode: JS_KEY_NUMPAD7, entry : X11_KEY_NUMPAD7},
+ {keycode: JS_KEY_NUMPAD8, entry : X11_KEY_NUMPAD8},
+ {keycode: JS_KEY_NUMPAD9, entry : X11_KEY_NUMPAD9},
+ {keycode: JS_KEY_DECIMAL_POINT, entry : X11_KEY_DECIMAL_POINT},
+ {keycode: JS_KEY_DIVIDE, entry : X11_KEY_DIVIDE},
+ {keycode: JS_KEY_MULTIPLY, entry : [
+ {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0 },
+ {type: KEY_DOWN, code: X11_KEY_ASTERISK, modifiers: 0 },
+ {type: KEY_UP, code: X11_KEY_ASTERISK, modifiers: 0 },
+ {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0 }
+ ]},
+ {keycode: JS_KEY_ADD, entry : false}
+ ],
+ keyPress: [
+ {keycode: 61, entry: [
+ {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
+ {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false }
+ ]},
+ {keycode: 43, entry: [
+ {type: KEY_DOWN, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
+ {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: false },
+ {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: false },
+ {type: KEY_UP, code: X11_KEY_SHIFT, modifiers: 0, shift: false },
+ {type: KEY_DOWN, code: X11_KEY_ADD, modifiers: 0, shift: true },
+ {type: KEY_UP, code: X11_KEY_ADD, modifiers: 0, shift: true }
+ ]}
+ ]
+ }
+ }, {tindex: 2, keyboardType: KEYBOARD_TYPE_UK, mappingTable:
+ {X11: [],
+ keyPress: [
+ //[34 = "]
+ {keycode: 34, entry:
+ [{type : KEY_DOWN, code : 0x40, modifiers : 64, shift : true}]
+ },
+ //[35 = #]
+ {keycode: 35, entry:
+ [{type : KEY_DOWN, code : 0x5c, modifiers : 0, shift : false}]
+ },
+ // [64 = @]
+ {keycode: 64, entry:
+ [{type : KEY_DOWN, code : 0x22, modifiers : 64, shift : true}]
+ },
+ // [92 = \]
+ {keycode: 92, entry:
+ [{type : KEY_DOWN, code : 0xa6, modifiers : 0, shift : false}]
+ },
+ // [126 = ~]
+ {keycode: 126, entry:
+ [{type : KEY_DOWN, code : 0x7c, modifiers : 64, shift : true}]
+ },
+ // [163 = £]
+ {keycode: 163, entry:
+ [{type : KEY_DOWN, code : 0x23, modifiers : 64, shift : true}]
+ },
+ // [172 = ¬]
+ {keycode: 172, entry:
+ [{type : KEY_DOWN, code : 0x7e, modifiers : 64, shift : true}]
+ },
+ // [166 = ¦]
+ {keycode: 166, entry:
+ [{type : KEY_DOWN, code : 0x60, modifiers : 896, shift : false}]
+ }
+ ]
+ }
+ }]
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/js/ajaxviewer.js
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/js/ajaxviewer.js b/services/console-proxy/server/js/ajaxviewer.js
index e95615d..a6e1eda 100644
--- a/services/console-proxy/server/js/ajaxviewer.js
+++ b/services/console-proxy/server/js/ajaxviewer.js
@@ -99,92 +99,13 @@ function KeyboardMapper() {
//
KeyboardMapper.KEYBOARD_TYPE_RAW = 0;
KeyboardMapper.KEYBOARD_TYPE_COOKED = 1;
+KeyboardMapper.KEYBOARD_TYPE_UK = 2;
KeyboardMapper.prototype = {
-
+
setKeyboardType : function(keyboardType) {
this.keyboardType = keyboardType;
-
- if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_RAW) {
- // intialize keyboard mapping for RAW keyboard
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] = AjaxViewer.X11_KEY_CAPSLOCK;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] = AjaxViewer.X11_KEY_BACKSPACE;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_TAB] = AjaxViewer.X11_KEY_TAB;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_ENTER] = AjaxViewer.X11_KEY_ENTER;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_ESCAPE] = AjaxViewer.X11_KEY_ESCAPE;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_INSERT] = AjaxViewer.X11_KEY_INSERT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_DELETE] = AjaxViewer.X11_KEY_DELETE;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_HOME] = AjaxViewer.X11_KEY_HOME;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_END] = AjaxViewer.X11_KEY_END;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEUP] = AjaxViewer.X11_KEY_PAGEUP;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_PAGEDOWN] = AjaxViewer.X11_KEY_PAGEDOWN;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_LEFT] = AjaxViewer.X11_KEY_LEFT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_UP] = AjaxViewer.X11_KEY_UP;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_RIGHT] = AjaxViewer.X11_KEY_RIGHT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_DOWN] = AjaxViewer.X11_KEY_DOWN;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F1] = AjaxViewer.X11_KEY_F1;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F2] = AjaxViewer.X11_KEY_F2;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F3] = AjaxViewer.X11_KEY_F3;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F4] = AjaxViewer.X11_KEY_F4;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F5] = AjaxViewer.X11_KEY_F5;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F6] = AjaxViewer.X11_KEY_F6;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F7] = AjaxViewer.X11_KEY_F7;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F8] = AjaxViewer.X11_KEY_F8;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F9] = AjaxViewer.X11_KEY_F9;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F10] = AjaxViewer.X11_KEY_F10;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F11] = AjaxViewer.X11_KEY_F11;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_F12] = AjaxViewer.X11_KEY_F12;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_SHIFT] = AjaxViewer.X11_KEY_SHIFT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_CTRL] = AjaxViewer.X11_KEY_CTRL;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_ALT] = AjaxViewer.X11_KEY_ALT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_GRAVE_ACCENT] = AjaxViewer.X11_KEY_GRAVE_ACCENT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_SUBSTRACT] = AjaxViewer.X11_KEY_SUBSTRACT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] = AjaxViewer.X11_KEY_ADD;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_OPEN_BRACKET] = AjaxViewer.X11_KEY_OPEN_BRACKET;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_CLOSE_BRACKET] = AjaxViewer.X11_KEY_CLOSE_BRACKET;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACK_SLASH] = AjaxViewer.X11_KEY_BACK_SLASH;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_SINGLE_QUOTE] = AjaxViewer.X11_KEY_SINGLE_QUOTE;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_COMMA] = AjaxViewer.X11_KEY_COMMA;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_PERIOD] = AjaxViewer.X11_KEY_PERIOD;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_FORWARD_SLASH] = AjaxViewer.X11_KEY_FORWARD_SLASH;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_DASH] = AjaxViewer.X11_KEY_DASH;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_SEMI_COLON] = AjaxViewer.X11_KEY_SEMI_COLON;
-
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD0] = AjaxViewer.X11_KEY_NUMPAD0;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD1] = AjaxViewer.X11_KEY_NUMPAD1;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD2] = AjaxViewer.X11_KEY_NUMPAD2;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD3] = AjaxViewer.X11_KEY_NUMPAD3;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD4] = AjaxViewer.X11_KEY_NUMPAD4;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD5] = AjaxViewer.X11_KEY_NUMPAD5;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD6] = AjaxViewer.X11_KEY_NUMPAD6;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD7] = AjaxViewer.X11_KEY_NUMPAD7;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD8] = AjaxViewer.X11_KEY_NUMPAD8;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_NUMPAD9] = AjaxViewer.X11_KEY_NUMPAD9;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_DECIMAL_POINT] = AjaxViewer.X11_KEY_DECIMAL_POINT;
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_DIVIDE] = AjaxViewer.X11_KEY_DIVIDE;
-
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_MULTIPLY] = [
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 },
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ASTERISK, modifiers: 0 },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0 }
- ];
-
- this.jsX11KeysymMap[AjaxViewer.JS_KEY_ADD] = false;
- this.jsKeyPressX11KeysymMap = [];
- this.jsKeyPressX11KeysymMap[61] = [
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false }
- ];
- this.jsKeyPressX11KeysymMap[43] = [
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false },
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: false },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_SHIFT, modifiers: 0, shift: false },
- {type: AjaxViewer.KEY_DOWN, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true },
- {type: AjaxViewer.KEY_UP, code: AjaxViewer.X11_KEY_ADD, modifiers: 0, shift: true }
- ];
- } else {
+ if(keyboardType == KeyboardMapper.KEYBOARD_TYPE_COOKED || keyboardType == KeyboardMapper.KEYBOARD_TYPE_UK) {
// initialize mapping for COOKED keyboard
this.jsX11KeysymMap[AjaxViewer.JS_KEY_CAPSLOCK] = AjaxViewer.X11_KEY_CAPSLOCK;
this.jsX11KeysymMap[AjaxViewer.JS_KEY_BACKSPACE] = AjaxViewer.X11_KEY_BACKSPACE;
@@ -325,7 +246,6 @@ KeyboardMapper.prototype = {
// ENTER/BACKSPACE key should already have been sent through KEY DOWN/KEY UP event
if(code == AjaxViewer.JS_KEY_ENTER || code == AjaxViewer.JS_KEY_BACKSPACE)
return;
-
if(code > 0) {
var X11Keysym = code;
X11Keysym = this.jsKeyPressX11KeysymMap[code];
@@ -475,6 +395,7 @@ AjaxViewer.STATUS_SENDING = 3;
AjaxViewer.STATUS_SENT = 4;
AjaxViewer.KEYBOARD_TYPE_ENGLISH = "us";
+AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH = "uk";
AjaxViewer.KEYBOARD_TYPE_JAPANESE = "jp";
AjaxViewer.JS_KEY_BACKSPACE = 8;
@@ -736,6 +657,10 @@ AjaxViewer.prototype = {
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_ENGLISH] = mapper;
mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_COOKED);
+ var mapper = new KeyboardMapper();
+ this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH] = mapper;
+ mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_UK);
+
mapper = new KeyboardMapper();
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE] = mapper;
mapper.setKeyboardType(KeyboardMapper.KEYBOARD_TYPE_RAW);
@@ -795,25 +720,25 @@ AjaxViewer.prototype = {
*/
// create the mapping table based on the tables input
- if (keyboardTables != undefined ) {
+ if (keyboardTables != undefined ) {
- for(var i = 0; i < keyboardTables.length; i++) {
- var mappingTbl = keyboardTables[i];
- var mappings = mappingTbl.mappingTable;
- var x11Maps = mappings.X11;
- for (var j = 0; j < x11Maps.length; j++) {
- var code = x11Maps[j].keycode;
- var mappedEntry = x11Maps[j].entry;
- mapper.jsX11KeysymMap[code] = mappedEntry;
- }
- var keyPressMaps = mappings.keyPress;
- for (var j = 0; j < keyPressMaps.length; j++) {
- var code = keyPressMaps[j].keycode;
- var mappedEntry = keyPressMaps[j].entry;
- mapper.jsKeyPressX11KeysymMap[code] = mappedEntry;
+ for(var i = 0; i < keyboardTables.length; i++) {
+ var mappingTbl = keyboardTables[i];
+ var keyboardType = mappingTbl.keyboardType;
+ var mappings = mappingTbl.mappingTable;
+ var x11Maps = mappings.X11;
+ for (var j = 0; j < x11Maps.length; j++) {
+ var code = x11Maps[j].keycode;
+ var mappedEntry = x11Maps[j].entry;
+ this.keyboardMappers[keyboardType].jsX11KeysymMap[code] = mappedEntry;
+ }
+ var keyPressMaps = mappings.keyPress;
+ for (var j = 0; j < keyPressMaps.length; j++) {
+ var code = keyPressMaps[j].keycode;
+ var mappedEntry = keyPressMaps[j].entry;
+ this.keyboardMappers[keyboardType].jsKeyPressX11KeysymMap[code] = mappedEntry;
+ }
}
-
- }
}
}, // end of the setupKeyboardTranslationTable function
@@ -867,6 +792,9 @@ AjaxViewer.prototype = {
} else if(cmd == "keyboard_us") {
$("#toolbar").find(".pulldown").find("ul").hide();
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_ENGLISH;
+ } else if(cmd == "keyboard_uk") {
+ $("#toolbar").find(".pulldown").find("ul").hide();
+ this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_UK_ENGLISH;
} else if(cmd == "sendCtrlAltDel") {
this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe9, 0); // X11 Alt
this.sendKeyboardEvent(AjaxViewer.KEY_DOWN, 0xffe3, 0); // X11 Ctrl
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b6cb23cb/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
index 289bdab..f4c912a 100644
--- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
+++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java
@@ -329,6 +329,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
"</a>",
"<ul>",
"<li><a href=\"#\" cmd=\"keyboard_us\"><span>Standard (US) keyboard</span></a></li>",
+ "<li><a href=\"#\" cmd=\"keyboard_uk\"><span>UK keyboard</span></a></li>",
"<li><a href=\"#\" cmd=\"keyboard_jp\"><span>Japanese keyboard</span></a></li>",
"</ul>",
"</li>",
[43/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-869 nTier Apps 2.0 : Support NetScalar as external LB provider
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2e210600
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2e210600
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2e210600
Branch: refs/heads/vmware-datamodel
Commit: 2e2106002865cff8eb06b5c3a42bfd6f0f6848fb
Parents: 2e1877a
Author: Rajesh Battala <ra...@citrix.com>
Authored: Wed May 8 18:46:51 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Thu May 9 15:23:00 2013 +0530
----------------------------------------------------------------------
api/src/com/cloud/network/vpc/VpcOffering.java | 1 +
.../cloud/network/element/NetscalerElement.java | 34 ++-
server/pom.xml | 4 +-
.../src/com/cloud/network/NetworkServiceImpl.java | 6 +-
.../network/guru/ExternalGuestNetworkGuru.java | 40 ++-
.../src/com/cloud/network/vpc/VpcManagerImpl.java | 32 ++-
server/test/com/cloud/vpc/VpcTest.java | 269 +++++++++++++++
.../networkoffering/CreateNetworkOfferingTest.java | 43 +++
8 files changed, 406 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/api/src/com/cloud/network/vpc/VpcOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpc/VpcOffering.java b/api/src/com/cloud/network/vpc/VpcOffering.java
index 3961d0a..3ec81e6 100644
--- a/api/src/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/com/cloud/network/vpc/VpcOffering.java
@@ -26,6 +26,7 @@ public interface VpcOffering extends InternalIdentity, Identity {
}
public static final String defaultVPCOfferingName = "Default VPC offering";
+ public static final String defaultVPCNSOfferingName = "Default VPC offering with Netscaler";
/**
*
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index 7bd9c2e..b814430 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -61,6 +61,9 @@ import com.cloud.network.rules.FirewallRule.Purpose;
import com.cloud.network.rules.LbStickinessMethod;
import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
import com.cloud.network.rules.StaticNat;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRouteProfile;
+import com.cloud.network.vpc.Vpc;
import com.cloud.offering.NetworkOffering;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.DB;
@@ -85,7 +88,7 @@ import java.util.*;
@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class, GslbServiceProvider.class})
public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider,
NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider,
- GslbServiceProvider {
+ GslbServiceProvider, VpcProvider {
private static final Logger s_logger = Logger.getLogger(NetscalerElement.class);
public static final AutoScaleCounterType AutoScaleCounterSnmp = new AutoScaleCounterType("snmp");
@@ -957,4 +960,33 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
}
return null;
}
+
+ @Override
+ public boolean implementVpc(Vpc vpc, DeployDestination dest, ReservationContext context)
+ throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
+ return true;
+ }
+
+ @Override
+ public boolean shutdownVpc(Vpc vpc, ReservationContext context) throws ConcurrentOperationException,
+ ResourceUnavailableException {
+ return true;
+ }
+
+ @Override
+ public boolean createPrivateGateway(PrivateGateway gateway) throws ConcurrentOperationException,
+ ResourceUnavailableException {
+ return true;
+ }
+
+ @Override
+ public boolean deletePrivateGateway(PrivateGateway privateGateway) throws ConcurrentOperationException,
+ ResourceUnavailableException {
+ return true;
+ }
+
+ @Override
+ public boolean applyStaticRoutes(Vpc vpc, List<StaticRouteProfile> routes) throws ResourceUnavailableException {
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index 808dd3e..004d9c8 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -154,7 +154,9 @@
<exclude>com/cloud/network/vpn/RemoteAccessVpnTest.java</exclude>
<exclude>com/cloud/network/security/SecurityGroupManagerImpl2Test.java</exclude>
<exclude>com/cloud/network/security/SecurityGroupManagerImpl2Test.java</exclude>
- <exclude>com/cloud/vpc/*</exclude>
+ <exclude>com/cloud/vpc/VpcTestConfiguration.java</exclude>
+ <exclude>com/cloud/vpc/VpcApiUnitTest.java</exclude>
+ <exclude>com/cloud/vpc/VpcManagerTest.java</exclude>
</excludes>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/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 5e8be92..f44688c 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -1121,7 +1121,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
// validate if CIDR specified overlaps with any of the CIDR's allocated for isolated networks and shared networks in the zone
checkSharedNetworkCidrOverlap(zoneId, pNtwk.getId(), cidr);
} else {
- throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
+ // if the guest network is for the VPC, if any External Provider are supported in VPC
+ // cidr will not be null as it is generated from the super cidr of vpc.
+ // if cidr is not null and network is not part of vpc then throw the exception
+ if (vpcId == null)
+ throw new InvalidParameterValueException("Cannot specify CIDR when using network offering with external devices!");
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index b1606db..fe9e01f 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -118,7 +118,7 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
if (Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key()))) {
return null;
}
-
+
if (!_networkModel.networkIsConfiguredForExternalNetworking(config.getDataCenterId(), config.getId())) {
return super.implement(config, offering, dest, context);
}
@@ -145,25 +145,31 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
implemented.setBroadcastUri(config.getBroadcastUri());
}
- // Determine the offset from the lowest vlan tag
- int offset = getVlanOffset(config.getPhysicalNetworkId(), vlanTag);
-
// Determine the new gateway and CIDR
String[] oldCidr = config.getCidr().split("/");
String oldCidrAddress = oldCidr[0];
- int cidrSize = getGloballyConfiguredCidrSize();
-
- // If the offset has more bits than there is room for, return null
- long bitsInOffset = 32 - Integer.numberOfLeadingZeros(offset);
- if (bitsInOffset > (cidrSize - 8)) {
- throw new CloudRuntimeException("The offset " + offset + " needs " + bitsInOffset + " bits, but only have " + (cidrSize - 8) + " bits to work with.");
+ int cidrSize = Integer.parseInt(oldCidr[1]);
+ long newCidrAddress = (NetUtils.ip2Long(oldCidrAddress));
+ // if the implementing network is for vpc, no need to generate newcidr, use the cidr that came from super cidr
+ if (config.getVpcId() != null) {
+ implemented.setGateway(config.getGateway());
+ implemented.setCidr(config.getCidr());
+ implemented.setState(State.Implemented);
+ } else {
+ // Determine the offset from the lowest vlan tag
+ int offset = getVlanOffset(config.getPhysicalNetworkId(), vlanTag);
+ cidrSize = getGloballyConfiguredCidrSize();
+ // If the offset has more bits than there is room for, return null
+ long bitsInOffset = 32 - Integer.numberOfLeadingZeros(offset);
+ if (bitsInOffset > (cidrSize - 8)) {
+ throw new CloudRuntimeException("The offset " + offset + " needs " + bitsInOffset + " bits, but only have " + (cidrSize - 8) + " bits to work with.");
+ }
+ newCidrAddress = (NetUtils.ip2Long(oldCidrAddress) & 0xff000000) | (offset << (32 - cidrSize));
+ implemented.setGateway(NetUtils.long2Ip(newCidrAddress + 1));
+ implemented.setCidr(NetUtils.long2Ip(newCidrAddress) + "/" + cidrSize);
+ implemented.setState(State.Implemented);
}
- long newCidrAddress = (NetUtils.ip2Long(oldCidrAddress) & 0xff000000) | (offset << (32 - cidrSize));
- implemented.setGateway(NetUtils.long2Ip(newCidrAddress + 1));
- implemented.setCidr(NetUtils.long2Ip(newCidrAddress) + "/" + cidrSize);
- implemented.setState(State.Implemented);
-
// Mask the Ipv4 address of all nics that use this network with the new guest VLAN offset
List<NicVO> nicsInNetwork = _nicDao.listByNetworkId(config.getId());
for (NicVO nic : nicsInNetwork) {
@@ -172,8 +178,8 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
nic.setIp4Address(NetUtils.long2Ip(newCidrAddress | ipMask));
_nicDao.persist(nic);
}
- }
-
+ }
+
// Mask the destination address of all port forwarding rules in this network with the new guest VLAN offset
List<PortForwardingRuleVO> pfRulesInNetwork = _pfRulesDao.listByNetwork(config.getId());
for (PortForwardingRuleVO pfRule : pfRulesInNetwork) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index a7f06e9..9be2208 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -184,8 +184,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("VpcChecker"));
private List<VpcProvider> vpcElements = null;
private final List<Service> nonSupportedServices = Arrays.asList(Service.SecurityGroup, Service.Firewall);
- private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter, Provider.NiciraNvp);
-
+ private final List<Provider> supportedProviders = Arrays.asList(Provider.VPCVirtualRouter, Provider.NiciraNvp, Provider.Netscaler);
int _cleanupInterval;
int _maxNetworks;
SearchBuilder<IPAddressVO> IpAddressSearch;
@@ -215,7 +214,27 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
createVpcOffering(VpcOffering.defaultVPCOfferingName, VpcOffering.defaultVPCOfferingName, svcProviderMap,
true, State.Enabled);
}
-
+
+ //configure default vpc offering with Netscaler as LB Provider
+ if (_vpcOffDao.findByUniqueName(VpcOffering.defaultVPCNSOfferingName ) == null) {
+ s_logger.debug("Creating default VPC offering with Netscaler as LB Provider" + VpcOffering.defaultVPCNSOfferingName);
+ Map<Service, Set<Provider>> svcProviderMap = new HashMap<Service, Set<Provider>>();
+ Set<Provider> defaultProviders = new HashSet<Provider>();
+ defaultProviders.add(Provider.VPCVirtualRouter);
+ for (Service svc : getSupportedServices()) {
+ if (svc == Service.Lb) {
+ Set<Provider> lbProviders = new HashSet<Provider>();
+ lbProviders.add(Provider.Netscaler);
+ lbProviders.add(Provider.VPCVirtualRouter);
+ svcProviderMap.put(svc, lbProviders);
+ } else {
+ svcProviderMap.put(svc, defaultProviders);
+ }
+ }
+ createVpcOffering(VpcOffering.defaultVPCNSOfferingName, VpcOffering.defaultVPCNSOfferingName,
+ svcProviderMap, false, State.Enabled);
+ }
+
txn.commit();
Map<String, String> configs = _configDao.getConfiguration(params);
@@ -1084,6 +1103,12 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (guestNtwkOff.isConserveMode()) {
throw new InvalidParameterValueException("Only networks with conserve mode Off can belong to VPC");
}
+
+ //5) If Netscaler is LB provider make sure it is in dedicated mode
+ if ( providers.contains(Provider.Netscaler) && !guestNtwkOff.getDedicatedLB() ) {
+ throw new InvalidParameterValueException("Netscaler only with Dedicated LB can belong to VPC");
+ }
+ return ;
}
@DB
@@ -1155,6 +1180,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
if (vpcElements == null) {
vpcElements = new ArrayList<VpcProvider>();
vpcElements.add((VpcProvider)_ntwkModel.getElementImplementingProvider(Provider.VPCVirtualRouter.getName()));
+ vpcElements.add((VpcProvider)_ntwkModel.getElementImplementingProvider(Provider.Netscaler.getName()));
}
if (vpcElements == null) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/server/test/com/cloud/vpc/VpcTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/VpcTest.java b/server/test/com/cloud/vpc/VpcTest.java
new file mode 100644
index 0000000..52e837e
--- /dev/null
+++ b/server/test/com/cloud/vpc/VpcTest.java
@@ -0,0 +1,269 @@
+// 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.vpc;
+
+import com.cloud.configuration.ConfigurationManager;
+import com.cloud.configuration.dao.ConfigurationDao;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.dc.dao.VlanDao;
+import com.cloud.network.NetworkManager;
+import com.cloud.network.NetworkModel;
+import com.cloud.network.NetworkService;
+import com.cloud.network.dao.FirewallRulesDao;
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.PhysicalNetworkDao;
+import com.cloud.network.dao.Site2SiteVpnGatewayDao;
+import com.cloud.network.vpc.*;
+import com.cloud.network.vpc.dao.PrivateIpDao;
+import com.cloud.network.vpc.dao.StaticRouteDao;
+import com.cloud.network.vpc.dao.VpcDao;
+import com.cloud.network.vpc.dao.VpcGatewayDao;
+import com.cloud.network.vpc.dao.VpcOfferingDao;
+import com.cloud.network.vpc.dao.VpcOfferingServiceMapDao;
+import com.cloud.network.vpc.dao.VpcServiceMapDao;
+import com.cloud.network.vpn.Site2SiteVpnManager;
+import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
+import com.cloud.server.ConfigurationServer;
+import com.cloud.tags.dao.ResourceTagDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.ResourceLimitService;
+import com.cloud.user.UserContext;
+import com.cloud.utils.component.ComponentContext;
+import com.cloud.vm.dao.DomainRouterDao;
+
+import junit.framework.TestCase;
+import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
+import org.apache.cloudstack.api.command.user.vpc.CreateVPCCmd;
+import org.apache.cloudstack.test.utils.SpringUtils;
+import org.apache.log4j.Logger;
+import org.junit.Before;
+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.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 javax.inject.Inject;
+import java.io.IOException;
+import java.util.UUID;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
+public class VpcTest extends TestCase {
+
+ @Inject
+ VpcService _vpcService;
+
+ @Inject
+ AccountManager _accountMgr;
+
+ @Inject
+ VpcManager _vpcMgr;
+
+ @Inject
+ VpcDao _vpcDao;
+
+ @Inject
+ VpcOfferingDao _vpcOfferinDao;
+
+ private VpcVO vpc;
+ private static final Logger s_logger = Logger.getLogger(VpcTest.class);
+
+ @Before
+ public void setUp() {
+ ComponentContext.initComponentsLifeCycle();
+ Account account = new AccountVO("testaccount", 1, "testdomain", (short) 0, UUID.randomUUID().toString());
+ UserContext.registerContext(1, account, null, true);
+ vpc = new VpcVO(1, "myvpc", "myvpc", 2, 1, 1, "10.0.1.0/16", "mydomain");
+ }
+
+ @Test
+ public void testCreateVpc() throws Exception {
+ Mockito.when(
+ _vpcMgr.createVpc(Mockito.anyLong(), Mockito.anyLong(), Mockito.anyLong(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyString(), Mockito.anyString())).thenReturn(vpc);
+ Mockito.when(_vpcOfferinDao.persist(Mockito.any(VpcOfferingVO.class))).thenReturn(
+ new VpcOfferingVO("test", "test", 1L));
+ Vpc vpc1 = _vpcMgr.createVpc(1, 1, 1, "myVpc", "my Vpc", "10.0.0.0/16", "test");
+ assertNotNull("Vpc is created", vpc1);
+ }
+
+ @Configuration
+ @ComponentScan(basePackageClasses = { VpcManager.class }, includeFilters = { @ComponentScan.Filter(value = VpcTestConfiguration.Library.class, type = FilterType.CUSTOM) }, useDefaultFilters = false)
+ public static class VpcTestConfiguration extends SpringUtils.CloudStackTestConfiguration {
+
+ @Bean
+ public AccountManager accountManager() {
+ return Mockito.mock(AccountManager.class);
+ }
+
+ @Bean
+ public NetworkManager networkManager() {
+ return Mockito.mock(NetworkManager.class);
+ }
+
+ @Bean
+ public NetworkModel networkModel() {
+ return Mockito.mock(NetworkModel.class);
+ }
+
+ @Bean
+ public VpcManager vpcManager() {
+ return Mockito.mock(VpcManager.class);
+ }
+
+ @Bean
+ public ResourceTagDao resourceTagDao() {
+ return Mockito.mock(ResourceTagDao.class);
+ }
+
+ @Bean
+ public VpcDao VpcDao() {
+ return Mockito.mock(VpcDao.class);
+ }
+
+ @Bean
+ public VpcOfferingDao vpcOfferingDao() {
+ return Mockito.mock(VpcOfferingDao.class);
+ }
+
+ @Bean
+ public VpcOfferingServiceMapDao vpcOfferingServiceMapDao() {
+ return Mockito.mock(VpcOfferingServiceMapDao.class);
+ }
+
+ @Bean
+ public ConfigurationDao configurationDao() {
+ return Mockito.mock(ConfigurationDao.class);
+ }
+
+ @Bean
+ public ConfigurationManager configurationManager() {
+ return Mockito.mock(ConfigurationManager.class);
+ }
+
+ @Bean
+ public NetworkDao networkDao() {
+ return Mockito.mock(NetworkDao.class);
+ }
+
+ @Bean
+ public NetworkACLManager networkACLManager() {
+ return Mockito.mock(NetworkACLManager.class);
+ }
+
+ @Bean
+ public IPAddressDao ipAddressDao() {
+ return Mockito.mock(IPAddressDao.class);
+ }
+
+ @Bean
+ public DomainRouterDao domainRouterDao() {
+ return Mockito.mock(DomainRouterDao.class);
+ }
+
+ @Bean
+ public VpcGatewayDao vpcGatewayDao() {
+ return Mockito.mock(VpcGatewayDao.class);
+ }
+
+ @Bean
+ public PrivateIpDao privateIpDao() {
+ return Mockito.mock(PrivateIpDao.class);
+ }
+
+ @Bean
+ public StaticRouteDao staticRouteDao() {
+ return Mockito.mock(StaticRouteDao.class);
+ }
+
+ @Bean
+ public NetworkOfferingServiceMapDao networkOfferingServiceMapDao() {
+ return Mockito.mock(NetworkOfferingServiceMapDao.class);
+ }
+
+ @Bean
+ public PhysicalNetworkDao physicalNetworkDao() {
+ return Mockito.mock(PhysicalNetworkDao.class);
+ }
+
+ @Bean
+ public FirewallRulesDao firewallRulesDao() {
+ return Mockito.mock(FirewallRulesDao.class);
+ }
+
+ @Bean
+ public Site2SiteVpnGatewayDao site2SiteVpnGatewayDao() {
+ return Mockito.mock(Site2SiteVpnGatewayDao.class);
+ }
+
+ @Bean
+ public Site2SiteVpnManager site2SiteVpnManager() {
+ return Mockito.mock(Site2SiteVpnManager.class);
+ }
+
+ @Bean
+ public VlanDao vlanDao() {
+ return Mockito.mock(VlanDao.class);
+ }
+
+ @Bean
+ public ResourceLimitService resourceLimitService() {
+ return Mockito.mock(ResourceLimitService.class);
+ }
+
+ @Bean
+ public VpcServiceMapDao vpcServiceMapDao() {
+ return Mockito.mock(VpcServiceMapDao.class);
+ }
+
+ @Bean
+ public NetworkService networkService() {
+ return Mockito.mock(NetworkService.class);
+ }
+
+ @Bean
+ public DataCenterDao dataCenterDao() {
+ return Mockito.mock(DataCenterDao.class);
+ }
+
+ @Bean
+ public ConfigurationServer configurationServer() {
+ return Mockito.mock(ConfigurationServer.class);
+ }
+
+ public static class Library implements TypeFilter {
+ @Override
+ public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException {
+ mdr.getClassMetadata().getClassName();
+ ComponentScan cs = VpcTestConfiguration.class.getAnnotation(ComponentScan.class);
+ return SpringUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs);
+ }
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2e210600/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
index cbb6c00..7946c1a 100644
--- a/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
+++ b/server/test/org/apache/cloudstack/networkoffering/CreateNetworkOfferingTest.java
@@ -41,6 +41,7 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.vpc.VpcManager;
import com.cloud.offering.NetworkOffering.Availability;
import com.cloud.offerings.NetworkOfferingServiceMapVO;
import com.cloud.offerings.NetworkOfferingVO;
@@ -72,6 +73,9 @@ public class CreateNetworkOfferingTest extends TestCase{
@Inject
AccountManager accountMgr;
+ @Inject
+ VpcManager vpcMgr;
+
@Before
public void setUp() {
ComponentContext.initComponentsLifeCycle();
@@ -180,4 +184,43 @@ public class CreateNetworkOfferingTest extends TestCase{
assertNotNull("Isolated network offering with specifyIpRanges=true and with no sourceNatService, failed to create", off);
}
+
+ @Test
+ public void createVpcNtwkOff() {
+ Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
+ Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
+ vrProvider.add(Provider.VPCVirtualRouter);
+ serviceProviderMap.put(Network.Service.Dhcp , vrProvider);
+ serviceProviderMap.put(Network.Service.Dns , vrProvider);
+ serviceProviderMap.put(Network.Service.Lb , vrProvider);
+ serviceProviderMap.put(Network.Service.SourceNat , vrProvider);
+ serviceProviderMap.put(Network.Service.Gateway , vrProvider);
+ serviceProviderMap.put(Network.Service.Lb , vrProvider);
+ NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
+ Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false,
+ null, false, null, false, false);
+ // System.out.println("Creating Vpc Network Offering");
+ assertNotNull("Vpc Isolated network offering with Vpc provider ", off);
+ }
+
+ @Test
+ public void createVpcNtwkOffWithNetscaler() {
+ Map<Service, Set<Provider>> serviceProviderMap = new HashMap<Network.Service, Set<Network.Provider>>();
+ Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
+ Set<Network.Provider> lbProvider = new HashSet<Network.Provider>();
+ vrProvider.add(Provider.VPCVirtualRouter);
+ lbProvider.add(Provider.Netscaler);
+ serviceProviderMap.put(Network.Service.Dhcp, vrProvider);
+ serviceProviderMap.put(Network.Service.Dns, vrProvider);
+ serviceProviderMap.put(Network.Service.Lb, vrProvider);
+ serviceProviderMap.put(Network.Service.SourceNat, vrProvider);
+ serviceProviderMap.put(Network.Service.Gateway, vrProvider);
+ serviceProviderMap.put(Network.Service.Lb, lbProvider);
+ NetworkOfferingVO off = configMgr.createNetworkOffering("isolated", "isolated", TrafficType.Guest, null, true,
+ Availability.Optional, 200, serviceProviderMap, false, Network.GuestType.Isolated, false, null, false,
+ null, false, false);
+ // System.out.println("Creating Vpc Network Offering");
+ assertNotNull("Vpc Isolated network offering with Vpc and Netscaler provider ", off);
+ }
+
}
[05/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Moved over the VLAN daos
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2639b9f9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2639b9f9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2639b9f9
Branch: refs/heads/vmware-datamodel
Commit: 2639b9f91eaeefe46901598467fda34a520f52be
Parents: e5d331e
Author: Alex Huang <al...@gmail.com>
Authored: Mon May 6 10:34:22 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon May 6 16:34:41 2013 -0700
----------------------------------------------------------------------
.../cloud/network/dao/AccountGuestVlanMapDao.java | 34 +++++
.../network/dao/AccountGuestVlanMapDaoImpl.java | 83 +++++++++++++
.../cloud/network/dao/AccountGuestVlanMapVO.java | 94 +++++++++++++++
.../cloud/network/dao/AccountGuestVlanMapDao.java | 34 -----
.../network/dao/AccountGuestVlanMapDaoImpl.java | 83 -------------
.../cloud/network/dao/AccountGuestVlanMapVO.java | 94 ---------------
6 files changed, 211 insertions(+), 211 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
new file mode 100644
index 0000000..dc1ec89
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
@@ -0,0 +1,34 @@
+// 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.dao;
+
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.utils.db.GenericDao;
+
+import java.util.List;
+
+public interface AccountGuestVlanMapDao extends GenericDao<AccountGuestVlanMapVO, Long> {
+
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId);
+
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId);
+
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId);
+
+ public int removeByAccountId(long accountId);
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
new file mode 100644
index 0000000..e7a7b34
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
@@ -0,0 +1,83 @@
+// 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.dao;
+
+import com.cloud.network.dao.AccountGuestVlanMapVO;
+import com.cloud.network.dao.AccountGuestVlanMapDao;
+
+import java.util.List;
+import javax.ejb.Local;
+import org.springframework.stereotype.Component;
+
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.GenericDaoBase;
+import com.cloud.utils.db.SearchBuilder;
+import com.cloud.utils.db.SearchCriteria;
+
+@Component
+@Local(value={AccountGuestVlanMapDao.class})
+@DB(txn=false)
+public class AccountGuestVlanMapDaoImpl extends GenericDaoBase<AccountGuestVlanMapVO, Long> implements AccountGuestVlanMapDao {
+
+ protected SearchBuilder<AccountGuestVlanMapVO> AccountSearch;
+ protected SearchBuilder<AccountGuestVlanMapVO> GuestVlanSearch;
+ protected SearchBuilder<AccountGuestVlanMapVO> PhysicalNetworkSearch;
+
+ @Override
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId) {
+ SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
+ sc.setParameters("accountId", accountId);
+ return listIncludingRemovedBy(sc);
+ }
+
+ @Override
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId) {
+ SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
+ sc.setParameters("guestVlanId", guestVlanId);
+ return listIncludingRemovedBy(sc);
+ }
+
+ @Override
+ public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId) {
+ SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
+ sc.setParameters("physicalNetworkId", physicalNetworkId);
+ return listIncludingRemovedBy(sc);
+ }
+
+ @Override
+ public int removeByAccountId(long accountId) {
+ SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
+ sc.setParameters("accountId", accountId);
+ return expunge(sc);
+ }
+
+ public AccountGuestVlanMapDaoImpl() {
+ super();
+ AccountSearch = createSearchBuilder();
+ AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
+ AccountSearch.done();
+
+ GuestVlanSearch = createSearchBuilder();
+ GuestVlanSearch.and("guestVlanId", GuestVlanSearch.entity().getId(), SearchCriteria.Op.EQ);
+ GuestVlanSearch.done();
+
+ PhysicalNetworkSearch = createSearchBuilder();
+ PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getId(), SearchCriteria.Op.EQ);
+ PhysicalNetworkSearch.done();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
new file mode 100644
index 0000000..17c941a
--- /dev/null
+++ b/engine/schema/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
@@ -0,0 +1,94 @@
+// 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.dao;
+
+import com.cloud.network.GuestVlan;
+
+import javax.persistence.*;
+import java.util.UUID;
+
+@Entity
+@Table(name="account_vnet_map")
+public class AccountGuestVlanMapVO implements GuestVlan {
+
+ @Id
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ @Column(name="id")
+ private long id;
+
+ @Column(name="account_id")
+ private long accountId;
+
+ @Column(name="uuid")
+ private String uuid;
+
+ @Column(name="vnet_range")
+ private String guestVlanRange;
+
+ @Column(name="physical_network_id")
+ private long physicalNetworkId;
+
+ public AccountGuestVlanMapVO(long accountId,long physicalNetworkId) {
+ this.accountId = accountId;
+ this.physicalNetworkId = physicalNetworkId;
+ this.guestVlanRange = null;
+ this.uuid = UUID.randomUUID().toString();
+ }
+
+ public AccountGuestVlanMapVO() {
+
+ }
+
+ @Override
+ public long getId() {
+ return id;
+ }
+
+ @Override
+ public long getAccountId() {
+ return accountId;
+ }
+
+ @Override
+ public String getGuestVlanRange() {
+ return guestVlanRange;
+ }
+
+
+ public void setGuestVlanRange(String guestVlanRange) {
+ this.guestVlanRange = guestVlanRange;
+ }
+
+ @Override
+ public String getUuid() {
+ return this.uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ @Override
+ public long getPhysicalNetworkId() {
+ return this.physicalNetworkId;
+ }
+
+ public void setPhysicalNetworkId(long physicalNetworkId) {
+ this.physicalNetworkId = physicalNetworkId;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/server/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/AccountGuestVlanMapDao.java b/server/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
deleted file mode 100644
index dc1ec89..0000000
--- a/server/src/com/cloud/network/dao/AccountGuestVlanMapDao.java
+++ /dev/null
@@ -1,34 +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.dao;
-
-import com.cloud.network.dao.AccountGuestVlanMapVO;
-import com.cloud.utils.db.GenericDao;
-
-import java.util.List;
-
-public interface AccountGuestVlanMapDao extends GenericDao<AccountGuestVlanMapVO, Long> {
-
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId);
-
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId);
-
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId);
-
- public int removeByAccountId(long accountId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/server/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java b/server/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
deleted file mode 100644
index e7a7b34..0000000
--- a/server/src/com/cloud/network/dao/AccountGuestVlanMapDaoImpl.java
+++ /dev/null
@@ -1,83 +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.dao;
-
-import com.cloud.network.dao.AccountGuestVlanMapVO;
-import com.cloud.network.dao.AccountGuestVlanMapDao;
-
-import java.util.List;
-import javax.ejb.Local;
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-
-@Component
-@Local(value={AccountGuestVlanMapDao.class})
-@DB(txn=false)
-public class AccountGuestVlanMapDaoImpl extends GenericDaoBase<AccountGuestVlanMapVO, Long> implements AccountGuestVlanMapDao {
-
- protected SearchBuilder<AccountGuestVlanMapVO> AccountSearch;
- protected SearchBuilder<AccountGuestVlanMapVO> GuestVlanSearch;
- protected SearchBuilder<AccountGuestVlanMapVO> PhysicalNetworkSearch;
-
- @Override
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByAccount(long accountId) {
- SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
- sc.setParameters("accountId", accountId);
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByVlan(long guestVlanId) {
- SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
- sc.setParameters("guestVlanId", guestVlanId);
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public List<AccountGuestVlanMapVO> listAccountGuestVlanMapsByPhysicalNetwork(long physicalNetworkId) {
- SearchCriteria<AccountGuestVlanMapVO> sc = GuestVlanSearch.create();
- sc.setParameters("physicalNetworkId", physicalNetworkId);
- return listIncludingRemovedBy(sc);
- }
-
- @Override
- public int removeByAccountId(long accountId) {
- SearchCriteria<AccountGuestVlanMapVO> sc = AccountSearch.create();
- sc.setParameters("accountId", accountId);
- return expunge(sc);
- }
-
- public AccountGuestVlanMapDaoImpl() {
- super();
- AccountSearch = createSearchBuilder();
- AccountSearch.and("accountId", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
- AccountSearch.done();
-
- GuestVlanSearch = createSearchBuilder();
- GuestVlanSearch.and("guestVlanId", GuestVlanSearch.entity().getId(), SearchCriteria.Op.EQ);
- GuestVlanSearch.done();
-
- PhysicalNetworkSearch = createSearchBuilder();
- PhysicalNetworkSearch.and("physicalNetworkId", PhysicalNetworkSearch.entity().getId(), SearchCriteria.Op.EQ);
- PhysicalNetworkSearch.done();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2639b9f9/server/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/dao/AccountGuestVlanMapVO.java b/server/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
deleted file mode 100644
index 17c941a..0000000
--- a/server/src/com/cloud/network/dao/AccountGuestVlanMapVO.java
+++ /dev/null
@@ -1,94 +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.dao;
-
-import com.cloud.network.GuestVlan;
-
-import javax.persistence.*;
-import java.util.UUID;
-
-@Entity
-@Table(name="account_vnet_map")
-public class AccountGuestVlanMapVO implements GuestVlan {
-
- @Id
- @GeneratedValue(strategy=GenerationType.IDENTITY)
- @Column(name="id")
- private long id;
-
- @Column(name="account_id")
- private long accountId;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name="vnet_range")
- private String guestVlanRange;
-
- @Column(name="physical_network_id")
- private long physicalNetworkId;
-
- public AccountGuestVlanMapVO(long accountId,long physicalNetworkId) {
- this.accountId = accountId;
- this.physicalNetworkId = physicalNetworkId;
- this.guestVlanRange = null;
- this.uuid = UUID.randomUUID().toString();
- }
-
- public AccountGuestVlanMapVO() {
-
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public long getAccountId() {
- return accountId;
- }
-
- @Override
- public String getGuestVlanRange() {
- return guestVlanRange;
- }
-
-
- public void setGuestVlanRange(String guestVlanRange) {
- this.guestVlanRange = guestVlanRange;
- }
-
- @Override
- public String getUuid() {
- return this.uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- @Override
- public long getPhysicalNetworkId() {
- return this.physicalNetworkId;
- }
-
- public void setPhysicalNetworkId(long physicalNetworkId) {
- this.physicalNetworkId = physicalNetworkId;
- }
-
-}
[29/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2361: fix storage xenmotion test script
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/8be30443
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8be30443
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8be30443
Branch: refs/heads/vmware-datamodel
Commit: 8be304434e808660f17c5753abbf455a49ed7602
Parents: 93db64f
Author: Talluri <Sr...@citrix.com>
Authored: Wed May 8 02:41:02 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 8 14:26:43 2013 +0530
----------------------------------------------------------------------
test/integration/component/test_storage_motion.py | 17 +++++++++++++--
1 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8be30443/test/integration/component/test_storage_motion.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_storage_motion.py b/test/integration/component/test_storage_motion.py
index 086ec77..c05d79e 100644
--- a/test/integration/component/test_storage_motion.py
+++ b/test/integration/component/test_storage_motion.py
@@ -98,16 +98,16 @@ class TestStorageMotion(cloudstackTestCase):
# Get Zone, Domain and templates
domain = get_domain(cls.api_client, cls.services)
- zone = get_zone(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,
- 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
# Create VMs, NAT Rules etc
@@ -258,6 +258,17 @@ class TestStorageMotion(cloudstackTestCase):
self.apiclient,
id=volume.id
)
+ self.assertEqual(
+ isinstance(pools, list),
+ True,
+ "Check list storage pools response for valid list"
+ )
+ self.assertNotEqual(
+ pools,
+ None,
+ "Check if pools exists in ListStoragePools"
+ )
+
pool = pools[0]
self.debug("Migrating Volume-ID: %s to Pool: %s" % (
volume.id,
[15/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
Adding isolation method to the zone creation of 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/808b49b2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/808b49b2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/808b49b2
Branch: refs/heads/vmware-datamodel
Commit: 808b49b21685ec850230c121492127f2047830c7
Parents: b8642c8
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 15:28:20 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 15:29:10 2013 +0530
----------------------------------------------------------------------
setup/dev/advanced.cfg | 3 +++
setup/dev/basic.cfg | 3 +++
tools/marvin/marvin/configGenerator.py | 1 +
tools/marvin/marvin/deployDataCenter.py | 1 +
.../marvin/marvin/sandbox/advanced/advanced_env.py | 3 +++
tools/marvin/marvin/sandbox/basic/basic_env.py | 1 +
.../sandbox/demo/simulator/simulator_setup.py | 2 ++
7 files changed, 14 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/setup/dev/advanced.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg
index 4315989..63e435b 100644
--- a/setup/dev/advanced.cfg
+++ b/setup/dev/advanced.cfg
@@ -46,6 +46,9 @@
"broadcastdomainrange": "ZONE",
"name": "VpcVirtualRouter"
}
+ ],
+ "isolationmethods": [
+ "VLAN"
]
}
],
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/setup/dev/basic.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/basic.cfg b/setup/dev/basic.cfg
index 3f56a3c..326874d 100644
--- a/setup/dev/basic.cfg
+++ b/setup/dev/basic.cfg
@@ -42,6 +42,9 @@
"broadcastdomainrange": "Pod",
"name": "SecurityGroupProvider"
}
+ ],
+ "isolationmethods": [
+ "L3"
]
}
],
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/tools/marvin/marvin/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index e2a6a24..4e82bbe 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -133,6 +133,7 @@ class physical_network():
self.traffictypes = []
self.broadcastdomainrange = 'Zone'
self.vlan = None
+ self.isolationmethods = []
'''enable default virtual router provider'''
vrouter = provider()
vrouter.name = 'VirtualRouter'
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 5ca1ebf..2168592 100644
--- a/tools/marvin/marvin/deployDataCenter.py
+++ b/tools/marvin/marvin/deployDataCenter.py
@@ -169,6 +169,7 @@ class deployDataCenters():
phynet = createPhysicalNetwork.createPhysicalNetworkCmd()
phynet.zoneid = zoneid
phynet.name = net.name
+ phynet.isolationmethods = net.isolationmethods
phynetwrk = self.apiClient.createPhysicalNetwork(phynet)
self.addTrafficTypes(phynetwrk.id, net.traffictypes)
return phynetwrk
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/tools/marvin/marvin/sandbox/advanced/advanced_env.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/advanced/advanced_env.py b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
index db78a84..bf880f3 100644
--- a/tools/marvin/marvin/sandbox/advanced/advanced_env.py
+++ b/tools/marvin/marvin/sandbox/advanced/advanced_env.py
@@ -46,6 +46,7 @@ def describeResources(config):
z.name = 'Sandbox-%s'%(config.get('cloudstack', 'hypervisor'))
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
+ z.securitygroupenabled = 'false'
vpcprovider = provider()
vpcprovider.name = 'VpcVirtualRouter'
@@ -57,6 +58,7 @@ def describeResources(config):
pn.traffictypes = [traffictype("Guest"),
traffictype("Management", {"simulator" : "cloud-simulator-mgmt"}),
traffictype("Public", {"simulator":"cloud-simulator-public"})]
+ pn.isolationmethods = ["VLAN"]
pn.providers.append(vpcprovider)
pn2 = physical_network()
@@ -64,6 +66,7 @@ def describeResources(config):
pn2.vlan = config.get('cloudstack', 'pnet2.vlan')
pn2.tags = ["cloud-simulator-guest"]
pn2.traffictypes = [traffictype('Guest', {'simulator': 'cloud-simulator-guest'})]
+ pn2.isolationmethods = ["VLAN"]
pn2.providers.append(vpcprovider)
z.physical_networks.append(pn)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/tools/marvin/marvin/sandbox/basic/basic_env.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/basic/basic_env.py b/tools/marvin/marvin/sandbox/basic/basic_env.py
index e588fdc..cf1869f 100644
--- a/tools/marvin/marvin/sandbox/basic/basic_env.py
+++ b/tools/marvin/marvin/sandbox/basic/basic_env.py
@@ -55,6 +55,7 @@ def describeResources(config):
pn = physical_network()
pn.name = "Sandbox-pnet"
pn.traffictypes = [traffictype("Guest"), traffictype("Management")]
+ pn.isolationmethods = ["L3"]
pn.providers.append(sgprovider)
z.physical_networks.append(pn)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/808b49b2/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
index e4ec9b7..d45d482 100644
--- a/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
+++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator_setup.py
@@ -41,6 +41,7 @@ def describeResources(config):
z.name = 'Sandbox-%s'%(config.get('environment', 'hypervisor'))
z.networktype = 'Advanced'
z.guestcidraddress = '10.1.1.0/24'
+ z.securitygroupenabled = 'false'
vpcprovider = provider()
vpcprovider.name = 'VpcVirtualRouter'
@@ -48,6 +49,7 @@ def describeResources(config):
pn = physical_network()
pn.name = "Sandbox-pnet"
pn.traffictypes = [traffictype("Guest"), traffictype("Management"), traffictype("Public")]
+ pn.isolationmethods = ["VLAN"]
pn.providers.append(vpcprovider)
pn.vlan = config.get('cloudstack', 'zone.vlan')
[07/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-893 first cut
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fd3c3b6c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fd3c3b6c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fd3c3b6c
Branch: refs/heads/vmware-datamodel
Commit: fd3c3b6c47959001dddbf9b6b17e4ea26f013bd2
Parents: 5a6a115
Author: Radhika PC <ra...@citrix.com>
Authored: Tue May 7 11:30:17 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Tue May 7 11:30:17 2013 +0530
----------------------------------------------------------------------
docs/en-US/gslb.xml | 235 +++++++++++++++++++++++++++++++++++
docs/en-US/images/add-gslb.png | Bin 0 -> 17665 bytes
docs/en-US/images/gslb.png | Bin 0 -> 184080 bytes
3 files changed, 235 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd3c3b6c/docs/en-US/gslb.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/gslb.xml b/docs/en-US/gslb.xml
new file mode 100644
index 0000000..385642d
--- /dev/null
+++ b/docs/en-US/gslb.xml
@@ -0,0 +1,235 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+<section id="gslb">
+ <title>Global Server Load Balancing Support</title>
+ <para>&PRODUCT; supports Global Server Load Balancing (GSLB) functionalities to provide business
+ continuity, and enable seamless resource movement within a &PRODUCT; environment. &PRODUCT;
+ achieve this by extending its functionality of integrating with NetScaler Application Delivery
+ Controller (ADC), which also provides various GSLB capabilities, such as disaster recovery and
+ load balancing. The DNS redirection technique is used to achieve GSLB in &PRODUCT;. </para>
+ <para>In order to support his functionality, region level services and service provider are
+ introduced. A new service 'GSLB' is introduced as a region level service. The GSLB service
+ provider is introduced that will provider the GSLB service. Currently, NetScaler is the
+ supported GSLB provider in &PRODUCT;. GSLB functionality works in an Active-Active data center
+ environment. </para>
+ <section id="about-gslb">
+ <title>About Global Server Load Balancing</title>
+ <para>Global Server Load Balancing (GSLB) is an extension of load balancing functionality, which
+ is highly efficient in avoiding downtime. Based on the nature of deployment, GSLB represents a
+ set of technologies that is used for various purposes, such as load sharing, disaster
+ recovery, performance, and legal obligations. With GSLB, workloads can be distributed across
+ multiple data centers situated at geographically separated locations. GSLB can also provide an
+ alternate location for accessing a resource in the event of a failure, or to provide a means
+ of shifting traffic easily to simplify maintenance, or both.</para>
+ </section>
+ <section id="prereq-gslb">
+ <title>Prerequisites and Guidelines</title>
+ <itemizedlist>
+ <listitem>
+ <para>The GSLB functionality is supported both Basic and Advanced zones.</para>
+ </listitem>
+ <listitem>
+ <para>GSLB is added as a new network service.</para>
+ </listitem>
+ <listitem>
+ <para>GSLB service provider can be added to a physical network in a zone.</para>
+ </listitem>
+ <listitem>
+ <para>The admin is allowed to enable or disable GSLB functionality at region level.</para>
+ </listitem>
+ <listitem>
+ <para>The admin is allowed to configure a zone as GSLB capable or enabled. </para>
+ <para>A zone shall be considered as GSLB capable only if a GSLB service provider is
+ provisioned in the zone.</para>
+ </listitem>
+ <listitem>
+ <para>When users have VMs deployed in multiple availability zones which are GSLB enabled,
+ user is allowed to use the GSLB functionality to load balance traffic across the VMs in
+ multiple zones.</para>
+ </listitem>
+ <listitem>
+ <para>The users are allowed to use GSLB to load balance across the VMs across zones in a
+ region only if the admin has enabled GSLB in that region. </para>
+ </listitem>
+ <listitem>
+ <para>The users are allowed to load balance traffic across the availability zones in the
+ same region or different regions.</para>
+ </listitem>
+ <listitem>
+ <para>The admin is allowed to configure DNS name for the entire cloud.</para>
+ </listitem>
+ <listitem>
+ <para>The users can specify an unique name, across the cloud, for a globally load balanced
+ service. The provided name will be used as the domain under the DNS name associated with
+ the cloud.</para>
+ <para>The user-provided name along with the admin-provided DNS name is used to produce a
+ globally resolvable FQDN for the globally load balanced service of the user. For example,
+ if the admin has configured xyztelco.com as the DNS name for the cloud, and user specifies
+ 'foo' for the GSLB virtual service, then the FQDN name of the GSLB virtual service is
+ foo.xyztelco.com.</para>
+ </listitem>
+ <listitem>
+ <para>While setting up GSLB, users can select a load balancing method, such as round robin
+ or least RTT, that would be the load balance traffic used across the zones that are part
+ of GSLB.</para>
+ </listitem>
+ <listitem>
+ <para>The user shall be able to set weight to zone-level virtual server. Weight shall be
+ considered by the load balancing method is distributing the traffic.</para>
+ </listitem>
+ <listitem>
+ <para>The GSLB functionality shall support session persistence, where series of client
+ requests for particular domain name is sent to a virtual server on the same zone. </para>
+ <para>Statistics is collected from each GSLB virtual server.</para>
+ </listitem>
+ </itemizedlist>
+ </section>
+ <section id="gslb-add">
+ <title>Adding a GSLB Rule</title>
+ <orderedlist>
+ <listitem>
+ <para>Log in to the &PRODUCT; UI as administrator.</para>
+ </listitem>
+ <listitem>
+ <para>In the left navigation pane, click Region.</para>
+ </listitem>
+ <listitem>
+ <para>Select the region for which you want to create a GSLB rule.</para>
+ </listitem>
+ <listitem>
+ <para>In the Details tab, click View GSLB.</para>
+ </listitem>
+ <listitem>
+ <para>Click Add GSLB.</para>
+ <para>The Add GSLB page is displayed as follows:</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/add-gslb.png"/>
+ </imageobject>
+ <textobject>
+ <phrase>gslb-add.png: adding a gslb rule</phrase>
+ </textobject>
+ </mediaobject>
+ </listitem>
+ <listitem>
+ <para>Specify the following:</para>
+ <itemizedlist>
+ <listitem>
+ <para><emphasis role="bold">Name</emphasis>: Name for the GSLB rule.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Description</emphasis>: (Optional) A short description of
+ the GSLB rule that can be displayed to users.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">GSLB Domain Name</emphasis>: A preferred domain name for the
+ service.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Algorithm</emphasis>: (Optional) The algorithm to use to
+ load balance the traffic across the zones. The options are Round Robin, Least
+ Connection, and Proximity.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Service Type</emphasis>: The transport protocol to use for
+ GSLB. The options are TCP and UDP.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Domain</emphasis>: (Optional) The domain for which you want
+ to create the GSLB rule.</para>
+ </listitem>
+ <listitem>
+ <para><emphasis role="bold">Account</emphasis>: (Optional) The account on which you want
+ to apply the GSLB rule.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ <listitem>
+ <para>Click OK to confirm.</para>
+ </listitem>
+ </orderedlist>
+ </section>
+ <section id="assign-lb-gslb">
+ <title>Assigning Load Balancing Rules to GSLB</title>
+ <para/>
+ </section>
+ <section id="concept-gslb">
+ <title>How Does GSLB Works in &PRODUCT;?</title>
+ <para>The following is an illustrated conceptual model of how GLSB functionality is provided in
+ &PRODUCT;: An organization, xyztelco, has set up a public cloud that spans two zones, Zone-1
+ and Zone-2, across geographically separated data centers that are managed by &PRODUCT;.
+ Tenant-A of the cloud launches a highly available solution by using xyztelco cloud. For that
+ purpose, they launch two instances each in both the zones: VM1 and VM2 in Zone-1 and VM5 and
+ VM6 in Zone-2. Tenant-A acquires a public IP, IP-1 in Zone-1, and configures a load balancer
+ rule to load balance the traffic between VM1 and VM2 instances. &PRODUCT; orchestrates setting
+ up a virtual server on the LB service provider in Zone-1. Virtual server 1 that is set up on
+ the LB service provider in Zone-1 represents a publicly accessible virtual server that client
+ reaches at IP-1. The client traffic to virtual server 1 at IP-1 will be load balanced across
+ VM1 and VM2 instances. </para>
+ <para>Tenant-A acquires another public IP, IP-2 in Zone-2 and sets up a load balancer rule to
+ load balance the traffic between VM5 and VM6 instances. Similarly in Zone-2, &PRODUCT;
+ orchestrates setting up a virtual server on the LB service provider. Virtual server 2 that is
+ setup on the LB service provider in Zone-2 represents a publicly accessible virtual server
+ that client reaches at IP-2. The client traffic that reaches virtual server 2 at IP-2 is load
+ balanced across VM5 and VM6 instances. At this point Tenant-A has the service enabled in both
+ the zones, but has no means to set up a disaster recovery plan if one of the zone fails.
+ Additionally, there is no way for Tenant-A to load balance the traffic intelligently to one of
+ the zones based on load, proximity and so on. The cloud administrator of xyztelco provisions a
+ GSLB service provider to both the zones. A GSLB provider is typically an ADC that has the
+ ability to act as an ADNS (Authoritative Domain Name Server) and has the mechanism to monitor
+ health of virtual servers both at local and remote sites. The cloud admin enables GSLB as a
+ service to the tenants that use zones 1 and 2. </para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/gslb.png"/>
+ </imageobject>
+ <textobject>
+ <phrase>gslb.png: GSLB architecture</phrase>
+ </textobject>
+ </mediaobject>
+ <para>Tenant-A wishes to leverage the GSLB service provided by the xyztelco cloud. Tenant-A
+ configures a GSLB rule to load balance traffic across virtual server 1 at Zone-1 and virtual
+ server 2 at Zone-2. The domain name is provided as A.xyztelco.com. &PRODUCT; orchestrates
+ setting up GSLB virtual server 1 on the GSLB service provider at Zone-1. &PRODUCT; binds
+ virtual server 1 of Zone-1 and virtual server 2 of Zone-2 to GLSB virtual server 1. GSLB
+ virtual server 1 is configured to start monitoring the health of virtual server 1 and 2 in
+ Zone-1. &PRODUCT; will also orchestrate setting up GSLB virtual server 2 on GSLB service
+ provider at Zone-2. &PRODUCT; will bind virtual server 1 of Zone-1 and virtual server 2 of
+ Zone-2 to GLSB virtual server 2. GSLB virtual server 2 is configured to start monitoring the
+ health of virtual server 1 and 2. &PRODUCT; will bind the domain A.xyztelco.com to both the
+ GSLB virtual server 1 and 2. At this point, Tenant-A service will be globally reachable at
+ A.xyztelco.com. The private DNS server for the domain xyztelcom.com is configured by the admin
+ out-of-band to resolve the domain A.xyztelco.com to the GSLB providers at both the zones,
+ which are configured as ADNS for the domain A.xyztelco.com. A client when sends a DNS request
+ to resolve A.xyztelcom.com, will eventually get DNS delegation to the address of GSLB
+ providers at Zone 1 and 2. A client DNS request will be received by the GSLB provider. The
+ GSLB provider, depending on the domain for which it needs to resolve, will pick up the GSLB
+ virtual server associated with the domain. Depending on the health of the virtual servers
+ being load balanced, DNS request for the domain will be resolved to the public IP associated
+ with the selected virtual server.</para>
+ </section>
+ <section id="limitation-gslb">
+ <title>Known Limitation</title>
+ <para>Currently, &PRODUCT; does not support orchestration of services across the zones. The
+ notion of services and service providers in region are to be introduced.</para>
+ </section>
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd3c3b6c/docs/en-US/images/add-gslb.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/add-gslb.png b/docs/en-US/images/add-gslb.png
new file mode 100644
index 0000000..827a913
Binary files /dev/null and b/docs/en-US/images/add-gslb.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd3c3b6c/docs/en-US/images/gslb.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/gslb.png b/docs/en-US/images/gslb.png
new file mode 100644
index 0000000..8d1a389
Binary files /dev/null and b/docs/en-US/images/gslb.png differ
[21/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
UI plugin API: Support IE-compatible CSS loading
If browser is IE < 9, use document.createStyleSheet to properly load
plugin's CSS dynamically.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5b74b4d6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5b74b4d6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5b74b4d6
Branch: refs/heads/vmware-datamodel
Commit: 5b74b4d6fe68e81d76ce8743c017201212f0d7aa
Parents: 732566e
Author: Brian Federle <br...@citrix.com>
Authored: Tue May 7 15:44:28 2013 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Tue May 7 15:44:59 2013 -0700
----------------------------------------------------------------------
ui/scripts/plugins.js | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5b74b4d6/ui/scripts/plugins.js
----------------------------------------------------------------------
diff --git a/ui/scripts/plugins.js b/ui/scripts/plugins.js
index 122f4a0..6a886ba 100644
--- a/ui/scripts/plugins.js
+++ b/ui/scripts/plugins.js
@@ -20,15 +20,20 @@
}
var loadCSS = function(path) {
- var $link = $('<link>');
+ if (document.createStyleSheet) {
+ // IE-compatible CSS loading
+ document.createStyleSheet(path);
+ } else {
+ var $link = $('<link>');
- $link.attr({
- rel: 'stylesheet',
- type: 'text/css',
- href: path
- });
+ $link.attr({
+ rel: 'stylesheet',
+ type: 'text/css',
+ href: path
+ });
- $('head').append($link);
+ $('html head').append($link);
+ }
};
$.extend(cloudStack.pluginAPI, {
[36/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2145 : Failed to create guest nexus port profile while deploying the First VM on Nexus VMWARE Cluster
Additional stuff needs to be configured in guest port profile when Vnmc is present to provide firewall services.
The xml command used to configure port profile had issues with special characters in the input value for 'org' parameter.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/44f3f5ec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/44f3f5ec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/44f3f5ec
Branch: refs/heads/vmware-datamodel
Commit: 44f3f5eca529b5f9bfe08a984fed8ce23160b9c5
Parents: 305f3cb
Author: Koushik Das <ko...@citrix.com>
Authored: Wed May 8 17:52:02 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Wed May 8 17:52:02 2013 +0530
----------------------------------------------------------------------
.../com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44f3f5ec/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java b/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java
index fdab390..d86b710 100644
--- a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java
+++ b/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java
@@ -546,10 +546,15 @@ public class VsmCommand {
vmware.appendChild(portgroup);
portProf.appendChild(vmware);
- // org root/%vdc%
+ // org %vdc%
// vservice node <Node Name> profile <Edge Security Profile Name in VNMC>
+ Element vdcValue = doc.createElement(s_paramvalue);
+ vdcValue.setAttribute("isKey", "true");
+ vdcValue.setTextContent(vdc);
+
Element org = doc.createElement("org");
- org.appendChild(doc.createElement(vdc));
+ org.appendChild(doc.createElement("orgname"))
+ .appendChild(vdcValue);
portProf.appendChild(org);
String asaNodeName = "ASA_" + vlanid;
[16/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
adding ACL for dedicateGuestVlanRange set of APIs
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/b8642c80
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b8642c80
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b8642c80
Branch: refs/heads/vmware-datamodel
Commit: b8642c80efa8e4a3a7ae56db1264231ac0d7bf20
Parents: 1d24cbc
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 15:27:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 15:29:10 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/commands.properties.in | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8642c80/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index 22de93d..687c3c1 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -126,8 +126,10 @@ createVlanIpRange=1
deleteVlanIpRange=1
listVlanIpRanges=1
dedicatePublicIpRange=1
-dedicateGuestVlanRange=1
releasePublicIpRange=1
+dedicateGuestVlanRange=1
+releaseDedicatedGuestVlanRange=1
+listDedicatedGuestVlanRanges=1
#### address commands
associateIpAddress=15
[17/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
add debug logs when access checkers fail to find API
When the access checkers fail for api discovery, we fail silently.
instead record a debug message.
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/1d24cbc3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1d24cbc3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1d24cbc3
Branch: refs/heads/vmware-datamodel
Commit: 1d24cbc3071e6b6b75449e01ec8d1a4dc9744ec4
Parents: 9ee8533
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Tue May 7 15:26:48 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Tue May 7 15:29:10 2013 +0530
----------------------------------------------------------------------
.../discovery/ApiDiscoveryServiceImpl.java | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d24cbc3/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index 08fb573..860240f 100755
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -219,6 +219,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
try {
apiChecker.checkAccess(user, name);
} catch (Exception ex) {
+ s_logger.debug("API discovery access check failed for " + name + " with " + ex.getMessage());
return null;
}
}
[45/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to
57444fc
Posted by sa...@apache.org.
CLOUDSTACK-2408: Object name is Null with list VNMC/List ASA API response
Made the object name consistent between list and add api responses
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8f9a42e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8f9a42e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8f9a42e0
Branch: refs/heads/vmware-datamodel
Commit: 8f9a42e0af7424517c7853197a781c0c81addad1
Parents: bde9ad3
Author: Koushik Das <ko...@citrix.com>
Authored: Thu May 9 15:58:59 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Thu May 9 15:58:59 2013 +0530
----------------------------------------------------------------------
.../commands/ListCiscoAsa1000vResourcesCmd.java | 2 +-
.../api/commands/ListCiscoVnmcResourcesCmd.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f9a42e0/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
index 7a4db69..88ea270 100755
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoAsa1000vResourcesCmd.java
@@ -89,7 +89,7 @@ public class ListCiscoAsa1000vResourcesCmd extends BaseListCmd {
if (ciscoAsa1000vDevices != null && !ciscoAsa1000vDevices.isEmpty()) {
for (CiscoAsa1000vDevice ciscoAsa1000vDeviceVO : ciscoAsa1000vDevices) {
CiscoAsa1000vResourceResponse ciscoAsa1000vResourceResponse = _ciscoAsa1000vService.createCiscoAsa1000vResourceResponse(ciscoAsa1000vDeviceVO);
- ciscoAsa1000vResourceResponse.setObjectName("asa1000v");
+ ciscoAsa1000vResourceResponse.setObjectName("CiscoAsa1000vResource");
ciscoAsa1000vResourcesResponse.add(ciscoAsa1000vResourceResponse);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f9a42e0/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
index b15c4e1..73128ec 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/api/commands/ListCiscoVnmcResourcesCmd.java
@@ -84,7 +84,7 @@ public class ListCiscoVnmcResourcesCmd extends BaseListCmd {
if (ciscoVnmcResources != null && !ciscoVnmcResources.isEmpty()) {
for (CiscoVnmcController ciscoVnmcResourceVO : ciscoVnmcResources) {
CiscoVnmcResourceResponse ciscoVnmcResourceResponse = _ciscoVnmcElementService.createCiscoVnmcResourceResponse(ciscoVnmcResourceVO);
- ciscoVnmcResourceResponse.setObjectName("vnmc");
+ ciscoVnmcResourceResponse.setObjectName("CiscoVnmcResource");
ciscoVnmcResourcesResponse.add(ciscoVnmcResourceResponse);
}
}