Merge branch 'master' into entity

This commit is contained in:
Min Chen 2013-03-20 15:55:39 -07:00
commit 485bcf26a2
41 changed files with 605 additions and 474 deletions

View File

@ -219,6 +219,11 @@
<artifactId>cloud-engine-storage-volume</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
@ -243,7 +248,6 @@
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<jvmArgs>-XX:MaxPermSize=512m -Xmx2g</jvmArgs>
<webXml>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</webXml>
<webAppSourceDirectory>${project.build.directory}/${project.build.finalName}</webAppSourceDirectory>
<webAppConfig>
@ -481,21 +485,6 @@
</pluginManagement>
</build>
<profiles>
<profile>
<id>simulator</id>
<activation>
<property>
<name>simulator</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</profile>
<profile>
<id>netapp</id>
<activation>

View File

@ -36,9 +36,25 @@
-->
<bean id="databaseUpgradeChecker" class="com.cloud.upgrade.DatabaseUpgradeChecker" />
<bean id="encryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker" />
<bean id="managementServerImpl" class ="com.cloud.server.ManagementServerImpl" />
<bean id="configurationServerImpl" class="com.cloud.server.ConfigurationServerImpl" />
<bean id="managementServerImpl" class ="com.cloud.server.ManagementServerImpl" >
<property name="UserAuthenticators">
<list>
<ref bean="MD5UserAuthenticator"/>
<ref bean="LDAPUserAuthenticator"/>
</list>
</property>
</bean>
<bean id ="AccountManagerImpl" class="com.cloud.user.AccountManagerImpl">
<property name="UserAuthenticators">
<list>
<ref bean="MD5UserAuthenticator"/>
<ref bean="LDAPUserAuthenticator"/>
</list>
</property>
</bean>
<bean id="clusterManagerImpl" class="com.cloud.cluster.ClusterManagerImpl" />
<bean id="clusteredAgentManagerImpl" class="com.cloud.agent.manager.ClusteredAgentManagerImpl" />
@ -191,6 +207,12 @@
<property name="name" value="XCP Agent"/>
</bean>
<!--
<bean id="SimulatorSecondaryStorageDiscoverer" class="com.cloud.resource.SimulatorSecondaryDiscoverer">
<property name="name" value="SecondaryStorage"/>
</bean>
-->
<bean id="SecondaryStorageDiscoverer" class="com.cloud.storage.secondary.SecondaryStorageDiscoverer">
<property name="name" value="SecondaryStorage"/>
</bean>
@ -199,11 +221,9 @@
<property name="name" value="KVM Agent"/>
</bean>
<!--
<bean id="SimulatorDiscoverer" class="com.cloud.resource.SimulatorDiscoverer">
<property name="name" value="KVM Agent"/>
<property name="name" value="Simulator Agent"/>
</bean>
-->
<bean id="BareMetalDiscoverer" class="com.cloud.baremetal.manager.BareMetalDiscoverer">
@ -302,11 +322,9 @@
<property name="name" value="OvmGuru"/>
</bean>
<!--
<bean id="SimulatorGuru" class="com.cloud.simulator.SimulatorGuru">
<property name="name" value="SimulatorGuru"/>
</bean>
-->
<bean id="BaremetalGuru" class="com.cloud.baremetal.manager.BareMetalGuru">
<property name="name" value="BaremetalGuru"/>

View File

@ -37,8 +37,24 @@
-->
<bean id="premiumDatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
<bean id="managementServerImpl" class ="com.cloud.server.ManagementServerImpl" />
<bean id="configurationServerImpl" class="com.cloud.server.ConfigurationServerImpl" />
<bean id="managementServerImpl" class ="com.cloud.server.ManagementServerImpl" >
<property name="UserAuthenticators">
<list>
<ref bean="MD5UserAuthenticator"/>
<ref bean="LDAPUserAuthenticator"/>
</list>
</property>
</bean>
<bean id ="AccountManagerImpl" class="com.cloud.user.AccountManagerImpl">
<property name="UserAuthenticators">
<list>
<ref bean="MD5UserAuthenticator"/>
<ref bean="LDAPUserAuthenticator"/>
</list>
</property>
</bean>
<bean id="clusterManagerImpl" class="com.cloud.cluster.ClusterManagerImpl" />
<bean id="clusteredAgentManagerImpl" class="com.cloud.agent.manager.ClusteredAgentManagerImpl" />

View File

@ -10,7 +10,7 @@
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-developer</artifactId>
<name>Apache CloudStack Developer Tools</name>
@ -21,25 +21,98 @@
<version>4.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.21</version>
<scope>runtime</scope>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/../utils/conf/db.properties</file>
<file>${basedir}/../utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<filter token="VERSION" value="${project.version}"/>
<copy todir="${basedir}/target/db" filtering="true">
<fileset dir="${basedir}/../setup/db/"/>
</copy>
<copy todir="${basedir}/target/db" filtering="true">
<fileset
dir="${basedir}/../awsapi-setup/db/mysql/">
<include name="**/*.sql"/>
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- default deploydb property -->
<id>deploydb</id>
<activation>
<property>
@ -48,91 +121,10 @@
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.parent.basedir}/utils/conf/db.properties</file>
<file>${project.parent.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<filter token="VERSION" value="${project.version}" />
<copy todir="${basedir}/target/db" filtering="true">
<fileset dir="${project.basedir}/../setup/db/" />
</copy>
<copy todir="${basedir}/target/db" filtering="true">
<fileset
dir="${project.basedir}/../awsapi-setup/db/mysql/">
<include name="**/*.sql" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- DatabaseCreator driver here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
@ -143,17 +135,11 @@
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
</executableDependency>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<!-- db properties file -->
<argument>${project.parent.basedir}/utils/conf/db.properties</argument>
<argument>${project.parent.basedir}/utils/conf/db.properties.override</argument>
<argument>${basedir}/../utils/conf/db.properties</argument>
<argument>${basedir}/../utils/conf/db.properties.override</argument>
<!-- Create default schema and db table views -->
<argument>${basedir}/target/db/create-schema.sql</argument>
<argument>${basedir}/target/db/create-schema-premium.sql</argument>
@ -181,7 +167,59 @@
<systemProperties>
<systemProperty>
<key>catalina.home</key>
<value>${project.parent.basedir}/utils</value>
<value>${basedir}/../utils</value>
</systemProperty>
<systemProperty>
<key>paths.script</key>
<value>${basedir}/target/db</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- simulator deploydb property -->
<id>deploydb-simulator</id>
<activation>
<property>
<name>deploydb-simulator</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema-simulator</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<!-- db properties file -->
<argument>${basedir}/../utils/conf/db.properties</argument>
<argument>${basedir}/../utils/conf/db.properties.override</argument>
<!-- simulator sql files -->
<argument>${basedir}/target/db/create-schema-simulator.sql</argument>
<argument>${basedir}/target/db/templates.simulator.sql</argument>
<!-- upgrade -->
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
<argument>--database=simulator</argument>
<argument>--rootpassword=${db.root.password}</argument>
</arguments>
<systemProperties>
<systemProperty>
<key>catalina.home</key>
<value>${basedir}/../utils</value>
</systemProperty>
<systemProperty>
<key>paths.script</key>
@ -194,4 +232,4 @@
</build>
</profile>
</profiles>
</project>
</project>

View File

@ -62,9 +62,20 @@
<para>listNetworks</para>
</entry>
<entry>
<para>The following request parameters has been added: isPersistent</para>
<para>This parameter determines if the network or network offering listed by using this
offering are persistent or not.</para>
<para>The following request parameters have been added:</para>
<itemizedlist>
<listitem>
<para>isPersistent</para>
<para>This parameter determines if the network or network offering listed are
persistent or not.</para>
</listitem>
<listitem>
<para>ip6gateway</para>
</listitem>
<listitem>
<para>ip6cidr</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row>
@ -104,7 +115,7 @@
<para>CreateZoneCmd</para>
</entry>
<entry>
<para>The following parameter are added: ip6dns1, ip6dns2.</para>
<para>The following parameter have been added: ip6dns1, ip6dns2.</para>
</entry>
</row>
<row>
@ -113,7 +124,7 @@
<para>listVirtualMachines</para>
</entry>
<entry>
<para>For nic responses, the following fields has been added.</para>
<para>For nic responses, the following fields have been added.</para>
<itemizedlist>
<listitem>
<para>ip6address</para>
@ -132,7 +143,7 @@
<para>listVlanIpRanges</para>
</entry>
<entry>
<para>For nic responses, the following fields has been added.</para>
<para>For nic responses, the following fields have been added.</para>
<itemizedlist>
<listitem>
<para>startipv6</para>
@ -166,7 +177,7 @@
</listitem>
</itemizedlist>
</entry>
</row>
</row>
<row>
<entry>
<para>addF5LoadBalancer</para>

View File

@ -106,14 +106,14 @@
<listitem>
<para>Passwords</para>
</listitem>
<listitem>
<para>The administrator cannot specify the IPv6 address of a VM.</para>
</listitem>
</orderedlist>
</section>
<section id="network-conf-dhcpv6">
<title>Network Configuration for DHCPv6</title>
<para>Use DUID-LL to get IPv6 address from DHCP server</para>
<title>Guest VM Configuration for DHCPv6</title>
<para>For the guest VMs to get IPv6 address, run dhclient command manually on each of the VMs.
Use DUID-LL to set up dhclient. </para>
<note><para>The IPv6 address is lost when a VM is stopped and started. Therefore, use the same procedure
to get an IPv6 address when a VM is stopped and started.</para></note>
<orderedlist>
<listitem>
<para>Set up dhclient by using DUID-LL.</para>

View File

@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.engine.subsystem.api.storage;
public abstract class AbstractScope implements Scope {
@Override
public boolean isSameScope(Scope scope) {
if (this.getScopeType() == scope.getScopeType() && this.getScopeId() == scope.getScopeId()) {
return true;
} else {
return false;
}
}
}

View File

@ -19,7 +19,7 @@
package org.apache.cloudstack.engine.subsystem.api.storage;
public class ClusterScope implements Scope {
public class ClusterScope extends AbstractScope {
private ScopeType type = ScopeType.CLUSTER;
private Long clusterId;
private Long podId;

View File

@ -19,7 +19,7 @@
package org.apache.cloudstack.engine.subsystem.api.storage;
public class HostScope implements Scope {
public class HostScope extends AbstractScope {
private ScopeType type = ScopeType.HOST;
private Long hostId;
public HostScope(Long hostId) {

View File

@ -20,5 +20,6 @@ package org.apache.cloudstack.engine.subsystem.api.storage;
public interface Scope {
public ScopeType getScopeType();
public boolean isSameScope(Scope scope);
public Long getScopeId();
}

View File

@ -19,7 +19,7 @@
package org.apache.cloudstack.engine.subsystem.api.storage;
public class ZoneScope implements Scope {
public class ZoneScope extends AbstractScope {
private ScopeType type = ScopeType.ZONE;
private Long zoneId;

View File

@ -0,0 +1,59 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.engine.subsystem.api.storage;
import static org.junit.Assert.*;
import junit.framework.Assert;
import org.junit.Test;
public class ScopeTest {
@Test
public void testZoneScope() {
ZoneScope zoneScope = new ZoneScope(1L);
ZoneScope zoneScope2 = new ZoneScope(1L);
Assert.assertTrue(zoneScope.isSameScope(zoneScope2));
ZoneScope zoneScope3 = new ZoneScope(2L);
Assert.assertFalse(zoneScope.isSameScope(zoneScope3));
}
@Test
public void testClusterScope() {
ClusterScope clusterScope = new ClusterScope(1L, 1L, 1L);
ClusterScope clusterScope2 = new ClusterScope(1L, 1L, 1L);
Assert.assertTrue(clusterScope.isSameScope(clusterScope2));
ClusterScope clusterScope3 = new ClusterScope(2L, 2L, 1L);
Assert.assertFalse(clusterScope.isSameScope(clusterScope3));
}
@Test
public void testHostScope() {
HostScope hostScope = new HostScope(1L);
HostScope hostScope2 = new HostScope(1L);
HostScope hostScope3 = new HostScope(2L);
Assert.assertTrue(hostScope.isSameScope(hostScope2));
Assert.assertFalse(hostScope.isSameScope(hostScope3));
}
}

View File

@ -29,6 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
@ -48,9 +49,11 @@ import org.apache.log4j.Logger;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.StoragePoolHostVO;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VMTemplatePoolDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.utils.component.ComponentContext;
@ -74,6 +77,8 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
protected DataStoreProvider provider;
@Inject
VMTemplatePoolDao templatePoolDao;
@Inject
StoragePoolHostDao poolHostDao;
private VolumeDao volumeDao;
@ -152,6 +157,12 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore {
vo.getDataCenterId());
} else if (vo.getScope() == ScopeType.ZONE) {
return new ZoneScope(vo.getDataCenterId());
} else if (vo.getScope() == ScopeType.HOST) {
List<StoragePoolHostVO> poolHosts = poolHostDao.listByPoolId(vo.getId());
if (poolHosts.size() > 0) {
return new HostScope(poolHosts.get(0).getHostId());
}
s_logger.debug("can't find a local storage in pool host table: " + vo.getId());
}
return null;
}

View File

@ -44,7 +44,7 @@ import com.cloud.storage.secondary.SecondaryStorageDiscoverer;
import com.cloud.utils.exception.CloudRuntimeException;
import org.springframework.stereotype.Component;
@Component
@Local(value=Discoverer.class)
public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer implements ResourceStateAdapter, Listener {
private static final Logger s_logger = Logger.getLogger(SimulatorSecondaryDiscoverer.class);

113
pom.xml
View File

@ -182,7 +182,6 @@
<version>${cs.junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
@ -222,14 +221,12 @@
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
@ -276,7 +273,7 @@
</goals>
</pluginExecutionFilter>
<action>
<ignore />
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
@ -509,113 +506,5 @@
<module>vmware-base</module>
</modules>
</profile>
<profile>
<id>simulator</id>
<activation>
<property>
<name>deploydb-simulator</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/utils/conf/db.properties</file>
<file>${project.basedir}/utils/conf/db.properties.override</file>
</files>
<quiet>true</quiet>
</configuration>
</execution>
</executions>
</plugin>
<!-- DatabaseCreator driver here -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<dependencies>
<!-- specify the dependent jdbc driver here -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${cs.mysql.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${cs.dbcp.version}</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${cs.pool.version}</version>
</dependency>
<dependency>
<groupId>org.jasypt</groupId>
<artifactId>jasypt</artifactId>
<version>${cs.jasypt.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-resources</phase>
<id>create-schema</id>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-server</artifactId>
</executableDependency>
<mainClass>com.cloud.upgrade.DatabaseCreator</mainClass>
<arguments>
<!-- db properties file -->
<argument>${project.basedir}/utils/conf/db.properties</argument>
<argument>${project.basedir}/utils/conf/db.properties.override</argument>
<!-- simulator sql files -->
<argument>${basedir}/target/db/create-schema-simulator.sql</argument>
<argument>${basedir}/target/db/templates.simulator.sql</argument>
<!-- database upgrade -->
<argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument>
<argument>--database=simulator</argument>
<argument>--rootpassword=${db.root.password}</argument>
<!-- enable verbosity by -v or dash-dash-verbose -->
</arguments>
<systemProperties>
<systemProperty>
<key>catalina.home</key>
<value>${project.basedir}/utils</value>
</systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -185,6 +185,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
nicResponse.setGateway(userVm.getGateway());
nicResponse.setNetmask(userVm.getNetmask());
nicResponse.setNetworkid(userVm.getNetworkUuid());
nicResponse.setNetworkName(userVm.getNetworkName());
nicResponse.setMacAddress(userVm.getMacAddress());
nicResponse.setIp6Address(userVm.getIp6Address());
nicResponse.setIp6Gateway(userVm.getIp6Gateway());
@ -246,6 +247,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase<UserVmJoinVO, Long> implem
nicResponse.setGateway(uvo.getGateway());
nicResponse.setNetmask(uvo.getNetmask());
nicResponse.setNetworkid(uvo.getNetworkUuid());
nicResponse.setNetworkName(uvo.getNetworkName());
nicResponse.setMacAddress(uvo.getMacAddress());
nicResponse.setIp6Address(uvo.getIp6Address());
nicResponse.setIp6Gateway(uvo.getIp6Gateway());

View File

@ -293,6 +293,9 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
@Column(name="network_uuid")
private String networkUuid;
@Column(name="network_name")
private String networkName;
@Column(name="traffic_type")
@Enumerated(value=EnumType.STRING)
private TrafficType trafficType;
@ -1168,6 +1171,16 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity {
}
public String getNetworkName() {
return networkName;
}
public void setNetworkName(String networkName) {
this.networkName = networkName;
}
public TrafficType getTrafficType() {
return trafficType;
}

View File

@ -1644,6 +1644,11 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
if (usedIps.size() != 0) {
allPossibleIps.removeAll(usedIps);
}
String gateway = network.getGateway();
if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))
allPossibleIps.remove(NetUtils.ip2Long(gateway));
return allPossibleIps;
}

View File

@ -2046,6 +2046,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (usedIps.size() != 0) {
allPossibleIps.removeAll(usedIps);
}
String gateway = network.getGateway();
if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway))))
allPossibleIps.remove(NetUtils.ip2Long(gateway));
return allPossibleIps;
}

View File

@ -414,13 +414,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
S3Manager _s3Mgr;
/*
@Inject
ComponentContext _forceContextRef; // create a dependency to ComponentContext so that it can be loaded beforehead
@Inject
EventUtils _forceEventUtilsRef;
*/
private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker"));
private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker"));
private KeystoreManager _ksMgr;
@ -429,7 +422,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
private Map<String, Boolean> _availableIdsMap;
@Inject List<UserAuthenticator> _userAuthenticators;
List<UserAuthenticator> _userAuthenticators;
@Inject ClusterManager _clusterMgr;
private String _hashKey = null;
@ -437,6 +430,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
public ManagementServerImpl() {
setRunLevel(ComponentLifecycle.RUN_LEVEL_APPLICATION_MAINLOOP);
}
public List<UserAuthenticator> getUserAuthenticators() {
return _userAuthenticators;
}
public void setUserAuthenticators(List<UserAuthenticator> authenticators) {
_userAuthenticators = authenticators;
}
@Override
public boolean configure(String name, Map<String, Object> params)
@ -2103,13 +2104,13 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
cmdList.add(QueryAsyncJobResultCmd.class);
cmdList.add(AssignToLoadBalancerRuleCmd.class);
cmdList.add(CreateLBStickinessPolicyCmd.class);
cmdList.add(CreateLBHealthCheckPolicyCmd .class);
cmdList.add(CreateLBHealthCheckPolicyCmd.class);
cmdList.add(CreateLoadBalancerRuleCmd.class);
cmdList.add(DeleteLBStickinessPolicyCmd.class);
cmdList.add(DeleteLBHealthCheckPolicyCmd .class);
cmdList.add(DeleteLBHealthCheckPolicyCmd.class);
cmdList.add(DeleteLoadBalancerRuleCmd.class);
cmdList.add(ListLBStickinessPoliciesCmd.class);
cmdList.add(ListLBHealthCheckPoliciesCmd .class);
cmdList.add(ListLBHealthCheckPoliciesCmd.class);
cmdList.add(ListLoadBalancerRuleInstancesCmd.class);
cmdList.add(ListLoadBalancerRulesCmd.class);
cmdList.add(RemoveFromLoadBalancerRuleCmd.class);

View File

@ -27,10 +27,15 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.resource.ResourceManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@ -88,6 +93,7 @@ public class StatsCollector {
@Inject private StoragePoolHostDao _storagePoolHostDao;
@Inject private SecondaryStorageVmManager _ssvmMgr;
@Inject private ResourceManager _resourceMgr;
@Inject private ConfigurationDao _configDao;
private ConcurrentHashMap<Long, HostStats> _hostStats = new ConcurrentHashMap<Long, HostStats>();
private final ConcurrentHashMap<Long, VmStats> _VmStats = new ConcurrentHashMap<Long, VmStats>();
@ -107,6 +113,7 @@ public class StatsCollector {
}
public static StatsCollector getInstance(Map<String, String> configs) {
s_instance.init(configs);
return s_instance;
}
@ -114,6 +121,11 @@ public class StatsCollector {
s_instance = this;
}
@PostConstruct
private void init(){
init(_configDao.getConfiguration());
}
private void init(Map<String, String> configs) {
_executor = Executors.newScheduledThreadPool(3, new NamedThreadFactory("StatsCollector"));

View File

@ -48,6 +48,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManag
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
@ -1439,64 +1440,30 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
}
private boolean needMoveVolume(VolumeVO rootVolumeOfVm, VolumeInfo volume) {
StoragePoolVO vmRootVolumePool = _storagePoolDao
.findById(rootVolumeOfVm.getPoolId());
DiskOfferingVO volumeDiskOffering = _diskOfferingDao
.findById(volume.getDiskOfferingId());
String[] volumeTags = volumeDiskOffering.getTagsArray();
boolean isVolumeOnSharedPool = !volumeDiskOffering
.getUseLocalStorage();
StoragePoolVO sourcePool = _storagePoolDao.findById(volume
.getPoolId());
List<StoragePoolVO> matchingVMPools = _storagePoolDao
.findPoolsByTags(vmRootVolumePool.getDataCenterId(),
vmRootVolumePool.getPodId(),
vmRootVolumePool.getClusterId(), volumeTags
);
DataStore storeForRootVol = this.dataStoreMgr.getPrimaryDataStore(rootVolumeOfVm.getPoolId());
DataStore storeForDataVol = this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
boolean moveVolumeNeeded = true;
if (matchingVMPools.size() == 0) {
String poolType;
if (vmRootVolumePool.getClusterId() != null) {
poolType = "cluster";
} else if (vmRootVolumePool.getPodId() != null) {
poolType = "pod";
} else {
poolType = "zone";
}
throw new CloudRuntimeException(
"There are no storage pools in the VM's " + poolType
+ " with all of the volume's tags ("
+ volumeDiskOffering.getTags() + ").");
} else {
long sourcePoolId = sourcePool.getId();
Long sourcePoolDcId = sourcePool.getDataCenterId();
Long sourcePoolPodId = sourcePool.getPodId();
Long sourcePoolClusterId = sourcePool.getClusterId();
for (StoragePoolVO vmPool : matchingVMPools) {
long vmPoolId = vmPool.getId();
Long vmPoolDcId = vmPool.getDataCenterId();
Long vmPoolPodId = vmPool.getPodId();
Long vmPoolClusterId = vmPool.getClusterId();
// Moving a volume is not required if storage pools belongs
// to same cluster in case of shared volume or
// identical storage pool in case of local
if (sourcePoolDcId == vmPoolDcId
&& sourcePoolPodId == vmPoolPodId
&& sourcePoolClusterId == vmPoolClusterId
&& (isVolumeOnSharedPool || sourcePoolId == vmPoolId)) {
moveVolumeNeeded = false;
break;
}
}
Scope storeForRootStoreScope = storeForRootVol.getScope();
if (storeForRootStoreScope == null) {
throw new CloudRuntimeException("Can't get scope of data store: " + storeForRootVol.getId());
}
return moveVolumeNeeded;
Scope storeForDataStoreScope = storeForDataVol.getScope();
if (storeForDataStoreScope == null) {
throw new CloudRuntimeException("Can't get scope of data store: " + storeForDataVol.getId());
}
if (storeForDataStoreScope.getScopeType() == ScopeType.ZONE) {
return false;
}
if (storeForRootStoreScope.getScopeType() != storeForDataStoreScope.getScopeType()) {
throw new CloudRuntimeException("Can't move volume between scope: " + storeForDataStoreScope.getScopeType() + " and " + storeForRootStoreScope.getScopeType());
}
return !storeForRootStoreScope.isSameScope(storeForDataStoreScope);
}
private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volume, Long deviceId) {
String errorMsg = "Failed to attach volume: " + volume.getName()
+ " to VM: " + vm.getHostName();
@ -2166,7 +2133,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
+ assignedPool
+ " assigned by deploymentPlanner");
}
VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, null);
VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
tasks.add(task);
}
} else {

View File

@ -48,7 +48,6 @@ import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.api.ApiDBUtils;
import com.cloud.api.query.dao.UserAccountJoinDao;
@ -140,7 +139,6 @@ import com.cloud.vm.dao.InstanceGroupDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
@Component
@Local(value = { AccountManager.class, AccountService.class })
public class AccountManagerImpl extends ManagerBase implements AccountManager, Manager {
public static final Logger s_logger = Logger.getLogger(AccountManagerImpl.class);
@ -223,7 +221,6 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
private AutoScaleManager _autoscaleMgr;
@Inject VolumeManager volumeMgr;
@Inject
private List<UserAuthenticator> _userAuthenticators;
private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AccountChecker"));
@ -237,6 +234,14 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
List<SecurityChecker> _securityCheckers;
int _cleanupInterval;
public List<UserAuthenticator> getUserAuthenticators() {
return _userAuthenticators;
}
public void setUserAuthenticators(List<UserAuthenticator> authenticators) {
_userAuthenticators = authenticators;
}
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
_systemAccount = _accountDao.findById(AccountVO.ACCOUNT_ID_SYSTEM);

View File

@ -572,6 +572,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS
vpc.id vpc_id,
vpc.uuid vpc_uuid,
networks.uuid network_uuid,
networks.name network_name,
networks.traffic_type traffic_type,
networks.guest_type guest_type,
user_ip_address.id public_ip_id,
@ -750,7 +751,7 @@ CREATE VIEW `cloud`.`domain_router_view` AS
left join
`cloud`.`networks` ON nics.network_id = networks.id
left join
`cloud`.`vpc` ON networks.vpc_id = vpc.id
`cloud`.`vpc` ON domain_router.vpc_id = vpc.id
left join
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
and async_job.instance_type = 'DomainRouter'

View File

@ -82,7 +82,7 @@ class Services:
"iso": {
"displaytext": "Test ISO",
"name": "Test ISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"isextractable": True,
"isfeatured": True,

View File

@ -78,7 +78,7 @@ class Services:
"iso": {
"displaytext": "Test ISO",
"name": "Test ISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"isextractable": True,
"isfeatured": True,

View File

@ -77,7 +77,7 @@ class Services:
{
"displaytext": "Test ISO",
"name": "testISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"ostype": 'CentOS 5.3 (64-bit)',
},

View File

@ -50,7 +50,7 @@ class Services:
{
"displaytext": "Test ISO 1",
"name": "ISO 1",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"isextractable": True,
"isfeatured": True,
@ -61,7 +61,7 @@ class Services:
{
"displaytext": "Test ISO 2",
"name": "ISO 2",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"isextractable": True,
"isfeatured": True,

View File

@ -88,7 +88,7 @@ class Services:
"iso": {
"displaytext": "Test ISO",
"name": "testISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"ostype": 'CentOS 5.3 (64-bit)',
"mode": 'HTTP_DOWNLOAD', # Downloading existing ISO

View File

@ -107,7 +107,7 @@ class Services:
{
"displaytext": "Test ISO",
"name": "testISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
"url": "http://people.apache.org/~tsp/dummy.iso",
# Source URL where ISO is located
"ostype": 'CentOS 5.3 (64-bit)',
"mode": 'HTTP_DOWNLOAD', # Downloading existing ISO

View File

@ -123,6 +123,7 @@ known_categories = {
'Pool': 'Pool',
'VPC': 'VPC',
'PrivateGateway': 'VPC',
'Simulator': 'simulator',
'StaticRoute': 'VPC',
'Tags': 'Resource tags',
'NiciraNvpDevice': 'Nicira NVP',

View File

@ -100,7 +100,11 @@ def monkeycache(apis):
cache['count'] = getvalue(apis[responsekey], 'count')
cache['asyncapis'] = []
for api in getvalue(apis[responsekey], 'api'):
apilist = getvalue(apis[responsekey], 'api')
if apilist == None:
print "[monkeycache] Server response issue, no apis found"
for api in apilist:
name = getvalue(api, 'name')
verb, subject = splitverbsubject(name)

View File

@ -487,9 +487,10 @@ def main():
if options.version:
print "cloudmonkey", __version__
print __description__, "(%s)" % __projecturl__
sys.exit(0)
shell = CloudMonkeyShell(sys.argv[0], options.cfile)
if len(args) > 1:
if len(args) > 0:
shell.onecmd(' '.join(args))
else:
shell.cmdloop()

View File

@ -112,11 +112,11 @@
"logger": [
{
"name": "TestClient",
"file": "/var/log/testclient.log"
"file": "/tmp/testclient.log"
},
{
"name": "TestCase",
"file": "/var/log/testcase.log"
"file": "/tmp/testcase.log"
}
],
"globalConfig": [

View File

@ -9,112 +9,119 @@
OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License. -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>cloud-marvin</artifactId>
<name>Apache CloudStack marvin</name>
<packaging>pom</packaging>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
<version>4.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="marvin/cloudstackAPI"/>
<echo>Deleting ${project.artifactId} API sources</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${basedir}/marvin</workingDirectory>
<executable>python</executable>
<arguments>
<argument>codegenerator.py</argument>
<argument>-s</argument>
<argument>${basedir}/../apidoc/target/commands.xml</argument>
<echo>Generating ${project.artifactId} API classes}</echo>
</arguments>
</configuration>
</execution>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${exec.workingdir}</workingDirectory>
<executable>python</executable>
<arguments>
<argument>setup.py</argument>
<argument>sdist</argument>
</arguments>
</configuration>
</execution>
</executions>
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>
<packaging>pom</packaging>
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
<version>4.2.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>clean</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<delete dir="marvin/cloudstackAPI"/>
<echo>Deleting ${project.artifactId} API sources</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${basedir}/marvin</workingDirectory>
<executable>python</executable>
<arguments>
<argument>codegenerator.py</argument>
<argument>-s</argument>
<argument>${basedir}/../apidoc/target/commands.xml</argument>
<echo>Generating ${project.artifactId} API classes}</echo>
</arguments>
</configuration>
</execution>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${exec.workingdir}</workingDirectory>
<executable>python</executable>
<arguments>
<argument>setup.py</argument>
<argument>sdist</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>marvin</id>
<activation>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<workingDirectory>${basedir}/marvin</workingDirectory>
<executable>python</executable>
<arguments>
<argument>deployDataCenter.py</argument>
<argument>-i</argument>
<argument>${user.dir}/${marvin.config}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</build>
<profiles>
<profile>
<id>marvin</id>
<activation>
<property><name>marvin.config</name></property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<workingDirectory>${basedir}/marvin</workingDirectory>
<executable>python</executable>
<arguments>
<argument>deployAndRun.py</argument>
<argument>-c</argument>
<argument>${user.dir}/${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>
</arguments>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -52,17 +52,29 @@ Below is a sample login attempt
var clientApiUrl = "/client/api";
var clientConsoleUrl = "/client/console";
$(document).ready(function() {
$(document).ready(function() {
/*
condition 1: If window.location.href contains parameter 'loginUrl', save the parameter's value to a cookie, then reload the page without any URL parameter.
(After the page is reloaded without any URL parameter, it will fall in condition 2.)
*/
if ($.urlParam('loginUrl') != 0) {
$.cookie('loginUrl', $.urlParam('loginUrl'), { expires: 1});
document.location.href = '/client/';
}
var url = $.urlParam("loginUrl");
if (url != undefined && url != null && url.length > 0) {
url = unescape(clientApiUrl+"?"+url);
/*
condition 2: If window.location.href does not contain parameter 'loginUrl' but cookie 'loginUrl' exists,
save the cookie's value to g_regionUrlParam (a global variable for switching regions),
then call login API to set g_loginResponse (a global variable for single-sign-on).
*/
else if($.cookie('loginUrl') != null) {
g_regionUrlParam = '?loginUrl=' + $.cookie('loginUrl');
$.ajax({
url: url,
url: unescape(clientApiUrl + "?" + $.cookie('loginUrl')),
dataType: "json",
async: false,
success: function(json) {
g_loginResponse = json.loginresponse;
g_loginResponse = json.loginresponse;
},
error: function() {
onLogoutCallback();
@ -73,6 +85,7 @@ $(document).ready(function() {
}
});
}
});

View File

@ -251,6 +251,9 @@
array1.push("&domain=" + encodeURIComponent("/"));
}
g_regionUrlParam = '?loginUrl=' + escape("command=login" + array1.join("") + "&response=json");
$.cookie('loginUrl', escape("command=login" + array1.join("") + "&response=json"), { expires: 1});
$.ajax({
type: "POST",
data: "command=login" + array1.join("") + "&response=json",
@ -382,8 +385,9 @@
g_domainid = null;
g_timezoneoffset = null;
g_timezone = null;
g_supportELB = null;
g_supportELB = null;
g_regionUrlParam = null;
$.cookie('JSESSIONID', null);
$.cookie('sessionKey', null);
$.cookie('username', null);
@ -394,6 +398,7 @@
$.cookie('timezoneoffset', null);
$.cookie('timezone', null);
$.cookie('supportELB', null);
$.cookie('loginUrl', null);
if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen.
document.location.reload(); //when onLogoutCallback() returns true, reload the current document.

View File

@ -29,8 +29,7 @@
data: regions ? regions : [
{ id: -1, name: '(Default)' }
],
activeRegionID: cloudStack.context.users.regionid ?
cloudStack.context.users.regionid : 1
activeRegionID: cloudStack.context.users[0].regionid
});
}
});
@ -55,26 +54,34 @@
fields: {
id: { label: 'label.id', validation: { required: true } },
name: { label: 'label.name', validation: { required: true } },
endpoint: { label: 'label.endpoint', validation: { required: true } },
userapikey: { label: 'label.api.key' },
userapisecretkey: { label: 'label.s3.secret_key' }
endpoint: { label: 'label.endpoint', validation: { required: true } }
}
},
action: function(args) {
action: function(args) {
var data = {
id: args.data.id,
name: args.data.name,
endpoint: args.data.endpoint
};
$.ajax({
url: createURL('addRegion'),
data: args.data,
success: function(json) {
var jobID = json.addregionresponse.jobid;
args.response.success({ _custom: { jobId: jobID }});
data: data,
success: function(json) {
var item = json.addregionresponse.region;
args.response.success({data: item});
$(window).trigger('cloudStack.refreshRegions');
},
error: function(json) {
args.response.error(parseXMLHttpResponse(json));
}
});
}
},
notification: {
poll: function(args) {
args.complete();
}
}
}
},
dataProvider: function(args) {
@ -98,9 +105,15 @@
edit: {
label: 'label.edit.region',
action: function(args) {
var data = {
id: args.context.regions[0].id,
name: args.data.name,
endpoint: args.data.endpoint
};
$.ajax({
url: createURL('updateRegion'),
data: args.data,
data: data,
success: function(json) {
args.response.success();
$(window).trigger('cloudStack.refreshRegions');
@ -116,7 +129,15 @@
messages: {
notification: function() { return 'label.remove.region'; },
confirm: function() { return 'message.remove.region'; }
},
},
preAction: function(args) {
var region = args.context.regions[0];
if(region.endpoint == document.location.href) {
cloudStack.dialog.notice({ message: _l('You can not remove the region that you are currently in.') });
return false;
}
return true;
},
action: function(args) {
var region = args.context.regions[0];
@ -139,11 +160,11 @@
title: 'label.details',
fields: [
{
name: { label: 'label.name', isEditable: true },
id: { label: 'label.id' }
},
{
endpoint: { label: 'label.endpoint', isEditable: true },
id: { label: 'label.id', isEditable: true }
name: { label: 'label.name', isEditable: true },
endpoint: { label: 'label.endpoint', isEditable: true }
}
],
dataProvider: function(args) {

View File

@ -20,6 +20,7 @@ var g_role = null; // roles - root, domain-admin, ro-admin, user
var g_username = null;
var g_account = null;
var g_domainid = null;
var g_regionUrlParam = null;
var g_enableLogging = false;
var g_timezoneoffset = null;
var g_timezone = null;

View File

@ -29,23 +29,28 @@
var data = args.data;
var activeRegionID = args.activeRegionID;
var currentRegion;
$(data).each(function() {
var region = this;
var regionName = region.name;
var $li = $('<li>').append($('<span>').html(_s(region.name)));
$li.data('region-data', region);
if(region.endpoint == document.location.href) {
currentRegion = region;
$li.addClass('active');
}
/*
if (region.id == activeRegionID) {
$li.addClass('active');
}
$regionSwitcherButton.find('.title')
.html(regionName)
.attr('title', regionName);
$regionList.append($li);
*/
$regionList.append($li);
});
$regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name));
}
}
});
@ -81,8 +86,8 @@
closeRegionSelector({
complete: function() {
$('#container').prepend($('<div>').addClass('loading-overlay'));
document.location.href = url;
document.location.href = url + g_regionUrlParam;
}
});
};

View File

@ -632,7 +632,7 @@ public class NetUtils {
Set<Long> result = new TreeSet<Long>();
long ip = ip2Long(cidr);
long startNetMask = ip2Long(getCidrNetmask(size));
long start = (ip & startNetMask) + 2;
long start = (ip & startNetMask) + 1;
long end = start;
end = end >> (32 - size);