Brought over new changes from master

This commit is contained in:
Alex Huang 2012-09-13 11:43:22 -07:00
commit db9cc97ab3
143 changed files with 5910 additions and 7307 deletions

4
.gitignore vendored
View File

@ -51,4 +51,6 @@ deps/*.mar
*.jar *.jar
awsapi/modules/* awsapi/modules/*
!.gitignore !.gitignore
.classpath
.project
.settings.xml

View File

@ -109,6 +109,7 @@ public class SimulatorManagerImpl implements SimulatorManager {
private ConnectionConcierge _concierge; private ConnectionConcierge _concierge;
@Override @Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
/*
try { try {
Connection conn = Transaction.getStandaloneConnectionWithException(); Connection conn = Transaction.getStandaloneConnectionWithException();
conn.setAutoCommit(true); conn.setAutoCommit(true);
@ -116,6 +117,7 @@ public class SimulatorManagerImpl implements SimulatorManager {
} catch (SQLException e) { } catch (SQLException e) {
throw new CloudRuntimeException("Unable to get a db connection", e); throw new CloudRuntimeException("Unable to get a db connection", e);
} }
*/
return true; return true;
} }
@ -152,8 +154,8 @@ public class SimulatorManagerImpl implements SimulatorManager {
@DB @DB
@Override @Override
public Answer simulate(Command cmd, String hostGuid) { public Answer simulate(Command cmd, String hostGuid) {
Transaction txn = Transaction.currentTxn(); Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
txn.transitToUserManagedConnection(_concierge.conn()); // txn.transitToUserManagedConnection(_concierge.conn());
try { try {
MockHost host = _mockHost.findByGuid(hostGuid); MockHost host = _mockHost.findByGuid(hostGuid);

View File

@ -18,4 +18,4 @@
# management server compile-time environment parameters # management server compile-time environment parameters
paths.pid=@PIDDIR@ paths.pid=@PIDDIR@
paths.script=@AGENTLIBDIR@ paths.script=@COMMONLIBDIR@

View File

@ -30,13 +30,12 @@ public class IpAddressTO {
private String vlanGateway; private String vlanGateway;
private String vlanNetmask; private String vlanNetmask;
private String vifMacAddress; private String vifMacAddress;
private String guestIp;
private Integer networkRate; private Integer networkRate;
private TrafficType trafficType; private TrafficType trafficType;
private String networkName; private String networkName;
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId, public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String vlanId,
String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, boolean isOneToOneNat) { String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
this.accountId = accountId; this.accountId = accountId;
this.publicIp = ipAddress; this.publicIp = ipAddress;
this.add = add; this.add = add;
@ -46,7 +45,6 @@ public class IpAddressTO {
this.vlanGateway = vlanGateway; this.vlanGateway = vlanGateway;
this.vlanNetmask = vlanNetmask; this.vlanNetmask = vlanNetmask;
this.vifMacAddress = vifMacAddress; this.vifMacAddress = vifMacAddress;
this.guestIp = guestIp;
this.networkRate = networkRate; this.networkRate = networkRate;
this.oneToOneNat = isOneToOneNat; this.oneToOneNat = isOneToOneNat;
} }
@ -58,10 +56,6 @@ public class IpAddressTO {
return accountId; return accountId;
} }
public String getGuestIp(){
return guestIp;
}
public String getPublicIp() { public String getPublicIp() {
return publicIp; return publicIp;
} }

View File

@ -96,6 +96,9 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.ISO_ID, type=CommandType.LONG, description="list vms by iso") @Parameter(name=ApiConstants.ISO_ID, type=CommandType.LONG, description="list vms by iso")
private Long isoId; private Long isoId;
@IdentityMapper(entityTableName="vpc")
@Parameter(name=ApiConstants.VPC_ID, type=CommandType.LONG, description="list vms by vpc")
private Long vpcId;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -156,6 +159,10 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
return isoId; return isoId;
} }
public Long getVpcId(){
return vpcId;
}
public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException { public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
EnumSet<VMDetails> dv; EnumSet<VMDetails> dv;
if (viewDetails==null || viewDetails.size() <=0){ if (viewDetails==null || viewDetails.size() <=0){

View File

@ -95,12 +95,24 @@
<artifactId>rahas</artifactId> <artifactId>rahas</artifactId>
<version>1.5</version> <version>1.5</version>
<type>mar</type> <type>mar</type>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.rampart</groupId> <groupId>org.apache.rampart</groupId>
<artifactId>rampart</artifactId> <artifactId>rampart</artifactId>
<version>1.5</version> <version>1.5</version>
<type>mar</type> <type>mar</type>
<exclusions>
<exclusion>
<groupId>bouncycastle</groupId>
<artifactId>bcprov-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.rampart</groupId> <groupId>org.apache.rampart</groupId>

View File

@ -44,7 +44,7 @@
<property name="jar.dir" location="${target.dir}/jar" /> <property name="jar.dir" location="${target.dir}/jar" />
<property name="build.log" location="${target.dir}/ant_verbose.txt" /> <property name="build.log" location="${target.dir}/ant_verbose.txt" />
<property name="thirdparty.dir" location="${base.dir}/deps/awsapi-lib" /> <property name="thirdparty.dir" location="${base.dir}/deps/awsapi-lib" />
<property name="rampart.dir" location="${base.dir}/deps/awsapi-lib/rampart-lib" /> <!-- <property name="rampart.dir" location="${base.dir}/deps/awsapi-lib/rampart-lib" /> -->
<property file="${build.dir}/build-aws-api.properties" /> <property file="${build.dir}/build-aws-api.properties" />
<property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" /> <property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" />
<property name="tomcat.home" location="${catalina.dir}" /> <property name="tomcat.home" location="${catalina.dir}" />
@ -58,11 +58,11 @@
<include name="*.jar" /> <include name="*.jar" />
</fileset> </fileset>
</path> </path>
<path id="rampart.classpath"> <!-- <path id="rampart.classpath">
<fileset dir="${rampart.dir}"> <fileset dir="${rampart.dir}">
<include name="*.jar" /> <include name="*.jar" />
</fileset> </fileset>
</path> </path> -->
<path id="dist.classpath"> <path id="dist.classpath">
<fileset dir="${target.dir}"> <fileset dir="${target.dir}">
<include name="**/*.jar" /> <include name="**/*.jar" />
@ -114,7 +114,7 @@
<path id="awsapi.classpath"> <path id="awsapi.classpath">
<path refid="deps.classpath" /> <path refid="deps.classpath" />
<!-- <path refid="thirdparty.classpath" /> --> <!-- <path refid="thirdparty.classpath" /> -->
<path refid="rampart.classpath" /> <!-- <path refid="rampart.classpath" /> -->
<path refid="dist.classpath" /> <path refid="dist.classpath" />
</path> </path>
<target name="compile-awsapi" depends="-init-awsapi" description="Compile Cloud.com Simple Storage Service"> <target name="compile-awsapi" depends="-init-awsapi" description="Compile Cloud.com Simple Storage Service">
@ -171,7 +171,11 @@
</jar> </jar>
</target> </target>
<target name="deploy-axis" depends="-init-awsapi"> <target name="deploy-axis" depends="-init-awsapi">
<unwar overwrite="true" src="${base.dir}/deps/awsapi-lib/axis2-webapp-1.5.1.war" dest="${server.deploy.to.dir}/webapps7080/awsapi" /> <unwar overwrite="true" src="${base.dir}/deps/awsapi-lib/axis2-webapp-1.5.1.war" dest="${server.deploy.to.dir}/webapps7080/awsapi" >
<patternset>
<exclude name="WEB-INF/lib/log4j-1.2.15.jar"/>
</patternset>
</unwar>
</target> </target>
<condition property="access_key.private.notpresent"> <condition property="access_key.private.notpresent">
<not> <not>
@ -252,12 +256,12 @@
<include name="web.xml" /> <include name="web.xml" />
</fileset> </fileset>
</copy> </copy>
<!-- rampart lib goes where the axis lib files go --> <!-- rampart lib goes where the axis lib files go
<copy todir="${server.deploy.to.dir}/webapps7080/awsapi/WEB-INF/lib"> <copy todir="${server.deploy.to.dir}/webapps7080/awsapi/WEB-INF/lib">
<fileset dir="${base.dir}/deps/awsapi-lib/rampart-lib"> <fileset dir="${base.dir}/deps/awsapi-lib/rampart-lib">
<include name="*.jar" /> <include name="*.jar" />
</fileset> </fileset>
</copy> </copy> -->
<!-- copying over rampart mar files for WS-Security --> <!-- copying over rampart mar files for WS-Security -->
<copy todir="${server.deploy.to.dir}/webapps7080/awsapi/WEB-INF/modules"> <copy todir="${server.deploy.to.dir}/webapps7080/awsapi/WEB-INF/modules">
<fileset dir="${base.dir}/deps/awsapi-lib/modules"> <fileset dir="${base.dir}/deps/awsapi-lib/modules">
@ -365,9 +369,9 @@
</fileset> </fileset>
</copy> </copy>
<copy todir="${rpm.tomcat.dir}/webapps7080/awsapi/WEB-INF/lib"> <copy todir="${rpm.tomcat.dir}/webapps7080/awsapi/WEB-INF/lib">
<fileset dir="${base.dir}/deps/awsapi-lib/rampart-lib"> <!-- <fileset dir="${base.dir}/deps/awsapi-lib/rampart-lib">
<include name="*.jar" /> <include name="*.jar" />
</fileset> </fileset> -->
<fileset dir="${jar.dir}"> <fileset dir="${jar.dir}">
<include name="cloud-awsapi.jar" /> <include name="cloud-awsapi.jar" />
<include name="cloud-jasypt-1.8.jar" /> <include name="cloud-jasypt-1.8.jar" />

View File

@ -119,7 +119,6 @@
<property name="tools.dir" location="${base.dir}/tools" /> <property name="tools.dir" location="${base.dir}/tools" />
<!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />--> <!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />-->
<property name="deploy.dir" location="${build.dir}/deploy" /> <property name="deploy.dir" location="${build.dir}/deploy" />
<property name="production.dir" location="${deploy.dir}/production" />
<property name="meld.home" location="/usr/local/bin" /> <property name="meld.home" location="/usr/local/bin" />
<property name="assertion" value="-da" /> <property name="assertion" value="-da" />

View File

@ -61,7 +61,6 @@
<import file="${build.dir}/build-common.xml" /> <import file="${build.dir}/build-common.xml" />
<!-- In case these didn't get defined in the build-cloud.properties --> <!-- In case these didn't get defined in the build-cloud.properties -->
<property name="branding.name" value="default" />
<property name="tomcat.home" value="${env.CATALINA_HOME}" /> <property name="tomcat.home" value="${env.CATALINA_HOME}" />
<property name="deprecation" value="off" /> <property name="deprecation" value="off" />
<property name="target.compat.version" value="1.6" /> <property name="target.compat.version" value="1.6" />
@ -113,17 +112,12 @@
<property name="tools.dir" location="${base.dir}/tools" /> <property name="tools.dir" location="${base.dir}/tools" />
<!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />--> <!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />-->
<property name="deploy.dir" location="${build.dir}/deploy" />
<property name="production.dir" location="${deploy.dir}/production" />
<property name="meld.home" location="/usr/local/bin" /> <property name="meld.home" location="/usr/local/bin" />
<property name="assertion" value="-da" /> <property name="assertion" value="-da" />
<!-- directory for vmware-base library --> <!-- directory for vmware-base library -->
<property name="vmware-base.dir" location="${base.dir}/vmware-base" /> <property name="vmware-base.dir" location="${base.dir}/vmware-base" />
<!-- directories for branding -->
<property name="branding.dir" location="${build.dir}/deploy/branding/${branding.name}" />
<property name="core.jar" value="cloud-core.jar" /> <property name="core.jar" value="cloud-core.jar" />
<property name="utils.jar" value="cloud-utils.jar" /> <property name="utils.jar" value="cloud-utils.jar" />
<property name="server.jar" value="cloud-server.jar" /> <property name="server.jar" value="cloud-server.jar" />
@ -374,7 +368,7 @@
</fileset> </fileset>
</copy> </copy>
<copy todir="${copyto.dir}/conf"> <copy todir="${copyto.dir}/conf">
<fileset dir="${production.dir}/consoleproxy/conf"> <fileset dir="${console-proxy.dir}/conf">
<include name="log4j-cloud.xml" /> <include name="log4j-cloud.xml" />
<include name="consoleproxy.properties" /> <include name="consoleproxy.properties" />
</fileset> </fileset>
@ -487,17 +481,9 @@
<target name="build-servers" depends="-init, build-server" /> <target name="build-servers" depends="-init, build-server" />
<target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-console-proxy, package-oss-systemvm-iso"> <target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-console-proxy, package-oss-systemvm-iso">
<copy overwrite="true" todir="${dist.dir}">
<fileset dir="${base.dir}/build/deploy/">
<include name="deploy-agent.sh" />
<include name="deploy-server.sh" />
<include name="deploy-console-proxy.sh" />
<include name="install.sh" />
</fileset>
<fileset dir="${base.dir}/client"> <fileset dir="${base.dir}/client">
<include name="setup/**/*" /> <include name="setup/**/*" />
</fileset> </fileset>
</copy>
<copy overwrite="true" todir="${jar.dir}"> <copy overwrite="true" todir="${jar.dir}">
<fileset dir="${deps.dir}"> <fileset dir="${deps.dir}">
@ -505,8 +491,6 @@
</fileset> </fileset>
</copy> </copy>
<chmod file="${dist.dir}/deploy-agent.sh" perm="uog+xr" />
<chmod file="${dist.dir}/deploy-server.sh" perm="uog+xr" />
</target> </target>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -1,126 +0,0 @@
#!/usr/bin/env bash
#
# deploy-db.sh -- deploys the database configuration.
#
# 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.
# set -x
if [ "$1" == "" ]; then
printf "Usage: %s [path to additional sql] [root password]\n" $(basename $0) >&2
exit 1;
fi
if [ ! -f $1 ]; then
echo "Error: Unable to find $1"
exit 2
fi
if [ "$2" != "" ]; then
if [ ! -f $2 ]; then
echo "Error: Unable to find $2"
exit 3
fi
fi
if [ ! -f create-database.sql ]; then
printf "Error: Unable to find create-database.sql\n"
exit 4
fi
if [ ! -f create-schema.sql ]; then
printf "Error: Unable to find create-schema.sql\n"
exit 5
fi
if [ ! -f create-index-fk.sql ]; then
printf "Error: Unable to find create-index-fk.sql\n"
exit 6;
fi
PATHSEP=':'
if [[ $OSTYPE == "cygwin" ]] ; then
export CATALINA_HOME=`cygpath -m $CATALINA_HOME`
PATHSEP=';'
else
mysql="mysql"
service mysql status > /dev/null 2>/dev/null
if [ $? -eq 1 ]; then
mysql="mysqld"
service mysqld status > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
printf "Unable to find mysql daemon\n"
exit 7
fi
fi
echo "Starting mysql"
service $mysql start > /dev/null 2>/dev/null
fi
echo "Recreating Database."
mysql --user=root --password=$3 < create-database.sql > /dev/null 2>/dev/null
mysqlout=$?
if [ $mysqlout -eq 1 ]; then
printf "Please enter root password for MySQL.\n"
mysql --user=root --password < create-database.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-database.sql\n"
exit 10
fi
elif [ $mysqlout -ne 0 ]; then
printf "Error: Cannot execute create-database.sql\n"
exit 11
fi
mysql --user=cloud --password=cloud cloud < create-schema.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-schema.sql\n"
exit 11
fi
mysql --user=cloud --password=cloud cloud < create-schema-premium.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-schema-premium.sql\n"
exit 11
fi
if [ "$1" != "" ]; then
mysql --user=cloud --password=cloud cloud < $1
if [ $? -ne 0 ]; then
printf "Error: Cannot execute $1\n"
exit 12
fi
fi
if [ "$2" != "" ]; then
echo "Adding Templates"
mysql --user=cloud --password=cloud cloud < $2
if [ $? -ne 0 ]; then
printf "Error: Cannot execute $2\n"
exit 12
fi
fi
echo "Creating Indice and Foreign Keys"
mysql --user=cloud --password=cloud cloud < create-index-fk.sql
if [ $? -ne 0 ]; then
printf "Error: Cannot execute create-index-fk.sql\n"
exit 13
fi

View File

@ -1,24 +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.
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.appender.stdout.threshold=ERROR
log4j.rootLogger=INFO, stdout
log4j.category.org.apache=INFO, stdout

View File

@ -1,232 +0,0 @@
#!/usr/bin/env bash
#
# install.sh -- installs an agent
#
# 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.
usage() {
printf "Usage: %s: -d [directory to deploy to] -t [routing|storage|computing] -z [zip file] -h [host] -p [pod] -c [data center] -m [expert|novice|setup]\n" $(basename $0) >&2
}
mode=
host=
pod=
zone=
deploydir=
confdir=
zipfile=
typ=
#set -x
while getopts 'd:z:t:x:m:h:p:c:' OPTION
do
case "$OPTION" in
d) deploydir="$OPTARG"
;;
z) zipfile="$OPTARG"
;;
t) typ="$OPTARG"
;;
m) mode="$OPTARG"
;;
h) host="$OPTARG"
;;
p) pod="$OPTARG"
;;
c) zone="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
printf "NOTE: You must have root privileges to install and run this program.\n"
if [ "$typ" == "" ]; then
if [ "$mode" != "expert" ]
then
printf "Type of agent to install [routing|computing|storage]: "
read typ
fi
fi
if [ "$typ" != "computing" ] && [ "$typ" != "routing" ] && [ "$typ" != "storage" ]
then
printf "ERROR: The choices are computing, routing, or storage.\n"
exit 4
fi
if [ "$host" == "" ]; then
if [ "$mode" != "expert" ]
then
printf "Host name or ip address of management server [Required]: "
read host
if [ "$host" == "" ]; then
printf "ERROR: Host is required\n"
exit 23;
fi
fi
fi
port=
if [ "$mode" != "expert" ]
then
printf "Port number of management server [defaults to 8250]: "
read port
fi
if [ "$port" == "" ]
then
port=8250
fi
if [ "$zone" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Availability Zone [Required]: "
read zone
if [ "$zone" == "" ]; then
printf "ERROR: Zone is required\n";
exit 21;
fi
fi
fi
if [ "$pod" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Pod [Required]: "
read pod
if [ "$pod" == "" ]; then
printf "ERROR: Pod is required\n";
exit 22;
fi
fi
fi
workers=
if [ "$mode" != "expert" ]; then
printf "# of workers to start [defaults to 3]: "
read workers
fi
if [ "$workers" == "" ]; then
workers=3
fi
if [ "$deploydir" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Directory to deploy to [defaults to /usr/local/vmops/agent]: "
read deploydir
fi
if [ "$deploydir" == "" ]; then
deploydir="/usr/local/vmops/agent"
fi
fi
if ! mkdir -p $deploydir
then
printf "ERROR: Unable to create $deploydir\n"
exit 5
fi
if [ "$zipfile" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Path of the zip file [defaults to agent.zip]: "
read zipfile
fi
if [ "$zipfile" == "" ]; then
zipfile="agent.zip"
fi
fi
if ! unzip -o $zipfile -d $deploydir
then
printf "ERROR: Unable to unzip $zipfile to $deploydir\n"
exit 6
fi
#if ! chmod -R +x $deploydir/scripts/*.sh
#then
# printf "ERROR: Unable to change scripts to executable.\n"
# exit 7
#fi
#if ! chmod -R +x $deploydir/scripts/iscsi/*.sh
#then
# printf "ERROR: Unable to change scripts to executable.\n"
# exit 8
#fi
#if ! chmod -R +x $deploydir/*.sh
#then
# printf "ERROR: Unable to change scripts to executable.\n"
# exit 9
#fi
if [ "$mode" == "setup" ]; then
mode="expert"
deploydir="/usr/local/vmops/agent"
confdir="/etc/vmops"
/bin/cp -f $deploydir/conf/agent.properties $confdir/agent.properties
if [ $? -gt 0 ]; then
printf "ERROR: Failed to copy the agent.properties file into the right place."
exit 10;
fi
else
confdir="$deploydir/conf"
fi
if [ "$typ" != "" ]; then
sed s/@TYPE@/"$typ"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Type is not set\n"
fi
if [ "$host" != "" ]; then
sed s/@HOST@/"$host"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: host is not set\n"
fi
if [ "$port" != "" ]; then
sed s/@PORT@/"$port"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Port is not set\n"
fi
if [ "$pod" != "" ]; then
sed s/@POD@/"$pod"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Pod is not set\n"
fi
if [ "$zone" != "" ]; then
sed s/@ZONE@/"$zone"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Zone is not set\n"
fi
if [ "$workers" != "" ]; then
sed s/@WORKERS@/"$workers"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Workers is not set\n"
fi
printf "SUCCESS: Installation is now complete. If you like to make changes, edit $confdir/agent.properties\n"
exit 0

View File

@ -1,90 +0,0 @@
#!/usr/bin/env bash
#
# Deploy console proxy package to an existing VM template
#
# 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.
usage() {
printf "Usage: %s: -d [work directory to deploy to] -z [zip file]" $(basename $0) >&2
}
deploydir=
zipfile=
#set -x
while getopts 'd:z:' OPTION
do
case "$OPTION" in
d) deploydir="$OPTARG"
;;
z) zipfile="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
printf "NOTE: You must have root privileges to install and run this program.\n"
if [ "$deploydir" == "" ]; then
printf "ERROR: Unable to find deployment work directory $deploydir\n"
exit 3;
fi
if [ ! -f $deploydir/consoleproxy.tar.gz ]
then
printf "ERROR: Unable to find existing console proxy template file (consoleproxy.tar.gz) to work on at $deploydir\n"
exit 5
fi
if [ "$zipfile" == "" ]; then
zipfile="console-proxy.zip"
fi
if ! mkdir -p /mnt/consoleproxy
then
printf "ERROR: Unable to create /mnt/consoleproxy for mounting template image\n"
exit 5
fi
tar xvfz $deploydir/consoleproxy.tar.gz -C $deploydir
mount -o loop $deploydir/vmi-root-fc8-x86_64-domP /mnt/consoleproxy
if ! unzip -o $zipfile -d /mnt/consoleproxy/usr/local/vmops/consoleproxy
then
printf "ERROR: Unable to unzip $zipfile to $deploydir\n"
exit 6
fi
umount /mnt/consoleproxy
pushd $deploydir
tar cvf consoleproxy.tar vmi-root-fc8-x86_64-domP
mv -f consoleproxy.tar.gz consoleproxy.tar.gz.old
gzip consoleproxy.tar
popd
if [ ! -f $deploydir/consoleproxy.tar.gz ]
then
mv consoleproxy.tar.gz.old consoleproxy.tar.gz
printf "ERROR: failed to deploy and recreate the template at $deploydir\n"
fi
printf "SUCCESS: Installation is now complete. please go to $deploydir to review it\n"
exit 0

View File

@ -1,121 +0,0 @@
#!/usr/bin/env bash
#
# deploy.sh -- deploys a management server
#
# 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.
usage() {
printf "Usage: %s: -d [tomcat directory to deploy to] -z [zip file to use]\n" $(basename $0) >&2
}
dflag=
zflag=
tflag=
iflag=
deploydir=
zipfile="client.zip"
typ=
#set -x
while getopts 'd:z:x:h:' OPTION
do
case "$OPTION" in
d) dflag=1
deploydir="$OPTARG"
;;
z) zflag=1
zipfile="$OPTARG"
;;
h) iflag="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
if [ "$deploydir" == "" ]
then
if [ "$CATALINA_HOME" == "" ]
then
printf "Tomcat Directory to deploy to: "
read deploydir
else
deploydir="$CATALINA_HOME"
fi
fi
if [ "$deploydir" == "" ]
then
printf "Tomcat directory was not specified\n";
exit 15;
fi
printf "Check to see if the Tomcat directory exist: $deploydir\n"
if [ ! -d $deploydir ]
then
printf "Tomcat directory does not exist\n";
exit 16;
fi
if [ "$zipfile" == "" ]
then
printf "Path of the zip file [defaults to client.zip]: "
read zipfile
if [ "$zipfile" == "" ]
then
zipfile="client.zip"
fi
fi
if ! unzip -o $zipfile client.war
then
exit 6
fi
rm -fr $deploydir/webapps/client
if ! unzip -o ./client.war -d $deploydir/webapps/client
then
exit 10;
fi
rm -f ./client.war
if ! unzip -o $zipfile lib/* -d $deploydir
then
exit 11;
fi
if ! unzip -o $zipfile conf/* -d $deploydir
then
exit 12;
fi
if ! unzip -o $zipfile bin/* -d $deploydir
then
exit 13;
fi
printf "Adding the conf directory to the class loader for tomcat\n"
sed 's/shared.loader=$/shared.loader=\$\{catalina.home\},\$\{catalina.home\}\/conf\
/' $deploydir/conf/catalina.properties > $deploydir/conf/catalina.properties.tmp
mv $deploydir/conf/catalina.properties.tmp $deploydir/conf/catalina.properties
printf "Installation is now complete\n"
exit 0

View File

@ -1,200 +0,0 @@
#!/usr/bin/env bash
#
# install.sh -- installs an agent
#
# 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.
usage() {
printf "Usage: %s: -d [directory to deploy to] -z [zip file] -h [host] -p [pod] -c [data center] -m [expert|novice|setup]\n" $(basename $0) >&2
}
mode=
host=
pod=
zone=
deploydir=
confdir=
zipfile=
typ=
#set -x
while getopts 'd:z:x:m:h:p:c:' OPTION
do
case "$OPTION" in
d) deploydir="$OPTARG"
;;
z) zipfile="$OPTARG"
;;
m) mode="$OPTARG"
;;
h) host="$OPTARG"
;;
p) pod="$OPTARG"
;;
c) zone="$OPTARG"
;;
?) usage
exit 2
;;
esac
done
printf "NOTE: You must have root privileges to install and run this program.\n"
if [ "$mode" == "setup" ]; then
mode="expert"
deploydir="/usr/local/cloud/agent-simulator"
confdir="/etc/cloud"
/bin/cp -f $deploydir/conf/agent.properties $confdir/agent.properties
if [ $? -gt 0 ]; then
printf "ERROR: Failed to copy the agent.properties file into the right place."
exit 10;
fi
else
confdir="$deploydir/conf"
fi
if [ "$host" == "" ]; then
if [ "$mode" != "expert" ]
then
printf "Host name or ip address of management server [Required]: "
read host
if [ "$host" == "" ]; then
printf "ERROR: Host is required\n"
exit 23;
fi
fi
fi
port=
if [ "$mode" != "expert" ]
then
printf "Port number of management server [defaults to 8250]: "
read port
fi
if [ "$port" == "" ]
then
port=8250
fi
if [ "$zone" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Availability Zone [Required]: "
read zone
if [ "$zone" == "" ]; then
printf "ERROR: Zone is required\n";
exit 21;
fi
fi
fi
if [ "$pod" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Pod [Required]: "
read pod
if ["$pod" == ""]; then
printf "ERROR: Pod is required\n";
exit 22;
fi
fi
fi
workers=
if [ "$mode" != "expert" ]; then
printf "# of workers to start [defaults to 3]: "
read workers
fi
if [ "$workers" == "" ]; then
workers=3
fi
if [ "$deploydir" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Directory to deploy to [defaults to /usr/local/cloud/agent-simulator]: "
read deploydir
fi
if [ "$deploydir" == "" ]; then
deploydir="/usr/local/cloud/agent-simulator"
fi
fi
if ! mkdir -p $deploydir
then
printf "ERROR: Unable to create $deploydir\n"
exit 5
fi
if [ "$zipfile" == "" ]; then
if [ "$mode" != "expert" ]; then
printf "Path of the zip file [defaults to agent-simulator.zip]: "
read zipfile
fi
if [ "$zipfile" == "" ]; then
zipfile="agent-simulator.zip"
fi
fi
if ! unzip -o $zipfile -d $deploydir
then
printf "ERROR: Unable to unzip $zipfile to $deploydir\n"
exit 6
fi
if ! chmod +x $deploydir/*.sh
then
printf "ERROR: Unable to change scripts to executable.\n"
exit 9
fi
if [ "$host" != "" ]; then
sed s/@HOST@/"$host"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: host is not set\n"
fi
if [ "$port" != "" ]; then
sed s/@PORT@/"$port"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Port is not set\n"
fi
if [ "$pod" != "" ]; then
sed s/@POD@/"$pod"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Pod is not set\n"
fi
if [ "$zone" != "" ]; then
sed s/@ZONE@/"$zone"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Zone is not set\n"
fi
if [ "$workers" != "" ]; then
sed s/@WORKERS@/"$workers"/ $confdir/agent.properties > $confdir/tmp
/bin/mv -f $confdir/tmp $confdir/agent.properties
else
printf "INFO: Workers is not set\n"
fi
printf "SUCCESS: Installation is now complete. If you like to make changes, edit $confdir/agent.properties\n"
exit 0

View File

@ -1,149 +0,0 @@
#!/usr/bin/env bash
#
# install-storage-server.sh: Installs a VMOps Storage Server
#
# 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.
choose_correct_filename() {
local default_filename=$1
local user_specified_filename=$2
if [ -f "$user_specified_filename" ]
then
echo $user_specified_filename
return 0
else
if [ -f "$default_filename" ]
then
echo $default_filename
return 0
else
echo ""
return 1
fi
fi
}
install_opensolaris_package() {
pkg_name=$1
pkg info $pkg_name >> /dev/null
if [ $? -gt 0 ]
then
# The package is not installed, so install it
pkg install $pkg_name
return $?
else
# The package is already installed
return 0
fi
}
exit_if_error() {
return_code=$1
msg=$2
if [ $return_code -gt 0 ]
then
echo $msg
exit 1
fi
}
usage() {
printf "Usage: ./install-storage-server.sh <path to agent.zip> <path to templates.tar.gz>"
}
AGENT_FILE=$(choose_correct_filename "./agent.zip" $1)
exit_if_error $? "Please download agent.zip to your Storage Server."
TEMPLATES_FILE=$(choose_correct_filename "./templates.tar.gz" $2)
exit_if_error $? "Please download templates.tar.gz to your Storage Server."
VMOPS_DIR="/usr/local/vmops"
AGENT_DIR="/usr/local/vmops/agent"
CONF_DIR="/etc/vmops"
TEMPLATES_DIR="/root/template"
# Make all the necessary directories if they don't already exist
echo "Creating VMOps directories..."
for dir in $VMOPS_DIR $CONF_DIR $TEMPLATES_DIR
do
mkdir -p $dir
done
# Unzip agent.zip to $AGENT_DIR
echo "Uncompressing and installing VMOps Storage Agent..."
unzip -o $AGENT_FILE -d $AGENT_DIR >> /dev/null
# Remove agent/conf/agent.properties, since we should use the file in the real configuration directory
rm $AGENT_DIR/conf/agent.properties
# Backup any existing VMOps configuration files, if there aren't any backups already
if [ ! -d $CONF_DIR/BACKUP ]
then
echo "Backing up existing configuration files..."
mkdir -p $CONF_DIR/BACKUP
cp $CONF_DIR/*.properties $CONF_DIR/BACKUP >> /dev/null
fi
# Copy all the files in storagehdpatch to their proper places
echo "Installing system files..."
(cd $AGENT_DIR/storagehdpatch; tar cf - .) | (cd /; tar xf -)
exit_if_error $? "There was a problem with installing system files. Please contact VMOps Support."
# Make vsetup executable
chmod +x /usr/sbin/vsetup
# Make vmops executable
chmod +x /lib/svc/method/vmops
# Uncompress the templates and copy them to the templates directory
echo "Uncompressing templates..."
tar -xzf $TEMPLATES_FILE -C $TEMPLATES_DIR >> /dev/null
exit_if_error $? "There was a problem with uncompressing templates. Please contact VMOps Support."
# Install the storage-server package, if it is not already installed
echo "Installing OpenSolaris storage server package..."
install_opensolaris_package "storage-server"
exit_if_error $? "There was a problem with installing the storage server package. Please contact VMOps Support."
echo "Installing COMSTAR..."
install_opensolaris_package "SUNWiscsit"
exit_if_error $? "Unable to install COMSTAR iscsi target. Please contact VMOps Support."
# Install the SUNWinstall-test package, if it is not already installed
echo "Installing OpenSolaris test tools package..."
install_opensolaris_package "SUNWinstall-test"
exit_if_error $? "There was a problem with installing the test tools package. Please contact VMOps Support."
# Print a success message
printf "\nSuccessfully installed the VMOps Storage Server.\n"
printf "Please complete the following steps to configure your networking settings and storage pools:\n\n"
printf "1. Specify networking settings in /etc/vmops/network.properties\n"
printf "2. Run \"vsetup networking\" and then specify disk settings in /etc/vmops/disks.properties\n"
printf "3. Run \"vsetup zpool\" and reboot the machine when prompted.\n\n"

View File

@ -1,155 +0,0 @@
#!/bin/bash
#
# install.sh -- installs MySQL, Java, Tomcat, and the VMOps server
#
# 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.
#set -x
set -e
EX_NOHOSTNAME=15
EX_SELINUX=16
function usage() {
printf "Usage: %s [path to server-setup.xml]\n" $(basename $0) >&2
exit 64
}
function checkhostname() {
if hostname | grep -qF . ; then true ; else
echo "You need to have a fully-qualified host name for the setup to work." > /dev/stderr
echo "Please use your operating system's network setup tools to set one." > /dev/stderr
exit $EX_NOHOSTNAME
fi
}
function checkselinux() {
#### before checking arguments, make sure SELINUX is "permissible" in /etc/selinux/config
if /usr/sbin/getenforce | grep -qi enforcing ; then borked=1 ; fi
if grep -i SELINUX=enforcing /etc/selinux/config ; then borked=1 ; fi
if [ "$borked" == "1" ] ; then
echo "SELINUX is set to enforcing, please set it to permissive in /etc/selinux/config" > /dev/stderr
echo "then reboot the machine, after which you can run the install script again." > /dev/stderr
exit $EX_SELINUX
fi
}
checkhostname
checkselinux
if [ "$1" == "" ]; then
usage
fi
if [ ! -f $1 ]; then
echo "Error: Unable to find $1" > /dev/stderr
exit 2
fi
#### check that all files exist
if [ ! -f apache-tomcat-6.0.18.tar.gz ]; then
printf "Error: Unable to find apache-tomcat-6.0.18.tar.gz\n" > /dev/stderr
exit 3
fi
if [ ! -f MySQL-client-5.1.30-0.glibc23.x86_64.rpm ]; then
printf "Error: Unable to find MySQL-client-5.1.30-0.glibc23.x86_64.rpm\n" > /dev/stderr
exit 4
fi
if [ ! -f MySQL-server-5.1.30-0.glibc23.x86_64.rpm ]; then
printf "Error: Unable to find MySQL-server-5.1.30-0.glibc23.x86_64.rpm\n" > /dev/stderr
exit 5
fi
if [ ! -f jdk-6u13-linux-amd64.rpm.bin ]; then
printf "Error: Unable to find jdk-6u13-linux-amd64.rpm.bin\n" > /dev/stderr
exit 6
fi
#if [ ! -f osol.tar.bz2 ]; then
# printf "Error: Unable to find osol.tar.bz2\n"
# exit 7
#fi
if [ ! -f apache-tomcat-6.0.18.tar.gz ]; then
printf "Error: Unable to find apache-tomcat-6.0.18.tar.gz\n" > /dev/stderr
exit 8
fi
if [ ! -f vmops-*.zip ]; then
printf "Error: Unable to find vmops install file\n" > /dev/stderr
exit 9
fi
if [ ! -f catalina ] ; then
printf "Error: Unable to find catalina initscript\n" > /dev/stderr
exit 10
fi
if [ ! -f usageserver ] ; then
printf "Error: Unable to find usageserver initscript\n" > /dev/stderr
exit 11
fi
###### install Apache
# if [ ! -d /usr/local/tomcat ] ; then
echo "installing Apache..."
mkdir -p /usr/local/tomcat
tar xfz apache-tomcat-6.0.18.tar.gz -C /usr/local/tomcat
ln -s /usr/local/tomcat/apache-tomcat-6.0.18 /usr/local/tomcat/current
# fi
# if [ ! -f /etc/profile.d/catalinahome.sh ] ; then
# echo "export CATALINA_HOME=/usr/local/tomcat/current" >> /etc/profile.d/catalinahome.sh
# fi
source /etc/profile.d/catalinahome.sh
# if [ ! -f /etc/init.d/catalina ] ; then
cp -f catalina /etc/init.d
/sbin/chkconfig catalina on
# fi
####### set up usage server as a service
if [ ! -f /etc/init.d/usageserver ] ; then
cp -f usageserver /etc/init.d
/sbin/chkconfig usageserver on
fi
##### set up mysql
if rpm -q MySQL-server MySQL-client > /dev/null 2>&1 ; then true ; else
echo "installing MySQL..."
yum localinstall --nogpgcheck -y MySQL-*.rpm
fi
#### install JDK
echo "installing JDK..."
sh jdk-6u13-linux-amd64.rpm.bin
rm -rf /usr/bin/java
ln -s /usr/java/default/bin/java /usr/bin/java
#### setting up OSOL image
#mkdir -p $CATALINA_HOME/webapps/images
#echo "copying Open Solaris image, this may take a few moments..."
#cp osol.tar.bz2 $CATALINA_HOME/webapps/images
#### deploying database
unzip -o vmops-*.zip
cd vmops-*
sh deploy-server.sh -d "$CATALINA_HOME"
cd db
sh deploy-db.sh "../../$1" templates.sql
exit 0

View File

@ -1,23 +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.
consoleproxy.tcpListenPort=0
consoleproxy.httpListenPort=80
consoleproxy.httpCmdListenPort=8001
consoleproxy.jarDir=./applet/
consoleproxy.viewerLinger=180
consoleproxy.reconnectMaxRetry=5

View File

@ -1,550 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
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.
-->
<data>
<version>2.0</version>
<zones>
<zone>
<id>1</id>
<name>AH</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>100-199</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>2</id>
<name>KM</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>200-299</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>3</id>
<name>KY</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>300-399</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>4</id>
<name>WC</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>400-499</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>5</id>
<name>CV</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>500-599</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>6</id>
<name>KS</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>600-699</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>7</id>
<name>ES</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>700-799</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>8</id>
<name>RC</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>800-899</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>9</id>
<name>AX</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>900-999</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>10</id>
<name>JW</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>900-999</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
<zone>
<id>11</id>
<name>AJ</name>
<dns1>72.52.126.11</dns1>
<dns2>72.52.126.12</dns2>
<internalDns1>192.168.10.253</internalDns1>
<internalDns2>192.168.10.254</internalDns2>
<vnet>1000-1099</vnet>
<guestNetworkCidr>10.1.1.0/24</guestNetworkCidr>
</zone>
</zones>
<!--
<storagePools>
<storagePool>
<zoneId>5</zoneId>
<name>sol10-2</name>
<hostAddress>sol10-2</hostAddress>
<hostPath>/tank/cloud-nfs/</hostPath>
</storagePool>
</storagePools>
-->
<vlans>
<vlan>
<zoneId>1</zoneId>
<vlanId>31</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.31.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.31.150-192.168.31.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>2</zoneId>
<vlanId>32</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.32.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.32.150-192.168.32.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>3</zoneId>
<vlanId>33</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.33.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.33.150-192.168.33.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>4</zoneId>
<vlanId>34</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.34.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.34.150-192.168.34.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>5</zoneId>
<vlanId>35</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.35.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.35.150-192.168.35.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>6</zoneId>
<vlanId>36</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.36.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.36.150-192.168.36.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>7</zoneId>
<vlanId>37</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.37.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.37.150-192.168.37.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>8</zoneId>
<vlanId>38</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.38.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.38.150-192.168.38.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>9</zoneId>
<vlanId>39</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.39.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.39.150-192.168.39.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>10</zoneId>
<vlanId>40</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.40.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.40.150-192.168.40.159</ipAddressRange>
</vlan>
<vlan>
<zoneId>11</zoneId>
<vlanId>41</vlanId>
<vlanType>VirtualNetwork</vlanType>
<gateway>192.168.41.1</gateway>
<netmask>255.255.255.0</netmask>
<ipAddressRange>192.168.41.150-192.168.41.159</ipAddressRange>
</vlan>
</vlans>
<pods>
<pod>
<id>1</id>
<name>AH</name>
<zoneId>1</zoneId>
<ipAddressRange>192.168.10.20-192.168.10.24</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>2</id>
<name>KM</name>
<zoneId>2</zoneId>
<ipAddressRange>192.168.10.25-192.168.10.29</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>3</id>
<name>KY</name>
<zoneId>3</zoneId>
<ipAddressRange>192.168.10.30-192.168.10.34</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>4</id>
<name>WC</name>
<zoneId>4</zoneId>
<ipAddressRange>192.168.10.35-192.168.10.39</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>5</id>
<name>CV</name>
<zoneId>5</zoneId>
<ipAddressRange>192.168.10.40-192.168.10.44</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>6</id>
<name>KS</name>
<zoneId>6</zoneId>
<ipAddressRange>192.168.10.45-192.168.10.49</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>7</id>
<name>ES</name>
<zoneId>7</zoneId>
<ipAddressRange>192.168.10.50-192.168.10.54</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>8</id>
<name>RC</name>
<zoneId>8</zoneId>
<ipAddressRange>192.168.10.55-192.168.10.59</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>9</id>
<name>AX</name>
<zoneId>9</zoneId>
<ipAddressRange>192.168.10.62-192.168.10.64</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>10</id>
<name>JW</name>
<zoneId>10</zoneId>
<ipAddressRange>192.168.10.65-192.168.10.69</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
<pod>
<id>11</id>
<name>AJ</name>
<zoneId>11</zoneId>
<ipAddressRange>192.168.10.70-192.168.10.74</ipAddressRange>
<cidr>192.168.10.0/24</cidr>
</pod>
</pods>
<!--
* cpu is the number of CPUs for the offering
* ramSize is total memory in MB
* speed is the CPU speed for each core in MHZ
* diskSpace is the storage space in MB
* price is the price of the offering per hour
-->
<serviceOfferings>
<serviceOffering>
<id>1</id>
<name>Small Instance</name>
<displayText>Small Instance [500MHZ CPU, 512MB MEM, 16GB Disk] - $0.10 per hour</displayText>
<cpu>1</cpu>
<ramSize>512</ramSize>
<speed>500</speed>
<mirrored>false</mirrored>
</serviceOffering>
<serviceOffering>
<id>2</id>
<name>Medium Instance</name>
<displayText>Medium Instance [500MHZ CPU, 1GB MEM, 32GB Disk] - $0.20 per hour</displayText>
<cpu>1</cpu>
<ramSize>1024</ramSize>
<speed>512</speed>
</serviceOffering>
<serviceOffering>
<id>3</id>
<name>Large Instance</name>
<displayText>Large Instance [2GHZ CPU, 4GB MEM, 64GB Disk] - $0.30 per hour</displayText>
<cpu>2</cpu>
<ramSize>4096</ramSize>
<speed>2000</speed>
</serviceOffering>
</serviceOfferings>
<diskOfferings>
<diskOffering>
<id>1</id>
<domainId>1</domainId>
<name>Small Disk</name>
<displayText>Small Disk [16GB Disk]</displayText>
<diskSpace>16000</diskSpace>
</diskOffering>
<diskOffering>
<id>2</id>
<domainId>1</domainId>
<name>Medium Disk</name>
<displayText>Medium Disk [32GB Disk]</displayText>
<diskSpace>32000</diskSpace>
</diskOffering>
<diskOffering>
<id>3</id>
<domainId>1</domainId>
<name>Large Disk</name>
<displayText>Large Disk [64GB Disk]</displayText>
<diskSpace>64000</diskSpace>
</diskOffering>
</diskOfferings>
<!--
* firstname/lastname are optional parameters
* id, username, password are required parameters
-->
<users>
<user>
<id>2</id>
<username>admin</username>
<password>password</password>
<firstname>Admin</firstname>
<lastname>User</lastname>
<email>admin@mailprovider.com</email>
</user>
</users>
<configurationEntries>
<configuration>
<name>default.zone</name>
<value>AH</value>
</configuration>
<configuration>
<name>domain.suffix</name>
<value>cloud-test.cloud.com</value>
</configuration>
<configuration>
<name>instance.name</name>
<value>AH</value>
</configuration>
<configuration>
<name>consoleproxy.ram.size</name>
<value>256</value>
</configuration>
<configuration>
<name>host.stats.interval</name>
<value>3600000</value>
</configuration>
<configuration>
<name>storage.stats.interval</name>
<value>120000</value>
</configuration>
<configuration>
<name>volume.stats.interval</name>
<value>-1</value>
</configuration>
<configuration>
<name>ping.interval</name>
<value>60</value>
</configuration>
<configuration>
<name>alert.wait</name>
<value>1800</value>
</configuration>
<configuration>
<name>expunge.interval</name>
<value>86400</value>
</configuration>
<configuration>
<name>usage.aggregation.timezone</name>
<value>GMT</value>
</configuration>
<!-- RSA Keys -->
<configuration>
<name>ssh.privatekey</name>
<value>-----BEGIN RSA PRIVATE KEY-----\nMIIEoQIBAAKCAQEAnNUMVgQS87EzAQN9ufGgH3T1kOpqcvTmUrp8RVZyeA5qwptS\nrZxONRbhLK709pZFBJLmeFqiqciWoA/srVIFk+rPmBlVsMw8BK53hTGoax7iSe8s\nLFCAATm6vp0HnZzYqNfrzR2by36ET5aQD/VAyA55u+uUgAlxQuhKff2xjyahEHs+\nUiRlReiAgItygm9g3co3+8fJDOuRse+s0TOip1D0jPdo2AJFscyxrG9hWqQH86R/\nZlLJ7DqsiaAcUmn52u6Nsmd3BkRmGVx/D35Mq6upJqrk/QDfug9LF66yiIP/BEIn\n08N/wQ6m/O37WUtqqyl3rRKqs5TJ9ZnhsqeO9QIBIwKCAQA6QIDsv69EkkYk8qsK\njPJU06uq2rnS7T+bEhDmjdK+4MiRbOQx2vh6HnDktgM3BJ1K13oss/NGYHJ190lH\nsMA+QUXKx5TbRItSMixkrAta/Ne1D7FSScklBtBVbYZ8XtQhdMVML5GjWuCv2NZs\nU8eaw4xNHPyklcr7mBurI7b6p13VK5BNUWR/VNuigT4U89YzRcoEZ/sTlR+4ACYr\nxbUJJGBA03+NhdSAe2vodlMh5lGflD0JmHMFqqg9BcAtVb73JsOsxFQArbXwRd/q\nNckdoAvgJfhTOvXF5GMPLI0lGb6skJkS229F4GaBB2Iz4A9O0aHZob8I8zsWUbiu\npvBrAoGBAMjUDfF2x13NjH1cFHietO5O1oM0nZaAxKodxoAUvHVMUd5DIY50tqYw\n7ecKi2Cw43ONpdj0nP9Nc2NV3NDRqLopwkKUsTtq9AKQ2cIuw3+uS5vm0VZBzmTP\nuF04Qo4bXh/jFRA62u9bXsmIFtaehKxE1Gp6zi393GcbWP4HX/3dAoGBAMfq0KD3\ngeU1PHi9uI3Ss89nXzJsiGcwC5Iunu1aTzJCYhMlJkfmRcXYMAqSfg0nGWnfvlDh\nuOO26CHKjG182mTwYXdgQzIPpBc8suvgUWDBTrIzJI+zuyBLtPbd9DJEVrZkRVQX\nXrOV3Y5oOWsba4F+b20jaaHFAiY7s6OtrX/5AoGBAMMXI3zZyPwJgSlSIoPNX03m\nL3gke9QID4CvNduB26UlkVuRq5GzNRZ4rJdMEl3tqcC1fImdKswfWiX7o06ChqY3\nMb0FePfkPX7V2tnkSOJuzRsavLoxTCdqsxi6T0g318c0XZq81K4A/P5Jr8ksRl40\nPA+qfyVdAf3Cy3ptkHLzAoGASkFGLSi7N+CSzcLPhSJgCzUGGgsOF7LCeB/x4yGL\nIUvbSPCKj7vuB6gR2AqGlyvHnFprQpz7h8eYDI0PlmGS8kqn2+HtEpgYYGcAoMEI\nSIJQbhL+84vmaxTOL87IanEnhZL1LdzLZ0ZK+mE55fQ936P9gE77WVfNmSweJtob\n3xMCgYAl0aLeGf4oUZbI56eEaCbu8U7dEe6MF54VbozyiXqbp455QnUpuBrRn5uf\nc079dNcqTNDuk1+hYX9qNn1aXsvWeuofBXqWoFXu/c4yoWxJAPhEVhzZ9xrXI76I\nBKiPCyKrOa7bSLvs6SQPpuf5AQ8+NJrOxkEB9hbMuaAr2N5rCw==\n-----END RSA PRIVATE KEY-----
</value>
<category>Hidden</category>
</configuration>
<configuration>
<name>ssh.publickey</name>
<value>
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAnNUMVgQS87EzAQN9ufGgH3T1kOpqcvTmUrp8RVZyeA5qwptSrZxONRbhLK709pZFBJLmeFqiqciWoA/srVIFk+rPmBlVsMw8BK53hTGoax7iSe8sLFCAATm6vp0HnZzYqNfrzR2by36ET5aQD/VAyA55u+uUgAlxQuhKff2xjyahEHs+UiRlReiAgItygm9g3co3+8fJDOuRse+s0TOip1D0jPdo2AJFscyxrG9hWqQH86R/ZlLJ7DqsiaAcUmn52u6Nsmd3BkRmGVx/D35Mq6upJqrk/QDfug9LF66yiIP/BEIn08N/wQ6m/O37WUtqqyl3rRKqs5TJ9ZnhsqeO9Q== root@test2.lab.vmops.com
</value>
<category>Hidden</category>
</configuration>
<!-- the following are for configuring alerts and need to be changed to proper configuration values -->
<!--
<configuration>
<name>alert.smtp.host</name>
<value>smtp.host.com</value>
</configuration>
<configuration>
<name>alert.smtp.port</name>
<value>25</value>
</configuration>
<configuration>
<name>alert.smtp.useAuth</name>
<value>false</value>
</configuration>
<configuration>
<name>alert.smtp.username</name>
<value>some.user@example.com</value>
</configuration>
<configuration>
<name>alert.smtp.password</name>
<value>password</value>
</configuration>
<configuration>
<name>alert.email.sender</name>
<value>some.user@example.com</value>
</configuration>
<configuration>
<name>alert.email.addresses</name>
<value>some.admin@example.com</value>
</configuration>
<configuration>
<name>alert.smtp.debug</name>
<value>false</value>
</configuration>
-->
<configuration>
<name>memory.capacity.threshold</name>
<value>0.85</value>
</configuration>
<configuration>
<name>cpu.capacity.threshold</name>
<value>0.85</value>
</configuration>
<configuration>
<name>storage.capacity.threshold</name>
<value>0.85</value>
</configuration>
<configuration>
<name>storage.allocated.capacity.threshold</name>
<value>0.85</value>
</configuration>
<configuration>
<name>capacity.check.period</name>
<value>3600000</value>
</configuration>
<configuration>
<name>wait</name>
<value>240</value>
</configuration>
<configuration>
<name>network.throttling.rate</name>
<value>200</value>
</configuration>
<configuration>
<name>multicast.throttling.rate</name>
<value>10</value>
</configuration>
</configurationEntries>
<!--
It is possible to specify a single IP address. For example, to add 192.168.1.1
as the only address, specify as follows.
<publicIpAddresses>
<zoneId>1</zoneId>
<ipAddressRange>192.168.1.1</ipAddressRange>
</publicIpAddresses>
For each ip address range, create a new object. For example, to add the range 192.168.2.1 to 192.168.2.255
copy the following object tag into the privateIpRange
<privateIpAddresses>
<zoneId>1</zoneId>
<podId>1</podId>
<ipAddressRange>192.168.2.1-192.168.2.255</ipAddressRange>
</privateIpAddresses>
-->
<!--
It is possible to specify a single IP address. For example, to add 65.37.141.29
as the only address, specify as follows.
<publicIpAddresses>
<zoneId>1</zoneId>
<ipAddressRange>65.37.141.29</ipAddressRange>
</publicIpAddresses>
For each ip address range, create a new object. For example, to add the range 65.37.141.29 to 65.37.141.39
copy the following object tag into the publicIpRange
<publicIpAddresses>
<zoneId>1</zoneId>
<ipAddressRange>65.37.141.29-65.37.141.39</ipAddressRange>
</publicIpAddresses>
-->
</data>

View File

@ -1,30 +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.
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (1, 'routing', 'DomR Template', 0, 'tank/volumes/demo/template/private/u000000/os/routing', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/routing/vmi-root-fc8-x86_64-domR.img.bz2', 'd00927f863a23b98cc6df6e377c9d0c6', 0, 'DomR Template', 0);
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (3, 'centos53-x86_64', 'Centos 5.3(x86_64) no GUI', 1, 'tank/volumes/demo/template/public/os/centos53-x86_64', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/centos52-x86_64/vmi-root-centos.5-2.64.pv.img.gz', 'd4ca80825d936db00eedf26620f13d69', 0, 'Centos 5.3(x86_64) no GUI', 0);
#INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
# VALUES (4, 'centos52-x86_64-gui', 'Centos 5.2(x86_64) GUI', 1, 'tank/volumes/demo/template/public/os/centos52-x86_64-gui', now(), 'ext3', 0, 64, 1, 'http://vmopsserver.lab.vmops.com/images/centos52-x86_64/vmi-root-centos.5-2.64.pv.img.gz', 'd4ca80825d936db00eedf26620f13d69', 0, 'Centos 5.2(x86_64) GUI', 0);
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (5, 'winxpsp3', 'Windows XP SP3 (32-bit)', 1, 'tank/volumes/demo/template/public/os/winxpsp3', now(), 'ntfs', 1, 32, 1, 'http://vmopsserver.lab.vmops.com/images/fedora10-x86_64/vmi-root-fedora10.64.img.gz', 'c76d42703f14108b15acc9983307c759', 0, 'Windows XP SP3 (32-bit)', 0);
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (7, 'win2003sp2', 'Windows 2003 SP2 (32-bit)', 1, 'tank/volumes/demo/template/public/os/win2003sp2', now(), 'ntfs', 1, 32, 1, 'http://vmopsserver.lab.vmops.com/images/win2003sp2/vmi-root-win2003sp2.img.gz', '4d2cc51898d05c0f7a2852c15bcdc77b', 0, 'Windows 2003 SP2 (32-bit)', 0);
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (8, 'win2003sp2-x64', 'Windows 2003 SP2 (64-bit)', 1, 'tank/volumes/demo/template/public/os/win2003sp2-x64', now(), 'ntfs', 1, 64, 1, 'http://vmopsserver.lab.vmops.com/images/win2003sp2-x86_64/vmi-root-win2003sp2-x64.img.gz', '35d4de1c38eb4fb9d81a31c1d989c482', 0, 'Windows 2003 SP2 (64-bit)', 0);
INSERT INTO `vmops`.`vm_template` (id, unique_name, name, public, path, created, type, hvm, bits, created_by, url, checksum, ready, display_text, enable_password)
VALUES (9, 'fedora12-GUI-x86_64', 'Fedora 12 Desktop(64-bit)', 1, 'tank/volumes/demo/template/public/os/fedora12-GUI-x86_64', now(), 'ext3', 1, 64, 1, 'http://vmopsserver.lab.vmops.com/images/fedora12-GUI-x86_64/vmi-root-fedora12-GUI-x86_64.qcow2.gz', '', 0, 'Fedora 12 Desktop (with httpd,java and mysql)', 0);

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
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.
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE}{GMT} %5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<!-- ================================ -->
<!-- Append messages to the usage log -->
<!-- ================================ -->
<!-- A time/date based rolling appender -->
<appender name="USAGE" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="DEBUG"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/var/log/cloud/cloud_usage.log.%d{yyyy-MM-dd}{GMT}.gz"/>
<param name="ActiveFileName" value="/var/log/cloud/cloud_usage.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="com.cloud">
<priority value="DEBUG"/>
</category>
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
<category name="org.apache">
<priority value="INFO"/>
</category>
<category name="org">
<priority value="INFO"/>
</category>
<category name="net">
<priority value="INFO"/>
</category>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<level value="INFO"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="USAGE"/>
</root>
</log4j:configuration>

View File

@ -1,85 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
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.
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE}{GMT} %5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<!-- ================================ -->
<!-- Append messages to the usage log -->
<!-- ================================ -->
<!-- A time/date based rolling appender -->
<appender name="USAGE" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="DEBUG"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="@logdir@/cloud_usage.log.%d{yyyy-MM-dd}{GMT}.gz"/>
<param name="ActiveFileName" value="@logdir@/cloud_usage.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="com.cloud">
<priority value="DEBUG"/>
</category>
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
<category name="org.apache">
<priority value="INFO"/>
</category>
<category name="org">
<priority value="INFO"/>
</category>
<category name="net">
<priority value="INFO"/>
</category>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<level value="INFO"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="USAGE"/>
</root>
</log4j:configuration>

View File

@ -1,67 +0,0 @@
<?xml version="1.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.
-->
<!--
usage-components.xml is the configuration file for the VM Ops
usage servers.
Here are some places to look for information.
- To find out the general functionality that each Manager
or Adapter provide, look at the javadoc for the interface
that it implements. The interface is usually the
"key" attribute in the declaration.
- To find specific implementation of each Manager or
Adapter, look at the javadoc for the actual class. The
class can be found in the <class> element.
- To find out the configuration parameters for each Manager
or Adapter, look at the javadoc for the actual implementation
class. It should be documented in the description of the
class.
- To know more about the components.xml in general, look for
the javadoc for ComponentLocator.java.
If you found that the Manager or Adapter are not properly
documented, please contact the author.
-->
<components.xml>
<usage-server>
<dao name="VM Instance" class="com.cloud.vm.dao.VMInstanceDaoImpl"/>
<dao name="User VM" class="com.cloud.vm.dao.UserVmDaoImpl"/>
<dao name="ServiceOffering" class="com.cloud.service.dao.ServiceOfferingDaoImpl">
<param name="cache.size">50</param>
<param name="cache.time.to.live">-1</param>
</dao>
<dao name="UserStats" class="com.cloud.user.dao.UserStatisticsDaoImpl"/>
<dao name="IP Addresses" class="com.cloud.network.dao.IPAddressDaoImpl"/>
<dao name="Usage" class="com.cloud.usage.dao.UsageDaoImpl"/>
<dao name="Domain" class="com.cloud.domain.dao.DomainDaoImpl"/>
<dao name="Account" class="com.cloud.user.dao.AccountDaoImpl"/>
<dao name="UserAccount" class="com.cloud.user.dao.UserAccountDaoImpl"/>
<dao name="Usage VmInstance" class="com.cloud.usage.dao.UsageVMInstanceDaoImpl"/>
<dao name="Usage Network" class="com.cloud.usage.dao.UsageNetworkDaoImpl"/>
<dao name="Usage IPAddress" class="com.cloud.usage.dao.UsageIPAddressDaoImpl"/>
<dao name="Usage Job" class="com.cloud.usage.dao.UsageJobDaoImpl"/>
<dao name="Configuration" class="com.cloud.configuration.dao.ConfigurationDaoImpl"/>
<dao name="Usage Event" class="com.cloud.event.dao.UsageEventDaoImpl"/>
<manager name="Usage alert manager" class="com.cloud.usage.UsageAlertManagerImpl"/>
<manager name="usage manager" class="com.cloud.usage.UsageManagerImpl">
<param name="period">DAILY</param> <!-- DAILY, WEEKLY, MONTHLY; how often it creates usage records -->
</manager>
</usage-server>
</components.xml>

View File

@ -1,18 +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.
agent.minimal.version=@agent.min.version@

View File

@ -1,544 +0,0 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ehcache.xsd">
<!--
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.
-->
<!--
CacheManager Configuration
==========================
An ehcache.xml corresponds to a single CacheManager.
See instructions below or the ehcache schema (ehcache.xsd) on how to configure.
System property tokens can be specified in this file which are replaced when the configuration is loaded.
For example multicastGroupPort=${multicastGroupPort} can be replaced with the System property either
from an environment variable or a system property specified with a command line switch such as
-DmulticastGroupPort=4446.
DiskStore configuration
=======================
The diskStore element is optional. To turn off disk store path creation, comment out the diskStore
element below.
Configure it if you have overflowToDisk or diskPersistent enabled for any cache.
If it is not configured, and a cache is created which requires a disk store, a warning will be
issued and java.io.tmpdir will automatically be used.
diskStore has only one attribute - "path". It is the path to the directory where
.data and .index files will be created.
If the path is one of the following Java System Property it is replaced by its value in the
running VM. For backward compatibility these are not specified without being enclosed in the ${token}
replacement syntax.
The following properties are translated:
* user.home - User's home directory
* user.dir - User's current working directory
* java.io.tmpdir - Default temp file path
* ehcache.disk.store.dir - A system property you would normally specify on the command line
e.g. java -Dehcache.disk.store.dir=/u01/myapp/diskdir ...
Subdirectories can be specified below the property e.g. java.io.tmpdir/one
-->
<!-- diskStore path="java.io.tmpdir"/ -->
<!--
CacheManagerEventListener
=========================
Specifies a CacheManagerEventListenerFactory, be used to create a CacheManagerPeerProvider,
which is notified when Caches are added or removed from the CacheManager.
The attributes of CacheManagerEventListenerFactory are:
* class - a fully qualified factory class name
* properties - comma separated properties having meaning only to the factory.
Sets the fully qualified class name to be registered as the CacheManager event listener.
The events include:
* adding a Cache
* removing a Cache
Callbacks to listener methods are synchronous and unsynchronized. It is the responsibility
of the implementer to safely handle the potential performance and thread safety issues
depending on what their listener is doing.
If no class is specified, no listener is created. There is no default.
-->
<cacheManagerEventListenerFactory class="" properties=""/>
<!--
CacheManagerPeerProvider
========================
(Enable for distributed operation)
Specifies a CacheManagerPeerProviderFactory which will be used to create a
CacheManagerPeerProvider, which discovers other CacheManagers in the cluster.
The attributes of cacheManagerPeerProviderFactory are:
* class - a fully qualified factory class name
* properties - comma separated properties having meaning only to the factory.
Ehcache comes with a built-in RMI-based distribution system with two means of discovery of
CacheManager peers participating in the cluster:
* automatic, using a multicast group. This one automatically discovers peers and detects
changes such as peers entering and leaving the group
* manual, using manual rmiURL configuration. A hardcoded list of peers is provided at
configuration time.
Configuring Automatic Discovery:
Automatic discovery is configured as per the following example:
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic, multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=32"/>
Valid properties are:
* peerDiscovery (mandatory) - specify "automatic"
* multicastGroupAddress (mandatory) - specify a valid multicast group address
* multicastGroupPort (mandatory) - specify a dedicated port for the multicast heartbeat
traffic
* timeToLive - specify a value between 0 and 255 which determines how far the packets will
propagate.
By convention, the restrictions are:
0 - the same host
1 - the same subnet
32 - the same site
64 - the same region
128 - the same continent
255 - unrestricted
Configuring Manual Discovery:
Manual discovery is configured as per the following example:
<cacheManagerPeerProviderFactory class=
"net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=manual,
rmiUrls=//server1:40000/sampleCache1|//server2:40000/sampleCache1
| //server1:40000/sampleCache2|//server2:40000/sampleCache2"
propertySeparator="," />
Valid properties are:
* peerDiscovery (mandatory) - specify "manual"
* rmiUrls (mandatory) - specify a pipe separated list of rmiUrls, in the form
//hostname:port
The hostname is the hostname of the remote CacheManager peer. The port is the listening
port of the RMICacheManagerPeerListener of the remote CacheManager peer.
Configuring JGroups replication:
<cacheManagerPeerProviderFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
properties="connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;
mcast_send_buf_size=150000;mcast_recv_buf_size=80000):
PING(timeout=2000;num_initial_members=6):
MERGE2(min_interval=5000;max_interval=10000):
FD_SOCK:VERIFY_SUSPECT(timeout=1500):
pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000):
UNICAST(timeout=5000):
pbcast.STABLE(desired_avg_gossip=20000):
FRAG:
pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=false)"
propertySeparator="::"
/>
The only property necessay is the connect String used by jgroups to configure itself. Refer to the Jgroups documentation for explanation
of all the protocols. The example above uses UDP multicast. If the connect property is not specified the default JGroups connection will be
used.
-->
<cacheManagerPeerProviderFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"
properties="peerDiscovery=automatic,
multicastGroupAddress=230.0.0.1,
multicastGroupPort=4446, timeToLive=1"
propertySeparator=","
/>
<!--
CacheManagerPeerListener
========================
(Enable for distributed operation)
Specifies a CacheManagerPeerListenerFactory which will be used to create a
CacheManagerPeerListener, which
listens for messages from cache replicators participating in the cluster.
The attributes of cacheManagerPeerListenerFactory are:
class - a fully qualified factory class name
properties - comma separated properties having meaning only to the factory.
Ehcache comes with a built-in RMI-based distribution system. The listener component is
RMICacheManagerPeerListener which is configured using
RMICacheManagerPeerListenerFactory. It is configured as per the following example:
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties="hostName=fully_qualified_hostname_or_ip,
port=40001,
socketTimeoutMillis=120000"
propertySeparator="," />
All properties are optional. They are:
* hostName - the hostName of the host the listener is running on. Specify
where the host is multihomed and you want to control the interface over which cluster
messages are received. Defaults to the host name of the default interface if not
specified.
* port - the port the RMI Registry listener listens on. This defaults to a free port if not specified.
* remoteObjectPort - the port number on which the remote objects bound in the registry receive calls.
This defaults to a free port if not specified.
* socketTimeoutMillis - the number of ms client sockets will stay open when sending
messages to the listener. This should be long enough for the slowest message.
If not specified it defaults 120000ms.
-->
<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"/>
<!--
Cache configuration
===================
The following attributes are required.
name:
Sets the name of the cache. This is used to identify the cache. It must be unique.
maxElementsInMemory:
Sets the maximum number of objects that will be created in memory
maxElementsOnDisk:
Sets the maximum number of objects that will be maintained in the DiskStore
The default value is zero, meaning unlimited.
eternal:
Sets whether elements are eternal. If eternal, timeouts are ignored and the
element is never expired.
overflowToDisk:
Sets whether elements can overflow to disk when the memory store
has reached the maxInMemory limit.
The following attributes and elements are optional.
timeToIdleSeconds:
Sets the time to idle for an element before it expires.
i.e. The maximum amount of time between accesses before an element expires
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that an Element can idle for infinity.
The default value is 0.
timeToLiveSeconds:
Sets the time to live for an element before it expires.
i.e. The maximum time between creation time and when an element expires.
Is only used if the element is not eternal.
Optional attribute. A value of 0 means that and Element can live for infinity.
The default value is 0.
diskPersistent:
Whether the disk store persists between restarts of the Virtual Machine.
The default value is false.
diskExpiryThreadIntervalSeconds:
The number of seconds between runs of the disk expiry thread. The default value
is 120 seconds.
diskSpoolBufferSizeMB:
This is the size to allocate the DiskStore for a spool buffer. Writes are made
to this area and then asynchronously written to disk. The default size is 30MB.
Each spool buffer is used only by its cache. If you get OutOfMemory errors consider
lowering this value. To improve DiskStore performance consider increasing it. Trace level
logging in the DiskStore will show if put back ups are occurring.
memoryStoreEvictionPolicy:
Policy would be enforced upon reaching the maxElementsInMemory limit. Default
policy is Least Recently Used (specified as LRU). Other policies available -
First In First Out (specified as FIFO) and Less Frequently Used
(specified as LFU)
Cache elements can also contain sub elements which take the same format of a factory class
and properties. Defined sub-elements are:
* cacheEventListenerFactory - Enables registration of listeners for cache events, such as
put, remove, update, and expire.
* bootstrapCacheLoaderFactory - Specifies a BootstrapCacheLoader, which is called by a
cache on initialisation to prepopulate itself.
* cacheExtensionFactory - Specifies a CacheExtension, a generic mechansim to tie a class
which holds a reference to a cache to the cache lifecycle.
* cacheExceptionHandlerFactory - Specifies a CacheExceptionHandler, which is called when
cache exceptions occur.
* cacheLoaderFactory - Specifies a CacheLoader, which can be used both asynchronously and
synchronously to load objects into a cache.
RMI Cache Replication
Each cache that will be distributed needs to set a cache event listener which replicates
messages to the other CacheManager peers. For the built-in RMI implementation this is done
by adding a cacheEventListenerFactory element of type RMICacheReplicatorFactory to each
distributed cache's configuration as per the following example:
<cacheEventListenerFactory class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=true,
replicatePuts=true,
replicateUpdates=true,
replicateUpdatesViaCopy=true,
replicateRemovals=true
asynchronousReplicationIntervalMillis=<number of milliseconds"
propertySeparator="," />
The RMICacheReplicatorFactory recognises the following properties:
* replicatePuts=true|false - whether new elements placed in a cache are
replicated to others. Defaults to true.
* replicateUpdates=true|false - whether new elements which override an
element already existing with the same key are replicated. Defaults to true.
* replicateRemovals=true - whether element removals are replicated. Defaults to true.
* replicateAsynchronously=true | false - whether replications are
asynchronous (true) or synchronous (false). Defaults to true.
* replicateUpdatesViaCopy=true | false - whether the new elements are
copied to other caches (true), or whether a remove message is sent. Defaults to true.
* asynchronousReplicationIntervalMillis=<number of milliseconds> - The asynchronous
replicator runs at a set interval of milliseconds. The default is 1000. The minimum
is 10. This property is only applicable if replicateAsynchronously=true
For the Jgroups replication this is done with:
<cacheEventListenerFactory class="net.sf.ehcache.distribution.jgroups.JGroupsCacheReplicatorFactory"
properties="replicateAsynchronously=true, replicatePuts=true,
replicateUpdates=true, replicateUpdatesViaCopy=false,
replicateRemovals=true,asynchronousReplicationIntervalMillis=1000"/>
This listener supports the same property than the RMICacheReplicationFactory.
Cluster Bootstrapping
The RMIBootstrapCacheLoader bootstraps caches in clusters where RMICacheReplicators are
used. It is configured as per the following example:
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"
properties="bootstrapAsynchronously=true, maximumChunkSizeBytes=5000000"
propertySeparator="," />
The RMIBootstrapCacheLoaderFactory recognises the following optional properties:
* bootstrapAsynchronously=true|false - whether the bootstrap happens in the background
after the cache has started. If false, bootstrapping must complete before the cache is
made available. The default value is true.
* maximumChunkSizeBytes=<integer> - Caches can potentially be very large, larger than the
memory limits of the VM. This property allows the bootstraper to fetched elements in
chunks. The default chunk size is 5000000 (5MB).
Cache Exception Handling
By default, most cache operations will propagate a runtime CacheException on failure. An
interceptor, using a dynamic proxy, may be configured so that a CacheExceptionHandler can
be configured to intercept Exceptions. Errors are not intercepted.
It is configured as per the following example:
<cacheExceptionHandlerFactory class="com.example.ExampleExceptionHandlerFactory"
properties="logLevel=FINE"/>
Caches with ExceptionHandling configured are not of type Cache, but are of type Ehcache only,
and are not available using CacheManager.getCache(), but using CacheManager.getEhcache().
Cache Loader
A default CacheLoader may be set which loads objects into the cache through asynchronous and
synchronous methods on Cache. This is different to the bootstrap cache loader, which is used
only in distributed caching.
It is configured as per the following example:
<cacheLoaderFactory class="com.example.ExampleCacheLoaderFactory"
properties="type=int,startCounter=10"/>
Cache Extension
CacheExtensions are a general purpose mechanism to allow generic extensions to a Cache.
CacheExtensions are tied into the Cache lifecycle.
CacheExtensions are created using the CacheExtensionFactory which has a
<code>createCacheCacheExtension()</code> method which takes as a parameter a
Cache and properties. It can thus call back into any public method on Cache, including, of
course, the load methods.
Extensions are added as per the following example:
<cacheExtensionFactory class="com.example.FileWatchingCacheRefresherExtensionFactory"
properties="refreshIntervalMillis=18000, loaderTimeout=3000,
flushPeriod=whatever, someOtherProperty=someValue ..."/>
-->
<!--
Mandatory Default Cache configuration. These settings will be applied to caches
created programmtically using CacheManager.add(String cacheName).
The defaultCache has an implicit name "default" which is a reserved cache name.
-->
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="false"
diskSpoolBufferSizeMB="30"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
<!--
Sample caches. Following are some example caches. Remove these before use.
-->
<!--
Sample cache named sampleCache1
This cache contains a maximum in memory of 10000 elements, and will expire
an element if it is idle for more than 5 minutes and lives for more than
10 minutes.
If there are more than 10000 elements it will overflow to the
disk cache, which in this configuration will go to wherever java.io.tmp is
defined on your system. On a standard Linux system this will be /tmp"
-->
<!--
<cache name="sampleCache1"
maxElementsInMemory="10000"
maxElementsOnDisk="1000"
eternal="false"
overflowToDisk="true"
diskSpoolBufferSizeMB="20"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
memoryStoreEvictionPolicy="LFU"
/>
-->
<!--
Sample cache named sampleCache2
This cache has a maximum of 1000 elements in memory. There is no overflow to disk, so 1000
is also the maximum cache size. Note that when a cache is eternal, timeToLive and
timeToIdle are not used and do not need to be specified.
-->
<!--
<cache name="sampleCache2"
maxElementsInMemory="1000"
eternal="true"
overflowToDisk="false"
memoryStoreEvictionPolicy="FIFO"
/>
-->
<!--
Sample cache named sampleCache3. This cache overflows to disk. The disk store is
persistent between cache and VM restarts. The disk expiry thread interval is set to 10
minutes, overriding the default of 2 minutes.
-->
<!--
<cache name="sampleCache3"
maxElementsInMemory="500"
eternal="false"
overflowToDisk="true"
timeToIdleSeconds="300"
timeToLiveSeconds="600"
diskPersistent="true"
diskExpiryThreadIntervalSeconds="1"
memoryStoreEvictionPolicy="LFU"
/>
-->
<!--
Sample distributed cache named sampleDistributedCache1.
This cache replicates using defaults.
It also bootstraps from the cluster, using default properties.
-->
<!--
<cache name="sampleDistributedCache1"
maxElementsInMemory="10"
eternal="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"/>
<bootstrapCacheLoaderFactory
class="net.sf.ehcache.distribution.RMIBootstrapCacheLoaderFactory"/>
</cache>
-->
<!--
Sample distributed cache named sampleDistributedCache2.
This cache replicates using specific properties.
It only replicates updates and does so synchronously via copy
-->
<!--
<cache name="sampleDistributedCache2"
maxElementsInMemory="10"
eternal="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="replicateAsynchronously=false, replicatePuts=false,
replicateUpdates=true, replicateUpdatesViaCopy=true,
replicateRemovals=false"/>
</cache>
-->
<!--
Sample distributed cache named sampleDistributedCache3.
This cache replicates using defaults except that the asynchronous replication
interval is set to 200ms.
-->
<!--
<cache name="sampleDistributedCache3"
maxElementsInMemory="10"
eternal="false"
timeToIdleSeconds="100"
timeToLiveSeconds="100"
overflowToDisk="false">
<cacheEventListenerFactory
class="net.sf.ehcache.distribution.RMICacheReplicatorFactory"
properties="asynchronousReplicationIntervalMillis=200"/>
</cache>
-->
</ehcache>

View File

@ -1,131 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
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.
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<appender name="FILE1" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/var/log/cloud.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10000KB"/>
<param name="MaxBackupIndex" value="4"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p
[%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<appender name="FILE2" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/var/log/cloud/cloud.out"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10000KB"/>
<param name="MaxBackupIndex" value="4"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p
[%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<appender name="FILE3" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="File" value="/usr/local/cloud/systemvm/cloud.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="10000KB"/>
<param name="MaxBackupIndex" value="4"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p
[%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<appender name="APISERVER" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="DEBUG"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="/var/log/cloud/api-server.log.%d{yyyy-MM-dd}{GMT}.gz"/>
<param name="ActiveFileName" value="/var/log/cloud/api-server.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %m%n"/>
</layout>
</appender>
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE}{GMT} %5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="com.cloud">
<priority value="DEBUG"/>
</category>
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
<category name="org.apache">
<priority value="INFO"/>
</category>
<category name="org">
<priority value="INFO"/>
</category>
<category name="net">
<priority value="INFO"/>
</category>
<category name="apiserver.com.cloud">
<priority value="DEBUG"/>
</category>
<logger name="apiserver.com.cloud" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="APISERVER"/>
</logger>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<level value="INFO"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE1"/>
<appender-ref ref="FILE2"/>
<appender-ref ref="FILE3"/>
</root>
</log4j:configuration>

View File

@ -1,107 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!--
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.
-->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<!-- A time/date based rolling appender -->
<appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="DEBUG"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="@logdir@/cloud.log.%d{yyyy-MM-dd}{GMT}.gz"/>
<param name="ActiveFileName" value="@logdir@/cloud.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n"/>
</layout>
</appender>
<appender name="APISERVER" class="org.apache.log4j.rolling.RollingFileAppender">
<param name="Append" value="true"/>
<param name="Threshold" value="DEBUG"/>
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="@logdir@/api-server.log.%d{yyyy-MM-dd}{GMT}.gz"/>
<param name="ActiveFileName" value="@logdir@/api-server.log"/>
</rollingPolicy>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ISO8601}{GMT} %m%n"/>
</layout>
</appender>
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<param name="Threshold" value="INFO"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE}{GMT} %5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<!-- ================ -->
<!-- Limit categories -->
<!-- ================ -->
<category name="com.cloud">
<priority value="DEBUG"/>
</category>
<!-- Limit the org.apache category to INFO as its DEBUG is verbose -->
<category name="org.apache">
<priority value="INFO"/>
</category>
<category name="org">
<priority value="INFO"/>
</category>
<category name="net">
<priority value="INFO"/>
</category>
<category name="apiserver.com.cloud">
<priority value="DEBUG"/>
</category>
<logger name="apiserver.com.cloud" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="APISERVER"/>
</logger>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root>
<level value="INFO"/>
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
</log4j:configuration>

View File

@ -1,149 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<!--
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.
-->
<!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
-->
<Server port="8005" shutdown="SHUTDOWN">
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
<Listener className="org.apache.catalina.core.JasperListener" />
<!-- JMX Support for the Tomcat server. Documentation at /docs/non-existent.html -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="25"/>
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<!--
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- A "Connector" using the shared thread pool-->
<Connector executor="tomcatThreadPool"
port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" disableUploadTimeout="true"
acceptCount="150" enableLookups="false" maxThreads="150"
maxHttpHeaderSize="8192" redirectPort="8443" />
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreType="PKCS12"
keystoreFile="conf\cloud-localhost.pk12"
keystorePass="password"
/>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine name="Catalina" defaultHost="localhost">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- The request dumper valve dumps useful debugging information about
the request and response data received and sent by Tomcat.
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html -->
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve" directory="logs"
prefix="access_log." suffix=".txt" pattern="common" resolveHosts="false"/>
</Host>
</Engine>
</Service>
</Server>

View File

@ -185,6 +185,9 @@
<copy todir="${server.deploy.to.dir}/lib"> <copy todir="${server.deploy.to.dir}/lib">
<fileset dir="${deps.dir}/"> <fileset dir="${deps.dir}/">
<include name="*.jar"/> <include name="*.jar"/>
<exclude name="servlet*.jar"/>
<exclude name="axis2*.jar"/>
<exclude name="*slf4j*.jar"/>
</fileset> </fileset>
</copy> </copy>
<touch file="${server.deploy.to.dir}/webapps/client/WEB-INF/lib/scripts/vm/hypervisor/xenserver/version"/> <touch file="${server.deploy.to.dir}/webapps/client/WEB-INF/lib/scripts/vm/hypervisor/xenserver/version"/>

View File

@ -272,29 +272,6 @@
<tstamp> <tstamp>
<format property="package.date" pattern="yyyy-MM-dd" /> <format property="package.date" pattern="yyyy-MM-dd" />
</tstamp> </tstamp>
<zip destfile="${publish.dir}/cloud-${company.major.version}.${company.minor.version}.${company.patch.version}.${build.number}-${package.date}.zip" duplicate="preserve">
<zipfileset dir="${dist.dir}" prefix="cloud-${company.major.version}.${company.minor.version}.${company.patch.version}.${build.number}-${package.date}" filemode="777">
<include name="deploy-agent.sh" />
<include name="deploy-server.sh" />
</zipfileset>
<zipfileset dir="${db.dist.dir}" prefix="cloud-${company.major.version}.${company.minor.version}.${company.patch.version}.${build.number}-${package.date}/db" filemode="777">
<include name="deploy-db.sh" />
</zipfileset>
<zipfileset dir="${db.dist.dir}" prefix="cloud-${company.major.version}.${company.minor.version}.${company.patch.version}.${build.number}-${package.date}/db">
<include name="log4j.properties" />
<include name="create-schema.sql" />
<include name="init-data.sql" />
<include name="create-index-fk.sql" />
<include name="server-setup.xml" />
<include name="create-database.sql" />
<include name="templates.sql" />
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="cloud-${company.major.version}.${company.minor.version}.${company.patch.version}.${build.number}-${package.date}">
<include name="agent.zip" />
<include name="client.zip" />
<include name="docs.zip" />
</zipfileset>
</zip>
</target> </target>
<target name="package-kvm" depends="package-agent"> <target name="package-kvm" depends="package-agent">

View File

@ -17,6 +17,6 @@
# management server compile-time environment parameters # management server compile-time environment parameters
paths.script=@AGENTLIBDIR@ paths.script=@COMMONLIBDIR@
mount.parent=@MSMNTDIR@ mount.parent=@MSMNTDIR@
cloud-stack-components-specification=@COMPONENTS-SPEC@ cloud-stack-components-specification=@COMPONENTS-SPEC@

View File

@ -81,8 +81,8 @@ Group: System Environment/Libraries
%description server %description server
The CloudStack server libraries provide a set of Java classes for CloudStack. The CloudStack server libraries provide a set of Java classes for CloudStack.
%package agent-scripts %package scripts
Summary: CloudStack agent scripts Summary: CloudStack scripts
# FIXME nuke the archdependency # FIXME nuke the archdependency
Requires: python Requires: python
Requires: bash Requires: bash
@ -95,13 +95,10 @@ Requires: nfs-utils
Requires: wget Requires: wget
# there is a fsimage.so in the source code, which adds xen-libs as a dependence, needs to supress it, as rhel doesn't have this pacakge # there is a fsimage.so in the source code, which adds xen-libs as a dependence, needs to supress it, as rhel doesn't have this pacakge
AutoReqProv: no AutoReqProv: no
Obsoletes: vmops-agent-scripts < %{version}-%{release} Obsoletes: cloud-agent-scripts < %{version}-%{release}
Group: System Environment/Libraries Group: System Environment/Libraries
%description agent-scripts %description scripts
The CloudStack agent is in charge of managing shared computing resources in This package contains common scripts used by the Agent and Management server
a KVM-powered cloud. Install this package if this computer
will participate in your cloud -- this is a requirement for the CloudStack KVM
agent.
%package python %package python
Summary: CloudStack Python library Summary: CloudStack Python library
@ -143,8 +140,7 @@ Requires: java >= 1.6.0
Requires: %{name}-deps = %{version}, %{name}-utils = %{version}, %{name}-server = %{version} Requires: %{name}-deps = %{version}, %{name}-utils = %{version}, %{name}-server = %{version}
Requires: %{name}-client-ui = %{version} Requires: %{name}-client-ui = %{version}
Requires: %{name}-setup = %{version} Requires: %{name}-setup = %{version}
# reqs the agent-scripts package because of xenserver within the management server Requires: %{name}-scripts = %{version}
Requires: %{name}-agent-scripts = %{version}
Requires: %{name}-python = %{version} Requires: %{name}-python = %{version}
Requires: %{name}-aws-api = %{version} Requires: %{name}-aws-api = %{version}
# for consoleproxy # for consoleproxy
@ -209,7 +205,7 @@ Obsoletes: cloud-premium-agent < %{version}-%{release}
Requires: java >= 1.6.0 Requires: java >= 1.6.0
Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version} Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version}
Requires: %{name}-agent-libs = %{version} Requires: %{name}-agent-libs = %{version}
Requires: %{name}-agent-scripts = %{version} Requires: %{name}-scripts = %{version}
Requires: python Requires: python
Requires: %{name}-python = %{version} Requires: %{name}-python = %{version}
Requires: commons-httpclient Requires: commons-httpclient
@ -376,10 +372,6 @@ else
/sbin/service %{name}-usage condrestart >/dev/null 2>&1 || true /sbin/service %{name}-usage condrestart >/dev/null 2>&1 || true
fi fi
%pre agent-scripts
id %{name} > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \
-r -s /bin/sh -d %{_sharedstatedir}/%{name}/management %{name}|| true
%preun agent %preun agent
if [ "$1" == "0" ] ; then if [ "$1" == "0" ] ; then
/sbin/chkconfig --del %{name}-agent > /dev/null 2>&1 || true /sbin/chkconfig --del %{name}-agent > /dev/null 2>&1 || true
@ -454,12 +446,12 @@ fi
%{_javadir}/%{name}-plugin-nicira-nvp.jar %{_javadir}/%{name}-plugin-nicira-nvp.jar
%config(noreplace) %{_sysconfdir}/%{name}/server/* %config(noreplace) %{_sysconfdir}/%{name}/server/*
%files agent-scripts %files scripts
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_libdir}/%{name}/agent/scripts/* %{_libdir}/%{name}/common/scripts/*
# maintain the following list in sync with files agent-scripts # maintain the following list in sync with files scripts
%{_libdir}/%{name}/agent/vms/systemvm.zip %{_libdir}/%{name}/common/vms/systemvm.zip
%{_libdir}/%{name}/agent/vms/systemvm.iso %{_libdir}/%{name}/common/vms/systemvm.iso
%files deps %files deps
@ -468,6 +460,7 @@ fi
%{_javadir}/commons-dbcp-1.4.jar %{_javadir}/commons-dbcp-1.4.jar
%{_javadir}/commons-pool-1.6.jar %{_javadir}/commons-pool-1.6.jar
%{_javadir}/gson-1.7.1.jar %{_javadir}/gson-1.7.1.jar
%{_javadir}/CAStorSDK-*.jar
%{_javadir}/backport-util-concurrent-3.1.jar %{_javadir}/backport-util-concurrent-3.1.jar
%{_javadir}/ehcache-1.5.0.jar %{_javadir}/ehcache-1.5.0.jar
%{_javadir}/httpcore-4.0.jar %{_javadir}/httpcore-4.0.jar
@ -489,7 +482,7 @@ fi
%{_javadir}/commons-discovery-0.5.jar %{_javadir}/commons-discovery-0.5.jar
%{_javadir}/jstl-1.2.jar %{_javadir}/jstl-1.2.jar
%{_javadir}/javax.persistence-2.0.0.jar %{_javadir}/javax.persistence-2.0.0.jar
%{_javadir}/bcprov-jdk16-1.45.jar
%files core %files core
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)
%{_javadir}/%{name}-core.jar %{_javadir}/%{name}-core.jar
@ -541,7 +534,7 @@ fi
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)
%{_javadir}/%{name}-agent.jar %{_javadir}/%{name}-agent.jar
%{_javadir}/%{name}-plugin-hypervisor-kvm.jar %{_javadir}/%{name}-plugin-hypervisor-kvm.jar
%{_javadir}/libvirt-0.4.8.jar %{_javadir}/libvirt-0.4.9.jar
%files agent %files agent
%defattr(0644,root,root,0755) %defattr(0644,root,root,0755)

View File

@ -404,7 +404,7 @@ public class VirtualRoutingResource implements Manager {
for (IpAddressTO ip : ips) { for (IpAddressTO ip : ips) {
result = assignPublicIpAddress(routerName, routerIp, ip.getPublicIp(), ip.isAdd(), result = assignPublicIpAddress(routerName, routerIp, ip.getPublicIp(), ip.isAdd(),
ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
ip.getVifMacAddress(), ip.getGuestIp(), 2); ip.getVifMacAddress(), 2);
if (result != null) { if (result != null) {
results[i++] = IpAssocAnswer.errorResult; results[i++] = IpAssocAnswer.errorResult;
} else { } else {
@ -812,7 +812,7 @@ public class VirtualRoutingResource implements Manager {
final String privateIpAddress, final String publicIpAddress, final String privateIpAddress, final String publicIpAddress,
final boolean add, final boolean firstIP, final boolean sourceNat, final boolean add, final boolean firstIP, final boolean sourceNat,
final String vlanId, final String vlanGateway, final String vlanId, final String vlanGateway,
final String vlanNetmask, final String vifMacAddress, String guestIp, int nicNum){ final String vlanNetmask, final String vifMacAddress, int nicNum){
String args = ""; String args = "";
if (add) { if (add) {

View File

@ -83,6 +83,9 @@ public class UserAccountVO implements UserAccount {
@Column(name="is_registered") @Column(name="is_registered")
boolean registered; boolean registered;
@Column (name="incorrect_login_attempts")
int loginAttempts;
@Column(name="account_name", table="account", insertable=false, updatable=false) @Column(name="account_name", table="account", insertable=false, updatable=false)
private String accountName = null; private String accountName = null;
@ -269,4 +272,12 @@ public class UserAccountVO implements UserAccount {
public void setRegistered(boolean registered) { public void setRegistered(boolean registered) {
this.registered = registered; this.registered = registered;
} }
}
public void setLoginAttempts(int loginAttempts) {
this.loginAttempts = loginAttempts;
}
public int getLoginAttempts() {
return loginAttempts;
}
}

View File

@ -16,4 +16,4 @@
# under the License. # under the License.
/usr/share/java/gson-1.7.1.jar /usr/share/java/gson-1.7.1.jar
/usr/share/java/libvirt-0.4.8.jar /usr/share/java/libvirt-0.4.9.jar

View File

@ -1,17 +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.

View File

@ -1,27 +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.
/usr/lib/cloud/agent/scripts/installer/*
/usr/lib/cloud/agent/scripts/network/*
/usr/lib/cloud/agent/scripts/storage/*
/usr/lib/cloud/agent/scripts/util/*
/usr/lib/cloud/agent/scripts/vm/network/*
/usr/lib/cloud/agent/scripts/vm/systemvm/*
/usr/lib/cloud/agent/scripts/vm/pingtest.sh
/usr/lib/cloud/agent/scripts/vm/hypervisor/kvm/*
/usr/lib/cloud/agent/scripts/vm/hypervisor/versions.sh
/usr/lib/cloud/agent/scripts/vm/hypervisor/xenserver/*

View File

@ -1,29 +0,0 @@
#!/bin/sh -e
# 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.
case "$1" in
configure)
if ! id cloud > /dev/null 2>&1 ; then
adduser --system --home /var/lib/cloud/management --no-create-home \
--group --disabled-password --shell /bin/sh cloud
# update me in cloud-usage.postinst as well
fi
;;
esac
#DEBHELPER#

View File

@ -26,7 +26,7 @@
/usr/share/java/jstl-1.2.jar /usr/share/java/jstl-1.2.jar
/usr/share/java/axis2-1.5.1.jar /usr/share/java/axis2-1.5.1.jar
/usr/share/java/wsdl4j-1.6.2.jar /usr/share/java/wsdl4j-1.6.2.jar
/usr/share/java/bcprov-jdk16-1.46.jar /usr/share/java/bcprov-*.jar
/usr/share/java/jasypt-1.*.jar /usr/share/java/jasypt-1.*.jar
/usr/share/java/ejb-api-3.0.jar /usr/share/java/ejb-api-3.0.jar
/usr/share/java/javax.persistence-2.0.0.jar /usr/share/java/javax.persistence-2.0.0.jar

View File

@ -15,40 +15,13 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
build/replace.properties /usr/lib/cloud/common/scripts/installer/*
build/build.number /usr/lib/cloud/common/scripts/network/*
bin/ /usr/lib/cloud/common/scripts/storage/*
cloudstack-proprietary/ /usr/lib/cloud/common/scripts/util/*
premium/ /usr/lib/cloud/common/scripts/vm/network/*
.lock-wscript /usr/lib/cloud/common/scripts/vm/systemvm/*
artifacts/ /usr/lib/cloud/common/scripts/vm/pingtest.sh
.waf-* /usr/lib/cloud/common/scripts/vm/hypervisor/kvm/*
waf-* /usr/lib/cloud/common/scripts/vm/hypervisor/versions.sh
target/ /usr/lib/cloud/common/scripts/vm/hypervisor/xenserver/*
override/
.metadata
dist/
*~
*.bak
cloud-*.tar.bz2
*.log
*.pyc
build.number
api.log.*.gz
cloud.log.*.*
unittest
deps/cloud.userlibraries
deps/awsapi-lib/
.DS_Store
.idea
*.iml
git-remote-https.exe.stackdump
*.swp
tools/devcloud/devcloudbox/.vagrant
deps/*.jar
deps/*.war
deps/*.mar
*.jar
awsapi/modules/*
!.gitignore

View File

@ -15,4 +15,4 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
/usr/lib/cloud/agent/vms/systemvm.iso /usr/lib/cloud/common/vms/systemvm.iso

46
debian/control vendored
View File

@ -2,14 +2,11 @@ Source: cloud
Section: libs Section: libs
Priority: extra Priority: extra
Maintainer: Wido den Hollander <wido@widodh.nl> Maintainer: Wido den Hollander <wido@widodh.nl>
Build-Depends: debhelper (>= 7), openjdk-6-jdk, tomcat6, libws-commons-util-java, libcommons-dbcp-java, libcommons-collections-java, libcommons-httpclient-java, libservlet2.5-java, genisoimage, python-mysqldb, maven (>= 3.0.4), liblog4j1.2-java (>= 1.2.16) Build-Depends: debhelper (>= 7), openjdk-6-jdk, tomcat6, libws-commons-util-java, libcommons-dbcp-java, libcommons-collections-java, libcommons-httpclient-java, libservlet2.5-java, genisoimage, python-mysqldb, maven3 | maven (>= 3), liblog4j1.2-java (>= 1.2.16)
Standards-Version: 3.8.1 Standards-Version: 3.8.1
Homepage: http://www.cloudstack.org/ Homepage: http://www.cloudstack.org/
Package: cloud-deps Package: cloud-deps
Provides: vmops-deps
Conflicts: vmops-deps
Replaces: vmops-deps
Architecture: any Architecture: any
Depends: openjdk-6-jre, libcommons-discovery-java (>= 0.5), libcommons-dbcp-java (>= 1.4), libcommons-pool-java (>= 1.5.6), libcommons-codec-java (>= 1.5) Depends: openjdk-6-jre, libcommons-discovery-java (>= 0.5), libcommons-dbcp-java (>= 1.4), libcommons-pool-java (>= 1.5.6), libcommons-codec-java (>= 1.5)
Description: CloudStack library dependencies Description: CloudStack library dependencies
@ -18,9 +15,6 @@ Description: CloudStack library dependencies
Management Server. Management Server.
Package: cloud-agent-deps Package: cloud-agent-deps
Provides: cloud-agent-deps
Conflicts: cloud-agent-deps
Replaces: cloud-agent-deps
Architecture: any Architecture: any
Depends: openjdk-6-jre Depends: openjdk-6-jre
Description: CloudStack agent library dependencies Description: CloudStack agent library dependencies
@ -29,9 +23,6 @@ Description: CloudStack agent library dependencies
Agent. Agent.
Package: cloud-utils Package: cloud-utils
Provides: vmops-utils
Conflicts: vmops-utils
Replaces: vmops-utils
Architecture: any Architecture: any
Depends: openjdk-6-jre, python, libcglib-java (>= 2.2.2), libjsch-java (>= 0.1.42), libbackport-util-concurrent-java (>= 3.1) Depends: openjdk-6-jre, python, libcglib-java (>= 2.2.2), libjsch-java (>= 0.1.42), libbackport-util-concurrent-java (>= 3.1)
Description: CloudStack utility library Description: CloudStack utility library
@ -39,9 +30,6 @@ Description: CloudStack utility library
in the CloudStack environment. in the CloudStack environment.
Package: cloud-client-ui Package: cloud-client-ui
Provides: vmops-client-ui
Conflicts: vmops-client-ui
Replaces: vmops-client-ui
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-client (= ${source:Version}) Depends: openjdk-6-jre, cloud-client (= ${source:Version})
Description: CloudStack management server UI Description: CloudStack management server UI
@ -51,29 +39,21 @@ Description: CloudStack management server UI
CloudStack management server. CloudStack management server.
Package: cloud-server Package: cloud-server
Provides: vmops-server
Conflicts: vmops-server
Replaces: vmops-server
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-deps (= ${source:Version}), libservlet2.5-java Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-deps (= ${source:Version}), libservlet2.5-java
Description: CloudStack server library Description: CloudStack server library
The CloudStack server libraries provide a set of Java classes used The CloudStack server libraries provide a set of Java classes used
in the CloudStack management server. in the CloudStack management server.
Package: cloud-agent-scripts Package: cloud-scripts
Provides: vmops-agent-scripts, vmops-console, cloud-console, vmops-console-proxy Replaces: cloud-agent-scripts
Conflicts: vmops-agent-scripts, vmops-console, cloud-console, vmops-console-proxy
Replaces: vmops-agent-scripts, vmops-console, cloud-console, vmops-console-proxy
Architecture: any Architecture: any
Depends: openjdk-6-jre, python, bash, bzip2, gzip, unzip, nfs-common, openssh-client Depends: openjdk-6-jre, python, bash, bzip2, gzip, unzip, nfs-common, openssh-client
Description: CloudStack agent scripts Description: CloudStack scripts
This package contains a number of scripts needed for the CloudStack Agent on KVM This package contains a number of scripts needed for the CloudStack Agent and Management Server.
HyperVisor hosts. The CloudStack Agent depends on this package. Both the CloudStack Agent and Management server depend on this package
Package: cloud-core Package: cloud-core
Provides: vmops-core
Conflicts: vmops-core
Replaces: vmops-core
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-utils (= ${source:Version}) Depends: openjdk-6-jre, cloud-utils (= ${source:Version})
Description: CloudStack core library Description: CloudStack core library
@ -82,9 +62,6 @@ Description: CloudStack core library
Package: cloud-client Package: cloud-client
Provides: vmops-client
Conflicts: vmops-client
Replaces: vmops-client
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-deps (= ${source:Version}), cloud-utils (= ${source:Version}), cloud-server (= ${source:Version}), cloud-client-ui (= ${source:Version}), cloud-setup (= ${source:Version}), cloud-python (= ${source:Version}), tomcat6, libws-commons-util-java, sysvinit-utils, chkconfig, sudo, jsvc, python-mysqldb, python-paramiko, augeas-tools, genisoimage, cloud-system-iso, libmysql-java (>= 5.1) Depends: openjdk-6-jre, cloud-deps (= ${source:Version}), cloud-utils (= ${source:Version}), cloud-server (= ${source:Version}), cloud-client-ui (= ${source:Version}), cloud-setup (= ${source:Version}), cloud-python (= ${source:Version}), tomcat6, libws-commons-util-java, sysvinit-utils, chkconfig, sudo, jsvc, python-mysqldb, python-paramiko, augeas-tools, genisoimage, cloud-system-iso, libmysql-java (>= 5.1)
Description: CloudStack client Description: CloudStack client
@ -93,9 +70,6 @@ Description: CloudStack client
is required for the management server to work. is required for the management server to work.
Package: cloud-setup Package: cloud-setup
Provides: vmops-setup
Conflicts: vmops-setup
Replaces: vmops-setup
Architecture: any Architecture: any
Depends: openjdk-6-jre, python, cloud-utils (= ${source:Version}), cloud-deps (= ${source:Version}), cloud-server (= ${source:Version}), cloud-python (= ${source:Version}), python-mysqldb Depends: openjdk-6-jre, python, cloud-utils (= ${source:Version}), cloud-deps (= ${source:Version}), cloud-server (= ${source:Version}), cloud-python (= ${source:Version}), python-mysqldb
Description: CloudStack client Description: CloudStack client
@ -115,11 +89,8 @@ Description: CloudStack agent libraries
The CloudStack agent libraries are used by the Cloud Agent. The CloudStack agent libraries are used by the Cloud Agent.
Package: cloud-agent Package: cloud-agent
Provides: vmops-agent
Conflicts: vmops-agent
Replaces: vmops-agent
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-agent-deps (= ${source:Version}), python, cloud-python (= ${source:Version}), cloud-agent-libs (= ${source:Version}), cloud-agent-scripts (= ${source:Version}), libvirt0, sysvinit-utils, chkconfig, qemu-kvm, libvirt-bin, uuid-runtime, rsync, grep, iproute, ebtables, vlan, libcommons-httpclient-java, libservlet2.5-java, liblog4j1.2-java (>= 1.2.16), libjna-java, wget, jsvc, lsb-base (>= 3.2) Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-agent-deps (= ${source:Version}), python, cloud-python (= ${source:Version}), cloud-agent-libs (= ${source:Version}), cloud-scripts (= ${source:Version}), libvirt0, sysvinit-utils, chkconfig, qemu-kvm, libvirt-bin, uuid-runtime, rsync, grep, iproute, ebtables, vlan, libcommons-httpclient-java, libservlet2.5-java, liblog4j1.2-java (>= 1.2.16), libjna-java, wget, jsvc, lsb-base (>= 3.2)
Description: CloudStack agent Description: CloudStack agent
The CloudStack agent is in charge of managing shared computing resources in The CloudStack agent is in charge of managing shared computing resources in
a CloudStack powered cloud. Install this package if this computer a CloudStack powered cloud. Install this package if this computer
@ -133,9 +104,6 @@ Description: CloudStack system iso
will participate in your cloud. will participate in your cloud.
Package: cloud-usage Package: cloud-usage
Provides: vmops-usage
Conflicts: vmops-usage
Replaces: vmops-usage
Architecture: any Architecture: any
Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-deps (= ${source:Version}), cloud-server (= ${source:Version}), cloud-setup (= ${source:Version}), cloud-client (= ${source:Version}), jsvc Depends: openjdk-6-jre, cloud-utils (= ${source:Version}), cloud-core (= ${source:Version}), cloud-deps (= ${source:Version}), cloud-server (= ${source:Version}), cloud-setup (= ${source:Version}), cloud-client (= ${source:Version}), jsvc
Description: CloudStack usage monitor Description: CloudStack usage monitor

View File

@ -0,0 +1,489 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE bookinfo 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="citrix-xenserver-installation">
<title>Citrix XenServer Installation for &PRODUCT;</title>
<para>If you want to use the Citrix XenServer hypervisor to run guest virtual machines, install XenServer 6.0 or XenServer 6.0.2 on the host(s) in your cloud. For an initial installation, follow the steps below. If you have previously installed XenServer and want to upgrade to another version, see <xref linkend="xenserver-version-upgrading" />.</para>
<section id="system-requirements-xenserver-hosts">
<title>System Requirements for XenServer Hosts</title>
<itemizedlist>
<listitem><para>The host must be certified as compatible with one of the following. See the Citrix Hardware Compatibility Guide: <ulink url="http://hcl.xensource.com">http://hcl.xensource.com</ulink></para>
<itemizedlist>
<listitem><para>XenServer 5.6 SP2</para></listitem>
<listitem><para>XenServer 6.0</para></listitem>
<listitem><para>XenServer 6.0.2</para></listitem>
</itemizedlist>
</listitem>
<listitem><para>All hosts must be 64-bit and must support HVM (Intel-VT or AMD-V enabled in BIOS).</para></listitem>
<listitem><para>All hosts within a cluster must be homogenous. That means the CPUs must be of the same type, count, and feature flags.</para></listitem>
<listitem><para>You must re-install Citrix XenServer if you are going to re-use a host from a previous install.</para></listitem>
<listitem><para>64-bit x86 CPU (more cores results in better performance)</para></listitem>
<listitem><para>Hardware virtualization support required</para></listitem>
<listitem><para>4 GB of memory</para></listitem>
<listitem><para>36 GB of local disk</para></listitem>
<listitem><para>At least 1 NIC</para></listitem>
<listitem><para>Statically allocated IP Address</para></listitem>
<listitem><para>Be sure all the hotfixes provided by the hypervisor vendor are applied. Track the release of hypervisor patches through your hypervisor vendors support channel, and apply patches as soon as possible after they are released. &PRODUCT; will not track or notify you of required hypervisor patches. It is essential that your hosts are completely up to date with the provided hypervisor patches. The hypervisor vendor is likely to refuse to support any system that is not up to date with patches. For more information, see <ulink url="http://docs.cloudstack.org/Knowledge_Base/Possible_VM_corruption_if_XenServer_Hotfix_is_not_Applied/Highly_Recomended_Hotfixes_for_XenServer_5.6_SP2">Highly Recommended Hotfixes for XenServer</ulink> in the &PRODUCT; Knowledge Base.</para></listitem>
</itemizedlist>
<warning><para>The lack of up-do-date hotfixes can lead to data corruption and lost VMs.</para></warning>
</section>
<section id="xenserver-installation-steps">
<title>XenServer Installation Steps</title>
<orderedlist>
<listitem><para>From <ulink url="https://www.citrix.com/English/ss/downloads/">https://www.citrix.com/English/ss/downloads/</ulink>, download the appropriate version of XenServer for your &PRODUCT; version (see <xref linkend="system-requirements-xenserver-hosts"/>). Install it using the Citrix XenServer Installation Guide.</para></listitem>
<listitem><para>After installation, perform the following configuration steps, which are described in the next few sections:</para>
<informaltable frame="all">
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colname="c1" />
<colspec colname="c2" />
<thead>
<row>
<entry><para>Required</para></entry>
<entry><para>Optional</para></entry>
</row>
</thead>
<tbody>
<row>
<entry><para><xref linkend="config-xenserver-dom0-memory" /></para></entry>
<entry><para><xref linkend="xenserver-support-pkg-installation" /></para></entry>
</row>
<row>
<entry><para><xref linkend="xenserver-username-password" /></para></entry>
<entry><para>Set up SR if not using NFS, iSCSI, or local disk; see <xref linkend="xenserver-primary-storage-setup" /></para></entry>
</row>
<row>
<entry><para><xref linkend="xenserver-time-sync" /></para></entry>
<entry><para><xref linkend="xenserver-iscsi-multipath-setup" /></para></entry>
</row>
<row>
<entry><para><xref linkend="xenserver-get-deploy-license" /></para></entry>
<entry><para><xref linkend="xenserver-physical-network-setup" /></para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
</orderedlist>
</section>
<section id="config-xenserver-dom0-memory">
<title>Configure XenServer dom0 Memory</title>
<para>Configure the XenServer dom0 settings to allocate more memory to dom0. This can enable XenServer to handle larger numbers of virtual machines. We recommend 2940 MB of RAM for XenServer dom0. For instructions on how to do this, see <ulink url="http://support.citrix.com/article/CTX126531">http://support.citrix.com/article/CTX126531</ulink>. The article refers to XenServer 5.6, but the same information applies to XenServer 6.0.</para>
</section>
<section id="xenserver-username-password">
<title>Username and Password</title>
<para>All XenServers in a cluster must have the same username and password as configured in &PRODUCT;.</para>
</section>
<section id="xenserver-time-sync">
<title>Time Synchronization</title>
<para>The host must be set to use NTP. All hosts in a pod must have the same time.</para>
<orderedlist>
<listitem>
<para>Install NTP.</para>
<programlisting language="Bash"># yum install ntp</programlisting>
</listitem>
<listitem>
<para>Edit the NTP configuration file to point to your NTP server.</para>
<programlisting language="Bash"># vi /etc/ntp.conf</programlisting>
<para>Add one or more server lines in this file with the names of the NTP servers you want to use. For example:</para>
<programlisting>
server 0.xenserver.pool.ntp.org
server 1.xenserver.pool.ntp.org
server 2.xenserver.pool.ntp.org
server 3.xenserver.pool.ntp.org
</programlisting>
</listitem>
<listitem>
<para>Restart the NTP client.</para>
<programlisting language="Bash"># service ntpd restart</programlisting>
</listitem>
<listitem>
<para>Make sure NTP will start again upon reboot.</para>
<programlisting language="Bash"># chkconfig ntpd on</programlisting>
</listitem>
</orderedlist>
</section>
<section id="xenserver-licensing">
<title>Licensing</title>
<para>Citrix XenServer Free version provides 30 days usage without a license. Following the 30 day trial, XenServer requires a free activation and license. You can choose to install a license now or skip this step. If you skip this step, you will need to install a license when you activate and license the XenServer.</para>
<section id="xenserver-get-deploy-license">
<title>Getting and Deploying a License</title>
<para>If you choose to install a license now you will need to use the XenCenter to activate and get a license.</para>
<orderedlist>
<listitem><para>In XenCenter, click Tools > License manager.</para></listitem>
<listitem><para>Select your XenServer and select Activate Free XenServer.</para></listitem>
<listitem><para>Request a license.</para></listitem>
</orderedlist>
<para>You can install the license with XenCenter or using the xe command line tool.</para>
</section>
</section>
<section id="xenserver-support-pkg-installation">
<title>Install &PRODUCT; XenServer Support Package (CSP)</title>
<para>(Optional)</para>
<para>To enable security groups, elastic load balancing, and elastic IP on XenServer, download and install the &PRODUCT; XenServer Support Package (CSP). After installing XenServer, perform the following additional steps on each XenServer host.</para>
<orderedlist>
<listitem>
<para>Download the CSP software onto the XenServer host from one of the following links:</para>
<para>For XenServer 6.0.2:</para>
<para><ulink url="http://download.cloud.com/releases/3.0.1/XS-6.0.2/xenserver-cloud-supp.tgz">http://download.cloud.com/releases/3.0.1/XS-6.0.2/xenserver-cloud-supp.tgz</ulink></para>
<para>For XenServer 5.6 SP2:</para>
<para><ulink url="http://download.cloud.com/releases/2.2.0/xenserver-cloud-supp.tgz">http://download.cloud.com/releases/2.2.0/xenserver-cloud-supp.tgz</ulink></para>
<para>For XenServer 6.0:</para>
<para><ulink url="http://download.cloud.com/releases/3.0/xenserver-cloud-supp.tgz">http://download.cloud.com/releases/3.0/xenserver-cloud-supp.tgz</ulink></para>
</listitem>
<listitem>
<para>Extract the file:</para>
<programlisting language="Bash"># tar xf xenserver-cloud-supp.tgz</programlisting>
</listitem>
<listitem>
<para>Run the following script:</para>
<programlisting language="Bash"># xe-install-supplemental-pack xenserver-cloud-supp.iso</programlisting>
</listitem>
<listitem>
<para>If the XenServer host is part of a zone that uses basic networking, disable Open vSwitch (OVS):</para>
<programlisting language="Bash"># xe-switch-network-backend bridge</programlisting>
<para>Restart the host machine when prompted.</para>
</listitem>
</orderedlist>
<para>The XenServer host is now ready to be added to &PRODUCT;.</para>
</section>
<section id="xenserver-primary-storage-setup">
<title>Primary Storage Setup for XenServer</title>
<para>&PRODUCT; natively supports NFS, iSCSI and local storage. If you are using one of these storage types, there is no need to create the XenServer Storage Repository ("SR").</para>
<para>If, however, you would like to use storage connected via some other technology, such as FiberChannel, you must set up the SR yourself. To do so, perform the following steps. If you have your hosts in a XenServer pool, perform the steps on the master node. If you are working with a single XenServer which is not part of a cluster, perform the steps on that XenServer.</para>
<orderedlist>
<listitem><para>Connect FiberChannel cable to all hosts in the cluster and to the FiberChannel storage host.</para></listitem>
<listitem>
<para>Rescan the SCSI bus. Either use the following command or use XenCenter to perform an HBA rescan.</para>
<programlisting language="Bash"># scsi-rescan</programlisting>
</listitem>
<listitem><para>Repeat step 2 on every host.</para></listitem>
<listitem>
<para>Check to be sure you see the new SCSI disk.</para>
<programlisting language="Bash"># ls /dev/disk/by-id/scsi-360a98000503365344e6f6177615a516b -l</programlisting>
<para>The output should look like this, although the specific file name will be different (scsi-&lt;scsiID&gt;):</para>
<programlisting>
lrwxrwxrwx 1 root root 9 Mar 16 13:47
/dev/disk/by-id/scsi-360a98000503365344e6f6177615a516b -> ../../sdc
</programlisting>
</listitem>
<listitem><para>Repeat step 4 on every host.</para></listitem>
<listitem>
<para>On the storage server, run this command to get a unique ID for the new SR.</para>
<programlisting language="Bash"># uuidgen</programlisting>
<para>The output should look like this, although the specific ID will be different:</para>
<programlisting language="Bash">e6849e96-86c3-4f2c-8fcc-350cc711be3d</programlisting>
</listitem>
<listitem>
<para>Create the FiberChannel SR. In name-label, use the unique ID you just generated.</para>
<programlisting>
# xe sr-create type=lvmohba shared=true
device-config:SCSIid=360a98000503365344e6f6177615a516b
name-label=&quot;e6849e96-86c3-4f2c-8fcc-350cc711be3d&quot;
</programlisting>
<para>This command returns a unique ID for the SR, like the following example (your ID will be different):</para>
<programlisting language="Bash">7a143820-e893-6c6a-236e-472da6ee66bf</programlisting>
</listitem>
<listitem>
<para>To create a human-readable description for the SR, use the following command. In uuid, use the SR ID returned by the previous command. In name-description, set whatever friendly text you prefer.</para>
<programlisting language="Bash"># xe sr-param-set uuid=7a143820-e893-6c6a-236e-472da6ee66bf name-description=&quot;Fiber Channel storage repository&quot;</programlisting>
<para>Make note of the values you will need when you add this storage to &PRODUCT; later (see <xref linkend="primary-storage-add" />). In the Add Primary Storage dialog, in Protocol, you will choose PreSetup. In SR Name-Label, you will enter the name-label you set earlier (in this example, e6849e96-86c3-4f2c-8fcc-350cc711be3d).</para>
</listitem>
<listitem><para>(Optional) If you want to enable multipath I/O on a FiberChannel SAN, refer to the documentation provided by the SAN vendor.</para></listitem>
</orderedlist>
</section>
<section id="xenserver-iscsi-multipath-setup">
<title>iSCSI Multipath Setup for XenServer (Optional)</title>
<para>When setting up the storage repository on a Citrix XenServer, you can enable multipath I/O, which uses redundant physical components to provide greater reliability in the connection between the server and the SAN. To enable multipathing, use a SAN solution that is supported for Citrix servers and follow the procedures in Citrix documentation. The following links provide a starting point:</para>
<itemizedlist>
<listitem><para><ulink url="http://support.citrix.com/article/CTX118791">http://support.citrix.com/article/CTX118791</ulink></para></listitem>
<listitem><para><ulink url="http://support.citrix.com/article/CTX125403">http://support.citrix.com/article/CTX125403</ulink></para></listitem>
</itemizedlist>
<para>You can also ask your SAN vendor for advice about setting up your Citrix repository for multipathing.</para>
<para>Make note of the values you will need when you add this storage to the &PRODUCT; later (see <xref linkend="primary-storage-add" />). In the Add Primary Storage dialog, in Protocol, you will choose PreSetup. In SR Name-Label, you will enter the same name used to create the SR.</para>
<para>If you encounter difficulty, address the support team for the SAN provided by your vendor. If they are not able to solve your issue, see Contacting Support.</para>
</section>
<section id="xenserver-physical-network-setup">
<title>Physical Networking Setup for XenServer</title>
<para>Once XenServer has been installed, you may need to do some additional network configuration. At this point in the installation, you should have a plan for what NICs the host will have and what traffic each NIC will carry. The NICs should be cabled as necessary to implement your plan.</para>
<para>If you plan on using NIC bonding, the NICs on all hosts in the cluster must be cabled exactly the same. For example, if eth0 is in the private bond on one host in a cluster, then eth0 must be in the private bond on all hosts in the cluster.</para>
<para>The IP address assigned for the management network interface must be static. It can be set on the host itself or obtained via static DHCP.</para>
<para>&PRODUCT; configures network traffic of various types to use different NICs or bonds on the XenServer host. You can control this process and provide input to the Management Server through the use of XenServer network name labels. The name labels are placed on physical interfaces or bonds and configured in &PRODUCT;. In some simple cases the name labels are not required.</para>
<section id="xenserver-public-network-config">
<title>Configuring Public Network with a Dedicated NIC for XenServer (Optional)</title>
<para>&PRODUCT; supports the use of a second NIC (or bonded pair of NICs, described in <xref linkend="xenserver-nic-bonding" />) for the public network. If bonding is not used, the public network can be on any NIC and can be on different NICs on the hosts in a cluster. For example, the public network can be on eth0 on node A and eth1 on node B. However, the XenServer name-label for the public network must be identical across all hosts. The following examples set the network label to &quot;cloud-public&quot;. After the management server is installed and running you must configure it with the name of the chosen network label (e.g. &quot;cloud-public&quot;); this is discussed in <xref linkend="management-server-install-flow" />.</para>
<para>If you are using two NICs bonded together to create a public network, see <xref linkend="xenserver-nic-bonding" />.</para>
<para>If you are using a single dedicated NIC to provide public network access, follow this procedure on each new host that is added to &PRODUCT; before adding the host.</para>
<orderedlist>
<listitem><para>Run xe network-list and find the public network. This is usually attached to the NIC that is public. Once you find the network make note of its UUID. Call this &lt;UUID-Public&gt;.</para></listitem>
<listitem>
<para>Run the following command.</para>
<programlisting language="Bash"># xe network-param-set name-label=cloud-public uuid=&lt;UUID-Public&gt;</programlisting>
</listitem>
</orderedlist>
</section>
<section id="xenserver-multi-guest-network-config">
<title>Configuring Multiple Guest Networks for XenServer (Optional)</title>
<para>&PRODUCT; supports the use of multiple guest networks with the XenServer hypervisor. Each network is assigned a name-label in XenServer. For example, you might have two networks with the labels &quot;cloud-guest&quot; and &quot;cloud-guest2&quot;. After the management server is installed and running, you must add the networks and use these labels so that &PRODUCT; is aware of the networks.</para>
<para>Follow this procedure on each new host before adding the host to &PRODUCT;:</para>
<orderedlist>
<listitem><para>Run xe network-list and find one of the guest networks. Once you find the network make note of its UUID. Call this &lt;UUID-Guest&gt;.</para></listitem>
<listitem>
<para>Run the following command, substituting your own name-label and uuid values.</para>
<programlisting language="Bash"># xe network-param-set name-label=&lt;cloud-guestN&gt; uuid=&lt;UUID-Guest&gt;</programlisting>
</listitem>
<listitem><para>Repeat these steps for each additional guest network, using a different name-label and uuid each time.</para></listitem>
</orderedlist>
</section>
<section id="xenserver-separate-storage-network">
<title>Separate Storage Network for XenServer (Optional)</title>
<para>You can optionally set up a separate storage network. This should be done first on the host, before implementing the bonding steps below. This can be done using one or two available NICs. With two NICs bonding may be done as above. It is the administrator&apos;s responsibility to set up a separate storage network.</para>
<para>Give the storage network a different name-label than what will be given for other networks.</para>
<para>For the separate storage network to work correctly, it must be the only interface that can ping the primary storage device&apos;s IP address. For example, if eth0 is the management network NIC, ping -I eth0 &lt;primary storage device IP&gt; must fail. In all deployments, secondary storage devices must be pingable from the management network NIC or bond. If a secondary storage device has been placed on the storage network, it must also be pingable via the storage network NIC or bond on the hosts as well.</para>
<para>You can set up two separate storage networks as well. For example, if you intend to implement iSCSI multipath, dedicate two non-bonded NICs to multipath. Each of the two networks needs a unique name-label.</para>
<para>If no bonding is done, the administrator must set up and name-label the separate storage network on all hosts (masters and slaves).</para>
<para>Here is an example to set up eth5 to access a storage network on 172.16.0.0/24.</para>
<programlisting>
# xe pif-list host-name-label=&apos;hostname&apos; device=eth5
uuid ( RO) : ab0d3dd4-5744-8fae-9693-a022c7a3471d
device ( RO): eth5
#xe pif-reconfigure-ip DNS=172.16.3.3 gateway=172.16.0.1 IP=172.16.0.55 mode=static netmask=255.255.255.0 uuid=ab0d3dd4-5744-8fae-9693-a022c7a3471d</programlisting>
</section>
<section id="xenserver-nic-bonding">
<title>NIC Bonding for XenServer (Optional)</title>
<para>XenServer supports Source Level Balancing (SLB) NIC bonding. Two NICs can be bonded together to carry public, private, and guest traffic, or some combination of these. Separate storage networks are also possible. Here are some example supported configurations:</para>
<itemizedlist>
<listitem><para>2 NICs on private, 2 NICs on public, 2 NICs on storage</para></listitem>
<listitem><para>2 NICs on private, 1 NIC on public, storage uses management network</para></listitem>
<listitem><para>2 NICs on private, 2 NICs on public, storage uses management network</para></listitem>
<listitem><para>1 NIC for private, public, and storage</para></listitem>
</itemizedlist>
<para>All NIC bonding is optional.</para>
<para>XenServer expects all nodes in a cluster will have the same network cabling and same bonds implemented. In an installation the master will be the first host that was added to the cluster and the slave hosts will be all subsequent hosts added to the cluster. The bonds present on the master set the expectation for hosts added to the cluster later. The procedure to set up bonds on the master and slaves are different, and are described below. There are several important implications of this:</para>
<itemizedlist>
<listitem><para>You must set bonds on the first host added to a cluster. Then you must use xe commands as below to establish the same bonds in the second and subsequent hosts added to a cluster.</para></listitem>
<listitem><para>Slave hosts in a cluster must be cabled exactly the same as the master. For example, if eth0 is in the private bond on the master, it must be in the management network for added slave hosts.</para></listitem>
</itemizedlist>
<section id="management-network-bonding">
<title>Management Network Bonding</title>
<para>The administrator must bond the management network NICs prior to adding the host to &PRODUCT;.</para>
</section>
<section id="first-host-private-bond">
<title>Creating a Private Bond on the First Host in the Cluster</title>
<para>Use the following steps to create a bond in XenServer. These steps should be run on only the first host in a cluster. This example creates the cloud-private network with two physical NICs (eth0 and eth1) bonded into it.</para>
<orderedlist>
<listitem>
<para>Find the physical NICs that you want to bond together.</para>
<programlisting>
# xe pif-list host-name-label=&apos;hostname&apos; device=eth0
# xe pif-list host-name-label=&apos;hostname&apos; device=eth1</programlisting>
<para>These command shows the eth0 and eth1 NICs and their UUIDs. Substitute the ethX devices of your choice. Call the UUID&apos;s returned by the above command slave1-UUID and slave2-UUID.</para>
</listitem>
<listitem>
<para>Create a new network for the bond. For example, a new network with name &quot;cloud-private&quot;.</para>
<para><emphasis role="bold">This label is important. &PRODUCT; looks for a network by a name you configure. You must use the same name-label for all hosts in the cloud for the management network.</emphasis></para>
<programlisting>
# xe network-create name-label=cloud-private
# xe bond-create network-uuid=[uuid of cloud-private created above]
pif-uuids=[slave1-uuid],[slave2-uuid]</programlisting>
</listitem>
</orderedlist>
<para>Now you have a bonded pair that can be recognized by &PRODUCT; as the management network.</para>
</section>
<section id="public-network-bonding">
<title>Public Network Bonding</title>
<para>Bonding can be implemented on a separate, public network. The administrator is responsible for creating a bond for the public network if that network will be bonded and will be separate from the management network.</para>
</section>
<section id="first-host-public-network-bond">
<title>Creating a Public Bond on the First Host in the Cluster</title>
<para>These steps should be run on only the first host in a cluster. This example creates the cloud-public network with two physical NICs (eth2 and eth3) bonded into it.</para>
<orderedlist>
<listitem>
<para>Find the physical NICs that you want to bond together.</para>
<programlisting>
#xe pif-list host-name-label=&apos;hostname&apos; device=eth2
# xe pif-list host-name-label=&apos;hostname&apos; device=eth3</programlisting>
<para>These command shows the eth2 and eth3 NICs and their UUIDs. Substitute the ethX devices of your choice. Call the UUID&apos;s returned by the above command slave1-UUID and slave2-UUID.</para>
</listitem>
<listitem>
<para>Create a new network for the bond. For example, a new network with name &quot;cloud-public&quot;.</para>
<para><emphasis role="bold">This label is important. &PRODUCT; looks for a network by a name you configure. You must use the same name-label for all hosts in the cloud for the public network.</emphasis></para>
<programlisting>
# xe network-create name-label=cloud-public
# xe bond-create network-uuid=[uuid of cloud-public created above]
pif-uuids=[slave1-uuid],[slave2-uuid]</programlisting>
</listitem>
</orderedlist>
<para>Now you have a bonded pair that can be recognized by &PRODUCT; as the public network.</para>
</section>
<section id="adding-more-hosts">
<title>Adding More Hosts to the Cluster</title>
<para>With the bonds (if any) established on the master, you should add additional, slave hosts. Run the following command for all additional hosts to be added to the cluster. This will cause the host to join the master in a single XenServer pool.</para>
<programlisting>
# xe pool-join master-address=[master IP] master-username=root
master-password=[your password]</programlisting>
</section>
<section id="complete-bonding-setup">
<title>Complete the Bonding Setup Across the Cluster</title>
<para>With all hosts added to the pool, run the cloud-setup-bond script. This script will complete the configuration and set up of the bonds across all hosts in the cluster.</para>
<orderedlist>
<listitem><para>Copy the script from the Management Server in /usr/lib64/cloud/agent/scripts/vm/hypervisor/xenserver/cloud-setup-bonding.sh to the master host and ensure it is executable.</para></listitem>
<listitem>
<para>Run the script:</para>
<programlisting language="Bash"># ./cloud-setup-bonding.sh</programlisting>
</listitem>
</orderedlist>
<para>Now the bonds are set up and configured properly across the cluster.</para>
</section>
</section>
</section>
<section id="xenserver-version-upgrading">
<title>Upgrading XenServer Versions</title>
<para>This section tells how to upgrade XenServer software on &PRODUCT; hosts. The actual upgrade is described in XenServer documentation, but there are some additional steps you must perform before and after the upgrade.</para>
<note><para>Be sure the hardware is certified compatible with the new version of XenServer.</para></note>
<para>To upgrade XenServer:</para>
<orderedlist>
<listitem>
<para>Upgrade the database. On the Management Server node:</para>
<orderedlist numeration="loweralpha">
<listitem>
<para>Back up the database:</para>
<programlisting>
# mysqldump --user=root --databases cloud > cloud.backup.sql
# mysqldump --user=root --databases cloud_usage > cloud_usage.backup.sql</programlisting>
</listitem>
<listitem>
<para>You might need to change the OS type settings for VMs running on the upgraded hosts.</para>
<itemizedlist>
<listitem><para>If you upgraded from XenServer 5.6 GA to XenServer 5.6 SP2, change any VMs that have the OS type CentOS 5.5 (32-bit), Oracle Enterprise Linux 5.5 (32-bit), or Red Hat Enterprise Linux 5.5 (32-bit) to Other Linux (32-bit). Change any VMs that have the 64-bit versions of these same OS types to Other Linux (64-bit).</para></listitem>
<listitem><para>If you upgraded from XenServer 5.6 SP2 to XenServer 6.0.2, change any VMs that have the OS type CentOS 5.6 (32-bit), CentOS 5.7 (32-bit), Oracle Enterprise Linux 5.6 (32-bit), Oracle Enterprise Linux 5.7 (32-bit), Red Hat Enterprise Linux 5.6 (32-bit) , or Red Hat Enterprise Linux 5.7 (32-bit) to Other Linux (32-bit). Change any VMs that have the 64-bit versions of these same OS types to Other Linux (64-bit).</para></listitem>
<listitem><para>If you upgraded from XenServer 5.6 to XenServer 6.0.2, do all of the above.</para></listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Restart the Management Server and Usage Server. You only need to do this once for all clusters.</para>
<programlisting>
# service cloud-management start
# service cloud-usage start</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Disconnect the XenServer cluster from &PRODUCT;.</para>
<orderedlist numeration="loweralpha">
<listitem><para>Log in to the &PRODUCT; UI as root.</para></listitem>
<listitem><para>Navigate to the XenServer cluster, and click Actions Unmanage.</para></listitem>
<listitem><para>Watch the cluster status until it shows Unmanaged.</para></listitem>
</orderedlist>
</listitem>
<listitem>
<para>Log in to one of the hosts in the cluster, and run this command to clean up the VLAN:</para>
<programlisting language="Bash"># . /opt/xensource/bin/cloud-clean-vlan.sh</programlisting>
</listitem>
<listitem>
<para>Still logged in to the host, run the upgrade preparation script:</para>
<programlisting language="Bash"># /opt/xensource/bin/cloud-prepare-upgrade.sh</programlisting>
<para>Troubleshooting: If you see the error &quot;can&apos;t eject CD,&quot; log in to the VM and umount the CD, then run the script again.</para>
</listitem>
<listitem>
<para>Upgrade the XenServer software on all hosts in the cluster. Upgrade the master first.</para>
<orderedlist numeration="loweralpha">
<listitem>
<para>Live migrate all VMs on this host to other hosts. See the instructions for live migration in the Administrator&apos;s Guide.</para>
<para>Troubleshooting: You might see the following error when you migrate a VM:</para>
<programlisting>
[root@xenserver-qa-2-49-4 ~]# xe vm-migrate live=true host=xenserver-qa-2-49-5 vm=i-2-8-VM
You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected.
vm: b6cf79c8-02ee-050b-922f-49583d9f1a14 (i-2-8-VM)</programlisting>
<para>To solve this issue, run the following:</para>
<programlisting language="Bash"># /opt/xensource/bin/make_migratable.sh b6cf79c8-02ee-050b-922f-49583d9f1a14</programlisting>
</listitem>
<listitem><para>Reboot the host.</para></listitem>
<listitem><para>Upgrade to the newer version of XenServer. Use the steps in XenServer documentation.</para></listitem>
<listitem>
<para>After the upgrade is complete, copy the following files from the management server to this host, in the directory locations shown below:</para>
<informaltable frame="all">
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colname="c1" />
<colspec colname="c2" />
<thead>
<row>
<entry><para>Copy this Management Server file...</para></entry>
<entry><para>...to this location on the XenServer host</para></entry>
</row>
</thead>
<tbody>
<row>
<entry><para>/usr/lib64/cloud/agent/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py</para></entry>
<entry><para>/opt/xensource/sm/NFSSR.py</para></entry>
</row>
<row>
<entry><para>/usr/lib64/cloud/agent/scripts/vm/hypervisor/xenserver/setupxenserver.sh</para></entry>
<entry><para>/opt/xensource/bin/setupxenserver.sh</para></entry>
</row>
<row>
<entry><para>/usr/lib64/cloud/agent/scripts/vm/hypervisor/xenserver/make_migratable.sh</para></entry>
<entry><para>/opt/xensource/bin/make_migratable.sh</para></entry>
</row>
<row>
<entry><para>/usr/lib64/cloud/agent/scripts/vm/hypervisor/xenserver/cloud-clean-vlan.sh</para></entry>
<entry><para>/opt/xensource/bin/cloud-clean-vlan.sh</para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
<listitem>
<para>Run the following script:</para>
<programlisting language="Bash"># /opt/xensource/bin/setupxenserver.sh</programlisting>
<para>Troubleshooting: If you see the following error message, you can safely ignore it.</para>
<programlisting language="Bash">mv: cannot stat `/etc/cron.daily/logrotate&apos;: No such file or directory</programlisting>
</listitem>
<listitem>
<para>Plug in the storage repositories (physical block devices) to the XenServer host:</para>
<programlisting language="Bash"># for pbd in `xe pbd-list currently-attached=false| grep ^uuid | awk &apos;{print $NF}&apos;`; do xe pbd-plug uuid=$pbd ; done</programlisting>
<para>Note: If you add a host to this XenServer pool, you need to migrate all VMs on this host to other hosts, and eject this host from XenServer pool.</para>
</listitem>
</orderedlist>
</listitem>
<listitem><para>Repeat these steps to upgrade every host in the cluster to the same version of XenServer.</para></listitem>
<listitem>
<para>Run the following command on one host in the XenServer cluster to clean up the host tags:</para>
<programlisting language="Bash"># for host in $(xe host-list | grep ^uuid | awk &apos;{print $NF}&apos;) ; do xe host-param-clear uuid=$host param-name=tags; done;</programlisting>
<note><para>When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text.</para></note>
</listitem>
<listitem>
<para>Reconnect the XenServer cluster to &PRODUCT;.</para>
<orderedlist numeration="loweralpha">
<listitem><para>Log in to the &PRODUCT; UI as root.</para></listitem>
<listitem><para>Navigate to the XenServer cluster, and click Actions Manage.</para></listitem>
<listitem><para>Watch the status to see that all the hosts come up.</para></listitem>
</orderedlist>
</listitem>
<listitem>
<para>After all hosts are up, run the following on one host in the cluster:</para>
<programlisting language="Bash"># /opt/xensource/bin/cloud-clean-vlan.sh</programlisting>
</listitem>
</orderedlist>
</section>
</section>

View File

@ -32,4 +32,5 @@
<xi:include href="primary-storage-add.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="primary-storage-add.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="secondary-storage-add.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="secondary-storage-add.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="initialize-and-test.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> <xi:include href="initialize-and-test.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</chapter> <xi:include href="citrix-xenserver-installation.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>

View File

@ -42,7 +42,7 @@
<dependency> <dependency>
<groupId>org.libvirt</groupId> <groupId>org.libvirt</groupId>
<artifactId>libvirt</artifactId> <artifactId>libvirt</artifactId>
<version>0.4.8</version> <version>0.4.9</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -1534,8 +1534,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
result = _virtRouterResource.assignPublicIpAddress(routerName, result = _virtRouterResource.assignPublicIpAddress(routerName,
routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(),
ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(),
ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getVlanNetmask(), ip.getVifMacAddress(), nicNum);
ip.getGuestIp(), nicNum);
if (result != null) { if (result != null) {
results[i++] = IpAssocAnswer.errorResult; results[i++] = IpAssocAnswer.errorResult;
@ -2586,8 +2585,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements
if (result == null) { if (result == null) {
for (DiskDef disk : disks) { for (DiskDef disk : disks) {
if (disk.getDeviceType() == DiskDef.deviceType.CDROM if (disk.getDeviceType() == DiskDef.deviceType.CDROM
&& disk.getDiskPath() != null) && disk.getDiskPath() != null) {
cleanupDisk(conn, disk); cleanupDisk(conn, disk);
} else if (disk.getDiskPath().contains(vmName + "-patchdisk")
&& vmName.matches("^[rsv]-\\d+-VM$")) {
if (!_storagePoolMgr.deleteVbdByPath(disk.getDiskPath())) {
s_logger.warn("failed to delete patch disk " + disk.getDiskPath());
}
}
} }
} }
@ -2621,9 +2626,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements
String result = null; String result = null;
if (!sshKeysDir.exists()) { if (!sshKeysDir.exists()) {
sshKeysDir.mkdir(); sshKeysDir.mkdir();
// Change permissions for the 600 // Change permissions for the 700
Script script = new Script("chmod", _timeout, s_logger); Script script = new Script("chmod", _timeout, s_logger);
script.add("600", _SSHKEYSPATH); script.add("700", _SSHKEYSPATH);
script.execute(); script.execute();
} }
@ -2948,29 +2953,45 @@ public class LibvirtComputingResource extends ServerResourceBase implements
List<DiskDef> disks = vm.getDevices().getDisks(); List<DiskDef> disks = vm.getDevices().getDisks();
DiskDef rootDisk = disks.get(0); DiskDef rootDisk = disks.get(0);
VolumeTO rootVol = getVolume(vmSpec, Volume.Type.ROOT); VolumeTO rootVol = getVolume(vmSpec, Volume.Type.ROOT);
KVMStoragePool pool = _storagePoolMgr.getStoragePool(rootVol String patchName = vmName + "-patchdisk";
.getPoolUuid()); KVMStoragePool pool = _storagePoolMgr.getStoragePool(rootVol.getPoolUuid());
KVMPhysicalDisk disk = pool.createPhysicalDisk(UUID.randomUUID() String patchDiskPath = pool.getLocalPath() + "/" + patchName;
.toString(), KVMPhysicalDisk.PhysicalDiskFormat.RAW,
List<KVMPhysicalDisk> phyDisks = pool.listPhysicalDisks();
boolean foundDisk = false;
for (KVMPhysicalDisk phyDisk : phyDisks) {
if (phyDisk.getPath().equals(patchDiskPath)) {
foundDisk = true;
break;
}
}
if (!foundDisk) {
s_logger.debug("generating new patch disk for " + vmName + " since none was found");
KVMPhysicalDisk disk = pool.createPhysicalDisk(patchName, KVMPhysicalDisk.PhysicalDiskFormat.RAW,
10L * 1024 * 1024); 10L * 1024 * 1024);
} else {
s_logger.debug("found existing patch disk at " + patchDiskPath + " using it for " + vmName);
}
/* Format/create fs on this disk */ /* Format/create fs on this disk */
final Script command = new Script(_createvmPath, _timeout, s_logger); final Script command = new Script(_createvmPath, _timeout, s_logger);
command.add("-f", disk.getPath()); command.add("-f", patchDiskPath);
String result = command.execute(); String result = command.execute();
if (result != null) { if (result != null) {
s_logger.debug("Failed to create data disk: " + result); s_logger.debug("Failed to create data disk: " + result);
throw new InternalErrorException("Failed to create data disk: " throw new InternalErrorException("Failed to create data disk: "
+ result); + result);
} }
String datadiskPath = disk.getPath();
/* add patch disk */ /* add patch disk */
DiskDef patchDisk = new DiskDef(); DiskDef patchDisk = new DiskDef();
if (pool.getType() == StoragePoolType.CLVM) { if (pool.getType() == StoragePoolType.CLVM) {
patchDisk.defBlockBasedDisk(datadiskPath, 1, rootDisk.getBusType()); patchDisk.defBlockBasedDisk(patchDiskPath, 1, rootDisk.getBusType());
} else { } else {
patchDisk.defFileBasedDisk(datadiskPath, 1, rootDisk.getBusType(), patchDisk.defFileBasedDisk(patchDiskPath, 1, rootDisk.getBusType(),
DiskDef.diskFmtType.RAW); DiskDef.diskFmtType.RAW);
} }
@ -2978,7 +2999,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
String bootArgs = vmSpec.getBootArgs(); String bootArgs = vmSpec.getBootArgs();
patchSystemVm(bootArgs, datadiskPath, vmName); patchSystemVm(bootArgs, patchDiskPath, vmName);
} }
private void createVif(LibvirtVMDef vm, NicTO nic) private void createVif(LibvirtVMDef vm, NicTO nic)

View File

@ -73,6 +73,10 @@ public class KVMStoragePoolManager {
return true; return true;
} }
public boolean deleteVbdByPath(String diskPath) {
return this._storageAdaptor.deleteVbdByPath(diskPath);
}
public KVMPhysicalDisk createDiskFromTemplate(KVMPhysicalDisk template, String name, public KVMPhysicalDisk createDiskFromTemplate(KVMPhysicalDisk template, String name,
KVMStoragePool destPool) { KVMStoragePool destPool) {
if (destPool.getType() == StoragePoolType.RBD) { if (destPool.getType() == StoragePoolType.RBD) {

View File

@ -882,4 +882,21 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
return true; return true;
} }
public boolean deleteVbdByPath(String diskPath) {
Connect conn;
try {
conn = LibvirtConnection.getConnection();
StorageVol vol = conn.storageVolLookupByPath(diskPath);
if(vol != null) {
s_logger.debug("requested delete disk " + diskPath);
vol.delete(0);
}
} catch (LibvirtException e) {
s_logger.debug("Libvirt error in attempting to find and delete patch disk:" + e.toString());
return false;
}
return true;
}
} }

View File

@ -65,4 +65,6 @@ public interface StorageAdaptor {
public boolean createFolder(String uuid, String path); public boolean createFolder(String uuid, String path);
public boolean deleteVbdByPath(String path);
} }

View File

@ -1365,7 +1365,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
} }
protected void assignPublicIpAddress(VirtualMachineMO vmMo, final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP, protected void assignPublicIpAddress(VirtualMachineMO vmMo, final String vmName, final String privateIpAddress, final String publicIpAddress, final boolean add, final boolean firstIP,
final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress, String guestIp) throws Exception { final boolean sourceNat, final String vlanId, final String vlanGateway, final String vlanNetmask, final String vifMacAddress) throws Exception {
String publicNeworkName = HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId); String publicNeworkName = HypervisorHostHelper.getPublicNetworkNamePrefix(vlanId);
Pair<Integer, VirtualDevice> publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName); Pair<Integer, VirtualDevice> publicNicInfo = vmMo.getNicDeviceIndex(publicNeworkName);
@ -1570,7 +1570,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
for (IpAddressTO ip : ips) { for (IpAddressTO ip : ips) {
assignPublicIpAddress(vmMo, routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(), assignPublicIpAddress(vmMo, routerName, controlIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), ip.getVlanGateway(), ip.getVlanNetmask(),
ip.getVifMacAddress(), ip.getGuestIp()); ip.getVifMacAddress());
results[i++] = ip.getPublicIp() + " - success"; results[i++] = ip.getPublicIp() + " - success";
} }
} catch (Throwable e) { } catch (Throwable e) {

View File

@ -1849,7 +1849,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
protected void assignPublicIpAddress(Connection conn, String vmName, String privateIpAddress, String publicIpAddress, boolean add, boolean firstIP, protected void assignPublicIpAddress(Connection conn, String vmName, String privateIpAddress, String publicIpAddress, boolean add, boolean firstIP,
boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, String guestIp, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException { boolean sourceNat, String vlanId, String vlanGateway, String vlanNetmask, String vifMacAddress, Integer networkRate, TrafficType trafficType, String name) throws InternalErrorException {
try { try {
VM router = getVM(conn, vmName); VM router = getVM(conn, vmName);
@ -2028,7 +2028,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
for (IpAddressTO ip : ips) { for (IpAddressTO ip : ips) {
assignPublicIpAddress(conn, routerName, routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(), assignPublicIpAddress(conn, routerName, routerIp, ip.getPublicIp(), ip.isAdd(), ip.isFirstIP(), ip.isSourceNat(), ip.getVlanId(),
ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getGuestIp(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName()); ip.getVlanGateway(), ip.getVlanNetmask(), ip.getVifMacAddress(), ip.getNetworkRate(), ip.getTrafficType(), ip.getNetworkName());
results[i++] = ip.getPublicIp() + " - success"; results[i++] = ip.getPublicIp() + " - success";
} }
} catch (InternalErrorException e) { } catch (InternalErrorException e) {

View File

@ -464,7 +464,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan
@Override @Override
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException { public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
// return true, as IP will be associated as part of LB rule configuration // return true, as IP will be associated as part of LB rule configuration
return false; return true;
} }
@Override @Override

View File

@ -543,7 +543,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan
@Override @Override
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException { public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
// TODO Auto-generated method stub // return true, as IP will be associated as part of static NAT/port forwarding rule configuration
return false; return true;
} }
} }

View File

@ -617,7 +617,7 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
@Override @Override
public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException { public boolean applyIps(Network network, List<? extends PublicIpAddress> ipAddress, Set<Service> service) throws ResourceUnavailableException {
// return true, as IP will be associated as part of LB rule configuration // return true, as IP will be associated as part of LB rule configuration
return false; return true;
} }
@Override @Override

View File

@ -14,23 +14,7 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
/**
* Copyright (C) 2012 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.ovs; package com.cloud.network.ovs;
import com.cloud.agent.api.Command; import com.cloud.agent.api.Command;

View File

@ -14,23 +14,7 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.ovs; package com.cloud.network.ovs;

View File

@ -14,23 +14,6 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.ovs; package com.cloud.network.ovs;

View File

@ -14,23 +14,6 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.network.ovs; package com.cloud.network.ovs;

View File

@ -138,7 +138,7 @@ then
fi fi
fi fi
else else
if [ "$dflag" != 1]; then if [ "$dflag" != 1 ]; then
dbPassword=$(sed '/^\#/d' /etc/cloud/management/db.properties | grep 'db.cloud.password' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i ) dbPassword=$(sed '/^\#/d' /etc/cloud/management/db.properties | grep 'db.cloud.password' | tail -n 1 | cut -d "=" -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//'i )
fi fi
fi fi

View File

@ -14,23 +14,6 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.cloud.async; package com.cloud.async;

View File

@ -229,7 +229,7 @@ public enum Config {
EnableEC2API("Advanced", ManagementServer.class, Boolean.class, "enable.ec2.api", "false", "enable EC2 API on CloudStack", null), EnableEC2API("Advanced", ManagementServer.class, Boolean.class, "enable.ec2.api", "false", "enable EC2 API on CloudStack", null),
EnableS3API("Advanced", ManagementServer.class, Boolean.class, "enable.s3.api", "false", "enable Amazon S3 API on CloudStack", null), EnableS3API("Advanced", ManagementServer.class, Boolean.class, "enable.s3.api", "false", "enable Amazon S3 API on CloudStack", null),
RecreateSystemVmEnabled("Advanced", ManagementServer.class, Boolean.class, "recreate.systemvm.enabled", "false", "If true, will recreate system vm root disk whenever starting system vm", "true,false"), RecreateSystemVmEnabled("Advanced", ManagementServer.class, Boolean.class, "recreate.systemvm.enabled", "false", "If true, will recreate system vm root disk whenever starting system vm", "true,false"),
IncorrectLoginAttemptsAllowed("Advanced", ManagementServer.class, Integer.class, "incorrect.login.attempts.allowed", "5", "Incorrect login attempts allowed before the user is disabled", null),
// Ovm // Ovm
OvmPublicNetwork("Hidden", ManagementServer.class, String.class, "ovm.public.network.device", null, "Specify the public bridge on host for public network", null), OvmPublicNetwork("Hidden", ManagementServer.class, String.class, "ovm.public.network.device", null, "Specify the public bridge on host for public network", null),
OvmPrivateNetwork("Hidden", ManagementServer.class, String.class, "ovm.private.network.device", null, "Specify the private bridge on host for private network", null), OvmPrivateNetwork("Hidden", ManagementServer.class, String.class, "ovm.private.network.device", null, "Specify the private bridge on host for private network", null),

View File

@ -274,6 +274,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
configValuesForValidation.add("storage.cleanup.interval"); configValuesForValidation.add("storage.cleanup.interval");
configValuesForValidation.add("wait"); configValuesForValidation.add("wait");
configValuesForValidation.add("xen.heartbeat.interval"); configValuesForValidation.add("xen.heartbeat.interval");
configValuesForValidation.add("incorrect.login.attempts.allowed");
} }
@Override @Override

View File

@ -413,7 +413,7 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
// Get network rate // Get network rate
Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null); Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null);
IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, null, networkRate, false); IpAddressTO ip = new IpAddressTO(account.getAccountId(), sourceNatIpAddress, add, false, !sharedSourceNat, publicVlanTag, null, null, null, networkRate, false);
IpAddressTO[] ips = new IpAddressTO[1]; IpAddressTO[] ips = new IpAddressTO[1];
ips[0] = ip; ips[0] = ip;
IpAssocCommand cmd = new IpAssocCommand(ips); IpAssocCommand cmd = new IpAssocCommand(ips);

View File

@ -946,7 +946,7 @@ public abstract class ExternalLoadBalancerDeviceManagerImpl extends AdapterBase
selfIp = selfipNic.getIp4Address(); selfIp = selfipNic.getIp4Address();
} }
IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, null, networkRate, false); IpAddressTO ip = new IpAddressTO(guestConfig.getAccountId(), null, add, false, true, String.valueOf(guestVlanTag), selfIp, guestVlanNetmask, null, networkRate, false);
IpAddressTO[] ips = new IpAddressTO[1]; IpAddressTO[] ips = new IpAddressTO[1];
ips[0] = ip; ips[0] = ip;
IpAssocCommand cmd = new IpAssocCommand(ips); IpAssocCommand cmd = new IpAssocCommand(ips);

View File

@ -2654,10 +2654,8 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
String vlanNetmask = ipAddr.getNetmask(); String vlanNetmask = ipAddr.getNetmask();
String vifMacAddress = ipAddr.getMacAddress(); String vifMacAddress = ipAddr.getMacAddress();
String vmGuestAddress = null;
IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP,
sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, vmGuestAddress, networkRate, ipAddr.isOneToOneNat()); sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, networkRate, ipAddr.isOneToOneNat());
ip.setTrafficType(network.getTrafficType()); ip.setTrafficType(network.getTrafficType());
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network)); ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));

View File

@ -497,7 +497,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, false, IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, false,
ipAddr.isSourceNat(), ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), macAddress, ipAddr.isSourceNat(), ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), macAddress,
null, networkRate, ipAddr.isOneToOneNat()); networkRate, ipAddr.isOneToOneNat());
ip.setTrafficType(network.getTrafficType()); ip.setTrafficType(network.getTrafficType());
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network)); ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));
@ -1172,7 +1172,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
Network network = _networkMgr.getNetwork(ipAddr.getNetworkId()); Network network = _networkMgr.getNetwork(ipAddr.getNetworkId());
IpAddressTO ip = new IpAddressTO(Account.ACCOUNT_ID_SYSTEM, ipAddr.getIpAddress(), add, false, IpAddressTO ip = new IpAddressTO(Account.ACCOUNT_ID_SYSTEM, ipAddr.getIpAddress(), add, false,
false, ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), ipAddr.getMacAddress(), false, ipAddr.getVlanTag(), ipAddr.getGateway(), ipAddr.getNetmask(), ipAddr.getMacAddress(),
null, null, false); null, false);
ip.setTrafficType(network.getTrafficType()); ip.setTrafficType(network.getTrafficType());
ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network)); ip.setNetworkName(_networkMgr.getNetworkTag(router.getHypervisorType(), network));

View File

@ -158,6 +158,7 @@ public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO
final List<SecurityGroupWorkVO> vos = lockRows(sc, filter, true); final List<SecurityGroupWorkVO> vos = lockRows(sc, filter, true);
if (vos.size() == 0) { if (vos.size() == 0) {
txn.commit();
return; return;
} }
SecurityGroupWorkVO work = vos.get(0); SecurityGroupWorkVO work = vos.get(0);
@ -183,6 +184,7 @@ public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO
SecurityGroupWorkVO work = lockRow(workId, true); SecurityGroupWorkVO work = lockRow(workId, true);
if (work == null) { if (work == null) {
txn.commit();
return; return;
} }
work.setStep(step); work.setStep(step);

View File

@ -81,6 +81,7 @@ public class Criteria {
public static final String STORAGE_ID="storageid"; public static final String STORAGE_ID="storageid";
public static final String TEMPLATE_ID = "templateid"; public static final String TEMPLATE_ID = "templateid";
public static final String ISO_ID = "isoid"; public static final String ISO_ID = "isoid";
public static final String VPC_ID = "vpcId";
public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) { public Criteria(String orderBy, Boolean ascending, Long offset, Long limit) {
this.offset = offset; this.offset = offset;

View File

@ -224,6 +224,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AccountChecker")); private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AccountChecker"));
int _allowedLoginAttempts;
UserVO _systemUser; UserVO _systemUser;
AccountVO _systemAccount; AccountVO _systemAccount;
@Inject(adapter = SecurityChecker.class) @Inject(adapter = SecurityChecker.class)
@ -248,6 +250,9 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
Map<String, String> configs = configDao.getConfiguration(params); Map<String, String> configs = configDao.getConfiguration(params);
String loginAttempts = configs.get(Config.IncorrectLoginAttemptsAllowed.key());
_allowedLoginAttempts = NumbersUtil.parseInt(loginAttempts, 5);
String value = configs.get(Config.AccountCleanupInterval.key()); String value = configs.get(Config.AccountCleanupInterval.key());
_cleanupInterval = NumbersUtil.parseInt(value, 60 * 60 * 24); // 1 day. _cleanupInterval = NumbersUtil.parseInt(value, 60 * 60 * 24); // 1 day.
@ -302,6 +307,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
return (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN); return (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN);
} }
public boolean isInternalAccount(short accountType) {
if (isRootAdmin(accountType) || (accountType == Account.ACCOUNT_ID_SYSTEM)) {
return true;
}
return false;
}
@Override @Override
public void checkAccess(Account caller, Domain domain) throws PermissionDeniedException { public void checkAccess(Account caller, Domain domain) throws PermissionDeniedException {
for (SecurityChecker checker : _securityCheckers) { for (SecurityChecker checker : _securityCheckers) {
@ -420,6 +432,25 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
} }
@DB
public void updateLoginAttempts(Long id, int attempts, boolean toDisable) {
Transaction txn = Transaction.currentTxn();
txn.start();
try {
UserAccountVO user = null;
user = _userAccountDao.lockRow(id, true);
user.setLoginAttempts(attempts);
if(toDisable) {
user.setState(State.disabled.toString());
}
_userAccountDao.update(id, user);
txn.commit();
} catch (Exception e) {
s_logger.error("Failed to update login attempts for user with id " + id );
}
txn.close();
}
private boolean doSetUserStatus(long userId, State state) { private boolean doSetUserStatus(long userId, State state) {
UserVO userForUpdate = _userDao.createForUpdate(); UserVO userForUpdate = _userDao.createForUpdate();
userForUpdate.setState(state); userForUpdate.setState(state);
@ -732,7 +763,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
if (domainId == null) { if (domainId == null) {
domainId = DomainVO.ROOT_DOMAIN; domainId = DomainVO.ROOT_DOMAIN;
} }
if (userName.isEmpty()) { if (userName.isEmpty()) {
throw new InvalidParameterValueException("Username is empty"); throw new InvalidParameterValueException("Username is empty");
} }
@ -740,7 +771,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
if (firstName.isEmpty()) { if (firstName.isEmpty()) {
throw new InvalidParameterValueException("Firstname is empty"); throw new InvalidParameterValueException("Firstname is empty");
} }
if (lastName.isEmpty()) { if (lastName.isEmpty()) {
throw new InvalidParameterValueException("Lastname is empty"); throw new InvalidParameterValueException("Lastname is empty");
} }
@ -1002,6 +1033,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
txn.commit(); txn.commit();
if (success) { if (success) {
// whenever the user is successfully enabled, reset the login attempts to zero
updateLoginAttempts(userId, 0, false);
return _userAccountDao.findById(userId); return _userAccountDao.findById(userId);
} else { } else {
throw new CloudRuntimeException("Unable to enable user " + userId); throw new CloudRuntimeException("Unable to enable user " + userId);
@ -1818,11 +1851,36 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
throw new CloudAuthenticationException("User " + username + " in domain " + domainName + " is disabled/locked (or account is disabled/locked)"); throw new CloudAuthenticationException("User " + username + " in domain " + domainName + " is disabled/locked (or account is disabled/locked)");
// return null; // return null;
} }
// Whenever the user is able to log in successfully, reset the login attempts to zero
if(!isInternalAccount(userAccount.getType()))
updateLoginAttempts(userAccount.getId(), 0, false);
return userAccount; return userAccount;
} else { } else {
if (s_logger.isDebugEnabled()) { if (s_logger.isDebugEnabled()) {
s_logger.debug("Unable to authenticate user with username " + username + " in domain " + domainId); s_logger.debug("Unable to authenticate user with username " + username + " in domain " + domainId);
} }
UserAccount userAccount = _userAccountDao.getUserAccount(username, domainId);
UserAccountVO user = _userAccountDao.findById(userAccount.getId());
if (user != null) {
if ((user.getState().toString()).equals("enabled")) {
if (!isInternalAccount(user.getType())) {
//Internal accounts are not disabled
int attemptsMade = user.getLoginAttempts() + 1;
if (attemptsMade < _allowedLoginAttempts) {
updateLoginAttempts(userAccount.getId(), attemptsMade, false);
s_logger.warn("Login attempt failed. You have " + ( _allowedLoginAttempts - attemptsMade ) + " attempt(s) remaining");
} else {
updateLoginAttempts(userAccount.getId(), _allowedLoginAttempts, true);
s_logger.warn("User " + user.getUsername() + " has been disabled due to multiple failed login attempts." +
" Please contact admin.");
}
}
} else {
s_logger.info("User " + user.getUsername() + " is disabled/locked");
}
}
return null; return null;
} }
} }

View File

@ -141,6 +141,8 @@ import com.cloud.network.security.SecurityGroupManager;
import com.cloud.network.security.dao.SecurityGroupDao; import com.cloud.network.security.dao.SecurityGroupDao;
import com.cloud.network.security.dao.SecurityGroupVMMapDao; import com.cloud.network.security.dao.SecurityGroupVMMapDao;
import com.cloud.network.vpc.VpcManager; import com.cloud.network.vpc.VpcManager;
import com.cloud.network.vpc.VpcVO;
import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Availability; import com.cloud.offering.NetworkOffering.Availability;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
@ -319,6 +321,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
@Inject @Inject
protected NicDao _nicDao; protected NicDao _nicDao;
@Inject @Inject
protected VpcDao _vpcDao;
@Inject
protected RulesManager _rulesMgr; protected RulesManager _rulesMgr;
@Inject @Inject
protected LoadBalancingRulesManager _lbMgr; protected LoadBalancingRulesManager _lbMgr;
@ -3012,6 +3016,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId()); c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId());
c.addCriteria(Criteria.TEMPLATE_ID, cmd.getTemplateId()); c.addCriteria(Criteria.TEMPLATE_ID, cmd.getTemplateId());
c.addCriteria(Criteria.ISO_ID, cmd.getIsoId()); c.addCriteria(Criteria.ISO_ID, cmd.getIsoId());
c.addCriteria(Criteria.VPC_ID, cmd.getVpcId());
if (domainId != null) { if (domainId != null) {
c.addCriteria(Criteria.DOMAINID, domainId); c.addCriteria(Criteria.DOMAINID, domainId);
@ -3063,6 +3068,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
Object storageId = c.getCriteria(Criteria.STORAGE_ID); Object storageId = c.getCriteria(Criteria.STORAGE_ID);
Object templateId = c.getCriteria(Criteria.TEMPLATE_ID); Object templateId = c.getCriteria(Criteria.TEMPLATE_ID);
Object isoId = c.getCriteria(Criteria.ISO_ID); Object isoId = c.getCriteria(Criteria.ISO_ID);
Object vpcId = c.getCriteria(Criteria.VPC_ID);
sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE); sb.and("displayName", sb.entity().getDisplayName(), SearchCriteria.Op.LIKE);
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
@ -3110,6 +3116,19 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
sb.join("nicSearch", nicSearch, sb.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER); sb.join("nicSearch", nicSearch, sb.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
} }
if(vpcId != null && networkId == null){
SearchBuilder<NicVO> nicSearch = _nicDao.createSearchBuilder();
SearchBuilder<NetworkVO> networkSearch = _networkDao.createSearchBuilder();
nicSearch.join("networkSearch", networkSearch, nicSearch.entity().getNetworkId(), networkSearch.entity().getId(), JoinBuilder.JoinType.INNER);
SearchBuilder<VpcVO> vpcSearch = _vpcDao.createSearchBuilder();
vpcSearch.and("vpcId", vpcSearch.entity().getId(), SearchCriteria.Op.EQ);
networkSearch.join("vpcSearch", vpcSearch, networkSearch.entity().getVpcId(), vpcSearch.entity().getId(), JoinBuilder.JoinType.INNER);
sb.join("nicSearch", nicSearch, sb.entity().getId(), nicSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
}
if (storageId != null) { if (storageId != null) {
SearchBuilder<VolumeVO> volumeSearch = _volsDao.createSearchBuilder(); SearchBuilder<VolumeVO> volumeSearch = _volsDao.createSearchBuilder();
@ -3162,6 +3181,10 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
if (networkId != null) { if (networkId != null) {
sc.setJoinParameters("nicSearch", "networkId", networkId); sc.setJoinParameters("nicSearch", "networkId", networkId);
} }
if(vpcId != null && networkId == null){
sc.setJoinParameters("vpcSearch", "vpcId", vpcId);
}
if (name != null) { if (name != null) {
sc.setParameters("name", "%" + name + "%"); sc.setParameters("name", "%" + name + "%");

View File

@ -1745,7 +1745,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
set_vms.addAll(_vmDao.listLHByClusterId(clusterId)); set_vms.addAll(_vmDao.listLHByClusterId(clusterId));
for (VMInstanceVO vm : set_vms) { for (VMInstanceVO vm : set_vms) {
if (vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging) continue;
AgentVmInfo info = infos.remove(vm.getId()); AgentVmInfo info = infos.remove(vm.getId());
VMInstanceVO castedVm = null; VMInstanceVO castedVm = null;
if ((info == null && (vm.getState() == State.Running || vm.getState() == State.Starting)) if ((info == null && (vm.getState() == State.Running || vm.getState() == State.Starting))
@ -1789,23 +1788,26 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
e.printStackTrace(); e.printStackTrace();
} }
} }
else if (info != null && (vm.getState() == State.Stopped || vm.getState() == State.Stopping)) { else if (info != null && (vm.getState() == State.Stopped || vm.getState() == State.Stopping
Host host = _hostDao.findByGuid(info.getHostUuid()); || vm.isRemoved() || vm.getState() == State.Destroyed || vm.getState() == State.Expunging)) {
if (host != null){ Host host = _hostDao.findByGuid(info.getHostUuid());
s_logger.warn("Stopping a VM which is stopped/stopping " + info.name); if (host != null){
vm.setState(State.Stopped); // set it as stop and clear it from host s_logger.warn("Stopping a VM which is stopped/stopping/destroyed/expunging " + info.name);
vm.setHostId(null); if (vm.getState() == State.Stopped || vm.getState() == State.Stopping) {
_vmDao.persist(vm); vm.setState(State.Stopped); // set it as stop and clear it from host
try { vm.setHostId(null);
Answer answer = _agentMgr.send(host.getId(), cleanup(info.name)); _vmDao.persist(vm);
if (!answer.getResult()) { }
s_logger.warn("Unable to stop a VM due to " + answer.getDetails()); try {
} Answer answer = _agentMgr.send(host.getId(), cleanup(info.name));
} if (!answer.getResult()) {
catch (Exception e) { s_logger.warn("Unable to stop a VM due to " + answer.getDetails());
s_logger.warn("Unable to stop a VM due to " + e.getMessage()); }
} }
} catch (Exception e) {
s_logger.warn("Unable to stop a VM due to " + e.getMessage());
}
}
} }
else else
// host id can change // host id can change
@ -1831,7 +1833,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
} }
for (final AgentVmInfo left : infos.values()) { for (final AgentVmInfo left : infos.values()) {
if (VirtualMachineName.isValidVmName(left.name)) continue; // if the vm follows cloudstack naming ignore it for stopping if (!VirtualMachineName.isValidVmName(left.name)) continue; // if the vm doesn't follow CS naming ignore it for stopping
try { try {
Host host = _hostDao.findByGuid(left.getHostUuid()); Host host = _hostDao.findByGuid(left.getHostUuid());
if (host != null){ if (host != null){

View File

@ -890,6 +890,7 @@ CREATE TABLE `cloud`.`user` (
`timezone` varchar(30) default NULL, `timezone` varchar(30) default NULL,
`registration_token` varchar(255) default NULL, `registration_token` varchar(255) default NULL,
`is_registered` tinyint NOT NULL DEFAULT 0 COMMENT '1: yes, 0: no', `is_registered` tinyint NOT NULL DEFAULT 0 COMMENT '1: yes, 0: no',
`incorrect_login_attempts` integer unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
INDEX `i_user__removed`(`removed`), INDEX `i_user__removed`(`removed`),
INDEX `i_user__secret_key_removed`(`secret_key`, `removed`), INDEX `i_user__secret_key_removed`(`secret_key`, `removed`),

View File

@ -472,3 +472,6 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'manage
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'site2site.vpn.customergateway.subnets.limit', '10', 'The maximum number of subnets per customer gateway'); INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'site2site.vpn.customergateway.subnets.limit', '10', 'The maximum number of subnets per customer gateway');
INSERT IGNORE INTO `cloud`.`guest_os_category` VALUES ('11','None',NULL); INSERT IGNORE INTO `cloud`.`guest_os_category` VALUES ('11','None',NULL);
ALTER TABLE `cloud`.`user` ADD COLUMN `incorrect_login_attempts` integer unsigned NOT NULL DEFAULT '0';
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'incorrect.login.attempts.allowed', '5', 'Incorrect login attempts allowed before the user is disabled');

View File

@ -3,12 +3,6 @@ The tests are long running and are best monitored by external hudson jobs.
Also you will have to point marvin to the right configuration file that has Also you will have to point marvin to the right configuration file that has
details about your cloudstack deployment. For more help on how to write the details about your cloudstack deployment. For more help on how to write the
config file check the tutorial at : config file and run tests check the tutorial at :
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Testing+with+Python
http://docs.cloudstack.org/test_framework_1.0
http://wiki.cloudstack.org/display/QA/Testing+with+python
To run:
$ python -m marvin.deployAndRun -c config.cfg -d integration/smoke -t testcase.log -r result.log -l

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,274 @@
# -*- encoding: utf-8 -*-
# Copyright 2012 Citrix Systems, Inc. Licensed under the
# Apache License, Version 2.0 (the "License"); you may not use this
# file except in compliance with the License. Citrix Systems, Inc.
# reserves all rights not expressly granted by 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.
#
# Automatically generated by addcopyright.py at 04/03/2012
import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from integration.lib.utils import *
from integration.lib.base import *
from integration.lib.common import *
import datetime
class Services:
"""Test Resource Limits Services
"""
def __init__(self):
self.services = {
"domain": {
"name": "Domain",
},
"account": {
"email": "test@test.com",
"firstname": "Test",
"lastname": "User",
"username": "test",
# Random characters are appended for unique
# username
"password": "password",
},
"service_offering": {
"name": "Tiny Instance",
"displaytext": "Tiny Instance",
"cpunumber": 1,
"cpuspeed": 100, # in MHz
"memory": 64, # In MBs
},
"disk_offering": {
"displaytext": "Small",
"name": "Small",
"disksize": 1
},
"volume": {
"diskname": "TestDiskServ",
},
"server": {
"displayname": "TestVM",
"username": "root",
"password": "password",
"ssh_port": 22,
"hypervisor": 'XenServer',
"privateport": 22,
"publicport": 22,
"protocol": 'TCP',
},
"template": {
"displaytext": "Cent OS Template",
"name": "Cent OS Template",
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self',
},
"ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit)
"sleep": 60,
"timeout": 10,
"mode": 'advanced',
}
class TestAllocationState(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestResources,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.zone = get_zone(cls.api_client, cls.services)
cls._cleanup = []
return
@classmethod
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
return
def tearDown(self):
try:
#Clean up, terminate the created instance, volumes and snapshots
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_01_zones(self):
"""Check the status of zones"""
# Validate the following
# 1. List zones
# 2. Check allocation state is "enabled" or not
zones = Zone.list(
self.apiclient,
id=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(zones, list),
True,
"Check if listZones returns a valid response"
)
for zone in zones:
self.assertEqual(
zone.allocationstate,
'Enabled',
"Zone allocation state should be enabled"
)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_02_pods(self):
"""Check the status of pods"""
# Validate the following
# 1. List pods
# 2. Check allocation state is "enabled" or not
pods = Pod.list(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(pods, list),
True,
"Check if listPods returns a valid response"
)
for pod in pods:
self.assertEqual(
pod.allocationstate,
'Enabled',
"Pods allocation state should be enabled"
)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_03_clusters(self):
"""Check the status of clusters"""
# Validate the following
# 1. List clusters
# 2. Check allocation state is "enabled" or not
clusters = Cluster.list(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(clusters, list),
True,
"Check if listClusters returns a valid response"
)
for cluster in clusters:
self.assertEqual(
cluster.allocationstate,
'Enabled',
"Clusters allocation state should be enabled"
)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_04_hosts(self):
"""Check the status of hosts"""
# Validate the following
# 1. List hosts with type=Routing
# 2. Check state is "Up" or not
hosts = Host.list(
self.apiclient,
zoneid=self.zone.id,
type='Routing',
listall=True
)
self.assertEqual(
isinstance(hosts, list),
True,
"Check if listHosts returns a valid response"
)
for host in hosts:
self.assertEqual(
host.state,
'Up',
"Host should be in Up state and running"
)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_05_storage_pools(self):
"""Check the status of Storage pools"""
# Validate the following
# 1. List storage pools for the zone
# 2. Check state is "enabled" or not
storage_pools = StoragePool.list(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(storage_pools, list),
True,
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
self.assertEqual(
storage_pool.state,
'Up',
"storage pool should be in Up state and running"
)
return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_06_secondary_storage(self):
"""Check the status of secondary storage"""
# Validate the following
# 1. List secondary storage
# 2. Check state is "Up" or not
sec_storages = Host.list(
self.apiclient,
zoneid=self.zone.id,
type='SecondaryStorageVM',
listall=True
)
self.assertEqual(
isinstance(sec_storages, list),
True,
"Check if listHosts returns a valid response"
)
for sec_storage in sec_storages:
self.assertEqual(
sec_storage.state,
'Up',
"Secondary storage should be in Up state"
)
return

View File

@ -17,6 +17,7 @@
""" Tests for Blocker bugs """ Tests for Blocker bugs
""" """
import marvin import marvin
from nose.plugins.attrib import attr
from integration.lib.base import * from integration.lib.base import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.common import * from integration.lib.common import *
@ -24,7 +25,8 @@ from integration.lib.common import *
#Import Local Modules #Import Local Modules
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
class Services: class Services:
"""Test Services """Test Services
@ -42,14 +44,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
@ -69,20 +71,20 @@ class Services:
"volume": { "volume": {
"diskname": "APP Data Volume", "diskname": "APP Data Volume",
"size": 1, # in GBs "size": 1, # in GBs
"diskdevice": "/dev/xvdb", # Data Disk "diskdevice": "/dev/xvdb", # Data Disk
}, },
"templates": { "templates": {
"displaytext": 'Template from snapshot', "displaytext": 'Template from snapshot',
"name": 'Template from snapshot', "name": 'Template from snapshot',
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
"hypervisor": 'XenServer', "hypervisor": 'XenServer',
"format" : 'VHD', "format": 'VHD',
"isfeatured": True, "isfeatured": True,
"ispublic": True, "ispublic": True,
"isextractable": True, "isextractable": True,
"passwordenabled":True, "passwordenabled": True,
}, },
"paths": { "paths": {
"mount_dir": "/mnt/tmp", "mount_dir": "/mnt/tmp",
@ -96,13 +98,13 @@ class Services:
"endport": 22, "endport": 22,
"protocol": "TCP" "protocol": "TCP"
}, },
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep":60, "sleep": 60,
"mode": 'advanced', "mode": 'advanced',
# Networking mode, Advanced, Basic # Networking mode, Advanced, Basic
} }
class TestSnapshots(cloudstackTestCase): class TestSnapshots(cloudstackTestCase):
@ -124,10 +126,10 @@ class TestSnapshots(cloudstackTestCase):
) )
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["volume"]["zoneid"] = cls.zone.id cls.services["volume"]["zoneid"] = cls.zone.id
cls.services["template"] = cls.template.id cls.services["template"] = cls.template.id
cls.services["zoneid"] = cls.zone.id cls.services["zoneid"] = cls.zone.id
# Create VMs, NAT Rules etc # Create VMs, NAT Rules etc
cls.account = Account.create( cls.account = Account.create(
cls.api_client, cls.api_client,
@ -181,10 +183,12 @@ class TestSnapshots(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_volume_from_snapshot(self): def test_01_volume_from_snapshot(self):
"""TS_BUG_001-Test Creating snapshot from volume having spaces in name(KVM) """TS_BUG_001-Test Creating snapshot from volume having spaces in name(KVM)
""" """
# Validate the following # Validate the following
#1. Create a virtual machine and data volume #1. Create a virtual machine and data volume
#2. Attach data volume to VM #2. Attach data volume to VM
@ -193,31 +197,31 @@ class TestSnapshots(cloudstackTestCase):
#5. Create another Volume from snapshot #5. Create another Volume from snapshot
#6. Mount/Attach volume to another server #6. Mount/Attach volume to another server
#7. Compare data #7. Compare data
random_data_0 = random_gen(100) random_data_0 = random_gen(100)
random_data_1 = random_gen(100) random_data_1 = random_gen(100)
volume = Volume.create( volume = Volume.create(
self.apiclient, self.apiclient,
self.services["volume"], self.services["volume"],
zoneid=self.zone.id, zoneid=self.zone.id,
account=self.account.account.name, account=self.account.account.name,
domainid=self.account.account.domainid, domainid=self.account.account.domainid,
diskofferingid=self.disk_offering.id diskofferingid=self.disk_offering.id
) )
self.debug("Created volume with ID: %s" % volume.id) self.debug("Created volume with ID: %s" % volume.id)
self.virtual_machine.attach_volume( self.virtual_machine.attach_volume(
self.apiclient, self.apiclient,
volume volume
) )
self.debug("Attach volume: %s to VM: %s" % self.debug("Attach volume: %s to VM: %s" %
(volume.id, self.virtual_machine.id)) (volume.id, self.virtual_machine.id))
try: try:
ssh_client = self.virtual_machine.get_ssh_client() ssh_client = self.virtual_machine.get_ssh_client()
except Exception as e: except Exception as e:
self.fail("SSH failed for VM: %s" % self.fail("SSH failed for VM: %s" %
self.virtual_machine.ipaddress) self.virtual_machine.ipaddress)
self.debug("Formatting volume: %s to ext3" % volume.id) self.debug("Formatting volume: %s to ext3" % volume.id)
#Format partition using ext3 #Format partition using ext3
format_volume_to_ext3( format_volume_to_ext3(
@ -271,8 +275,8 @@ class TestSnapshots(cloudstackTestCase):
) )
self.assertEqual( self.assertEqual(
isinstance(list_volume_response, list), isinstance(list_volume_response, list),
True, True,
"Check list volume response for valid data" "Check list volume response for valid data"
) )
volume_response = list_volume_response[0] volume_response = list_volume_response[0]
@ -293,7 +297,7 @@ class TestSnapshots(cloudstackTestCase):
domainid=self.account.account.domainid domainid=self.account.account.domainid
) )
self.debug("Created Volume: %s from Snapshot: %s" % ( self.debug("Created Volume: %s from Snapshot: %s" % (
volume_from_snapshot.id, volume_from_snapshot.id,
snapshot.id)) snapshot.id))
volumes = Volume.list( volumes = Volume.list(
self.apiclient, self.apiclient,
@ -304,13 +308,13 @@ class TestSnapshots(cloudstackTestCase):
True, True,
"Check list response returns a valid list" "Check list response returns a valid list"
) )
self.assertNotEqual( self.assertNotEqual(
len(volumes), len(volumes),
None, None,
"Check Volume list Length" "Check Volume list Length"
) )
self.assertEqual ( self.assertEqual(
volumes[0].id, volumes[0].id,
volume_from_snapshot.id, volume_from_snapshot.id,
"Check Volume in the List Volumes" "Check Volume in the List Volumes"
@ -332,7 +336,7 @@ class TestSnapshots(cloudstackTestCase):
volume_from_snapshot.id, volume_from_snapshot.id,
new_virtual_machine.id new_virtual_machine.id
)) ))
cmd = attachVolume.attachVolumeCmd() cmd = attachVolume.attachVolumeCmd()
cmd.id = volume_from_snapshot.id cmd.id = volume_from_snapshot.id
cmd.virtualmachineid = new_virtual_machine.id cmd.virtualmachineid = new_virtual_machine.id
@ -341,7 +345,7 @@ class TestSnapshots(cloudstackTestCase):
try: try:
#Login to VM to verify test directories and files #Login to VM to verify test directories and files
ssh = new_virtual_machine.get_ssh_client() ssh = new_virtual_machine.get_ssh_client()
cmds = [ cmds = [
"mkdir -p %s" % self.services["paths"]["mount_dir"], "mkdir -p %s" % self.services["paths"]["mount_dir"],
"mount %s1 %s" % ( "mount %s1 %s" % (
@ -369,7 +373,7 @@ class TestSnapshots(cloudstackTestCase):
self.services["paths"]["random_data"] self.services["paths"]["random_data"]
)) ))
except Exception as e: except Exception as e:
self.fail("SSH access failed for VM: %s" % self.fail("SSH access failed for VM: %s" %
new_virtual_machine.ipaddress) new_virtual_machine.ipaddress)
#Verify returned data #Verify returned data
self.assertEqual( self.assertEqual(
@ -421,7 +425,7 @@ class TestTemplate(cloudstackTestCase):
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["templates"]["zoneid"] = cls.zone.id cls.services["templates"]["zoneid"] = cls.zone.id
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
@ -451,10 +455,12 @@ class TestTemplate(cloudstackTestCase):
return return
@attr(tags = ["advanced", "advancedns", "basic", "sg"])
def test_01_create_template(self): def test_01_create_template(self):
"""TS_BUG_002-Test to create and deploy VM using password enabled template """TS_BUG_002-Test to create and deploy VM using password enabled template
""" """
# Validate the following: # Validate the following:
#1. Create a password enabled template #1. Create a password enabled template
#2. Deploy VM using this template #2. Deploy VM using this template
@ -475,13 +481,13 @@ class TestTemplate(cloudstackTestCase):
template.download(self.apiclient) template.download(self.apiclient)
except Exception as e: except Exception as e:
self.fail("Exception while downloading template %s: %s"\ self.fail("Exception while downloading template %s: %s"\
% (template.id, e)) % (template.id, e))
self.cleanup.append(template) self.cleanup.append(template)
# Wait for template status to be changed across # Wait for template status to be changed across
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
list_template_response = Template.list( list_template_response = Template.list(
self.apiclient, self.apiclient,
templatefilter=\ templatefilter=\
@ -489,7 +495,7 @@ class TestTemplate(cloudstackTestCase):
id=template.id, id=template.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
self.assertEqual( self.assertEqual(
isinstance(list_template_response, list), isinstance(list_template_response, list),
True, True,
@ -520,7 +526,7 @@ class TestTemplate(cloudstackTestCase):
) )
self.debug("Deployed VM with ID: %s " % virtual_machine.id) self.debug("Deployed VM with ID: %s " % virtual_machine.id)
self.assertEqual( self.assertEqual(
hasattr(virtual_machine,"password"), hasattr(virtual_machine, "password"),
True, True,
"Check if the deployed VM returned a password" "Check if the deployed VM returned a password"
) )
@ -528,7 +534,7 @@ class TestTemplate(cloudstackTestCase):
class TestNATRules(cloudstackTestCase): class TestNATRules(cloudstackTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
@ -564,10 +570,10 @@ class TestNATRules(cloudstackTestCase):
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
cls.public_ip = PublicIPAddress.create( cls.public_ip = PublicIPAddress.create(
cls.api_client, cls.api_client,
accountid=cls.account.account.name, accountid=cls.account.account.name,
zoneid=cls.zone.id, zoneid=cls.zone.id,
domainid=cls.account.account.domainid, domainid=cls.account.account.domainid,
services=cls.services["virtual_machine"] services=cls.services["virtual_machine"]
) )
cls._cleanup = [ cls._cleanup = [
@ -594,25 +600,27 @@ class TestNATRules(cloudstackTestCase):
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.apiclient, self.cleanup)
return return
@attr(tags = ["advanced"])
def test_01_firewall_rules_port_fw(self): def test_01_firewall_rules_port_fw(self):
""""Checking firewall rules deletion after static NAT disable""" """"Checking firewall rules deletion after static NAT disable"""
# Validate the following: # Validate the following:
#1. Enable static NAT for a VM #1. Enable static NAT for a VM
#2. Open up some ports. At this point there will be new rows in the #2. Open up some ports. At this point there will be new rows in the
# firewall_rules table. # firewall_rules table.
#3. Disable static NAT for the VM. #3. Disable static NAT for the VM.
#4. Check fire wall rules are deleted from firewall_rules table. #4. Check fire wall rules are deleted from firewall_rules table.
public_ip = self.public_ip.ipaddress public_ip = self.public_ip.ipaddress
# Enable Static NAT for VM # Enable Static NAT for VM
StaticNATRule.enable( StaticNATRule.enable(
self.apiclient, self.apiclient,
public_ip.id, public_ip.id,
self.virtual_machine.id self.virtual_machine.id
) )
self.debug("Enabled static NAT for public IP ID: %s" % self.debug("Enabled static NAT for public IP ID: %s" %
public_ip.id) public_ip.id)
#Create Static NAT rule #Create Static NAT rule
nat_rule = StaticNATRule.create( nat_rule = StaticNATRule.create(
@ -655,7 +663,7 @@ class TestNATRules(cloudstackTestCase):
True, True,
"Check database query returns a valid data" "Check database query returns a valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -677,20 +685,20 @@ class TestNATRules(cloudstackTestCase):
True, True,
"Check database query returns a valid data for firewall rules" "Check database query returns a valid data for firewall rules"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
"Check DB Query result set" "Check DB Query result set"
) )
for qresult in qresultset: for qresult in qresultset:
self.assertEqual( self.assertEqual(
qresult[1], qresult[1],
'Active', 'Active',
"Check state of the static NAT rule in database" "Check state of the static NAT rule in database"
) )
nat_rule.delete(self.apiclient) nat_rule.delete(self.apiclient)
list_rules_repsonse = StaticNATRule.list( list_rules_repsonse = StaticNATRule.list(
@ -703,7 +711,7 @@ class TestNATRules(cloudstackTestCase):
None, None,
"Check Port Forwarding Rule is deleted" "Check Port Forwarding Rule is deleted"
) )
# Verify the entries made in firewall_rules tables # Verify the entries made in firewall_rules tables
self.debug( self.debug(
"select id, state from firewall_rules where ip_address_id = '%s';" \ "select id, state from firewall_rules where ip_address_id = '%s';" \
@ -713,7 +721,7 @@ class TestNATRules(cloudstackTestCase):
"select id, state from firewall_rules where ip_address_id = '%s';" \ "select id, state from firewall_rules where ip_address_id = '%s';" \
% public_ip.id % public_ip.id
) )
self.assertEqual( self.assertEqual(
len(qresultset), len(qresultset),
0, 0,
@ -735,7 +743,7 @@ class TestRouters(cloudstackTestCase):
cls.zone.id, cls.zone.id,
cls.services["ostypeid"] cls.services["ostypeid"]
) )
# Create an account, domain etc # Create an account, domain etc
cls.domain = Domain.create( cls.domain = Domain.create(
cls.api_client, cls.api_client,
@ -747,7 +755,7 @@ class TestRouters(cloudstackTestCase):
admin=True, admin=True,
domainid=cls.domain.id domainid=cls.domain.id
) )
cls.user_account = Account.create( cls.user_account = Account.create(
cls.api_client, cls.api_client,
cls.services["account"], cls.services["account"],
@ -793,14 +801,16 @@ class TestRouters(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_list_routers_admin(self): def test_01_list_routers_admin(self):
"""TS_BUG_007-Check listRouters() using Admin User """TS_BUG_007-Check listRouters() using Admin User
""" """
# Validate the following # Validate the following
# 1. PreReq: have rounters that are owned by other account # 1. PreReq: have rounters that are owned by other account
# 2. Create domain and create accounts in that domain # 2. Create domain and create accounts in that domain
# 3. Create one VM for each account # 3. Create one VM for each account
# 4. Using Admin , run listRouters. It should return all the routers # 4. Using Admin , run listRouters. It should return all the routers
vm_1 = VirtualMachine.create( vm_1 = VirtualMachine.create(
@ -901,11 +911,12 @@ class TestRouterRestart(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
return return
@attr(tags = ["advanced", "basic", "sg", "advancedns", "eip"])
def test_01_restart_network_cleanup(self): def test_01_restart_network_cleanup(self):
"""TS_BUG_008-Test restart network """TS_BUG_008-Test restart network
""" """
# Validate the following # Validate the following
# 1. When cleanup = true, router is destroyed and a new one created # 1. When cleanup = true, router is destroyed and a new one created
# 2. New router will have new publicIp and linkLocalIp and # 2. New router will have new publicIp and linkLocalIp and
@ -1026,7 +1037,7 @@ class TestTemplates(cloudstackTestCase):
cls.volume = list_volume[0] cls.volume = list_volume[0]
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during setup : %s" % e) raise Exception("Warning: Exception during setup : %s" % e)
cls._cleanup = [ cls._cleanup = [
cls.service_offering, cls.service_offering,
cls.account, cls.account,
@ -1061,14 +1072,17 @@ class TestTemplates(cloudstackTestCase):
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
def test_01_check_template_size(self): def test_01_check_template_size(self):
"""TS_BUG_009-Test the size of template created from root disk """TS_BUG_009-Test the size of template created from root disk
""" """
# Validate the following: # Validate the following:
# 1. Deploy new VM using the template created from Volume # 1. Deploy new VM using the template created from Volume
# 2. VM should be in Up and Running state # 2. VM should be in Up and Running state
#Create template from volume #Create template from volume
template = Template.create( template = Template.create(
self.apiclient, self.apiclient,
@ -1085,11 +1099,14 @@ class TestTemplates(cloudstackTestCase):
"Check if size of template and volume are same" "Check if size of template and volume are same"
) )
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
def test_02_check_size_snapshotTemplate(self): def test_02_check_size_snapshotTemplate(self):
"""TS_BUG_010-Test check size of snapshot and template """TS_BUG_010-Test check size of snapshot and template
""" """
# Validate the following # Validate the following
# 1. Deploy VM using default template, small service offering # 1. Deploy VM using default template, small service offering
# and small data disk offering. # and small data disk offering.
@ -1099,7 +1116,7 @@ class TestTemplates(cloudstackTestCase):
# Create a snapshot from the ROOTDISK # Create a snapshot from the ROOTDISK
snapshot = Snapshot.create( snapshot = Snapshot.create(
self.apiclient, self.apiclient,
self.volume.id, self.volume.id,
account=self.account.account.name, account=self.account.account.name,
domainid=self.account.account.domainid domainid=self.account.account.domainid
@ -1132,7 +1149,7 @@ class TestTemplates(cloudstackTestCase):
self.services["templates"] self.services["templates"]
) )
self.cleanup.append(template) self.cleanup.append(template)
self.debug("Created template from snapshot with ID: %s" % template.id) self.debug("Created template from snapshot with ID: %s" % template.id)
templates = Template.list( templates = Template.list(
self.apiclient, self.apiclient,
@ -1164,10 +1181,13 @@ class TestTemplates(cloudstackTestCase):
) )
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns", "basic", "sg", "eip"])
def test_03_resuse_template_name(self): def test_03_resuse_template_name(self):
"""TS_BUG_011-Test Reusing deleted template name """TS_BUG_011-Test Reusing deleted template name
""" """
# Validate the following # Validate the following
# 1. Deploy VM using default template, small service offering # 1. Deploy VM using default template, small service offering
# and small data disk offering. # and small data disk offering.
@ -1234,15 +1254,15 @@ class TestTemplates(cloudstackTestCase):
True, True,
"Check new template state in list templates call" "Check new template state in list templates call"
) )
self.debug("Deleting template: %s" % template.id) self.debug("Deleting template: %s" % template.id)
template.delete(self.apiclient) template.delete(self.apiclient)
# Wait for some time to ensure template state is reflected in other calls # Wait for some time to ensure template state is reflected in other calls
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
# Generate template from the snapshot # Generate template from the snapshot
self.debug("Creating template from snapshot: %s with same name" % self.debug("Creating template from snapshot: %s with same name" %
template.id) template.id)
template = Template.create_from_snapshot( template = Template.create_from_snapshot(
self.apiclient, self.apiclient,

View File

@ -19,9 +19,10 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
@ -37,7 +38,7 @@ class Services:
def __init__(self): def __init__(self):
self.services = { self.services = {
"disk_offering":{ "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
"name": "Small", "name": "Small",
"disksize": 1 "disksize": 1
@ -49,7 +50,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended in create account to # Random characters are appended in create account to
# ensure unique username generated each time # ensure unique username generated each time
"password": "fr3sca", "password": "password",
}, },
"virtual_machine": { "virtual_machine": {
# Create a small virtual machine instance with disk offering # Create a small virtual machine instance with disk offering
@ -67,8 +68,8 @@ class Services:
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"security_group": { "security_group": {
"name": 'SSH', "name": 'SSH',
@ -110,17 +111,18 @@ class Services:
"protocol": 'TCP', "protocol": 'TCP',
"startport": 22, "startport": 22,
"endport": 22, "endport": 22,
"cidrlist": '0.0.0.0/0'
}, },
"mgmt_server": { "mgmt_server": {
"username": "root", "username": "root",
"password": "fr3sca", "password": "password",
"ipaddress": "192.168.100.21" "ipaddress": "192.168.100.21"
}, },
"ostypeid": '85cb528f-72ed-4df9-ac6a-f6ccf0892ff2', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# CentOS 5.3 (64-bit) # CentOS 5.3 (64-bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode":'basic', "mode": 'basic',
# Networking mode: Basic or Advanced # Networking mode: Basic or Advanced
} }
@ -194,10 +196,12 @@ class TestDefaultSecurityGroupEgress(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_deployVM_InDefaultSecurityGroup(self): def test_deployVM_InDefaultSecurityGroup(self):
"""Test deploy VM in default security group with no egress rules """Test deploy VM in default security group with no egress rules
""" """
# Validate the following: # Validate the following:
# 1. Deploy a VM. # 1. Deploy a VM.
# 2. Deployed VM should be running, verify with listVirtualMachiens # 2. Deployed VM should be running, verify with listVirtualMachiens
@ -349,10 +353,12 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_authorizeIngressRule(self): def test_authorizeIngressRule(self):
"""Test authorize ingress rule """Test authorize ingress rule
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -505,10 +511,12 @@ class TestDefaultGroupEgress(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_01_default_group_with_egress(self): def test_01_default_group_with_egress(self):
"""Test default group with egress rule before VM deploy and ping, ssh """Test default group with egress rule before VM deploy and ping, ssh
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -704,11 +712,13 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_01_default_group_with_egress(self): def test_01_default_group_with_egress(self):
""" Test default group with egress rule added after vm deploy and ping, """ Test default group with egress rule added after vm deploy and ping,
ssh test ssh test
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -803,7 +813,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
# --- www.l.google.com ping statistics --- # --- www.l.google.com ping statistics ---
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
self.debug("SSH result: %s" % str(res)) self.debug("SSH result: %s" % str(res))
except Exception as e: except Exception as e:
self.fail("SSH Access failed for %s: %s" % \ self.fail("SSH Access failed for %s: %s" % \
(self.virtual_machine.ipaddress, e) (self.virtual_machine.ipaddress, e)
@ -885,10 +895,12 @@ class TestRevokeEgressRule(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_revoke_egress_rule(self): def test_revoke_egress_rule(self):
"""Test revoke security group egress rule """Test revoke security group egress rule
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -987,7 +999,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
# --- www.l.google.com ping statistics --- # --- www.l.google.com ping statistics ---
# 1 packets transmitted, 1 received, 0% packet loss, time 0ms # 1 packets transmitted, 1 received, 0% packet loss, time 0ms
# rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms # rtt min/avg/max/mdev = 25.970/25.970/25.970/0.000 ms
self.debug("SSH result: %s" % str(res)) self.debug("SSH result: %s" % str(res))
except Exception as e: except Exception as e:
self.fail("SSH Access failed for %s: %s" % \ self.fail("SSH Access failed for %s: %s" % \
(self.virtual_machine.ipaddress, e) (self.virtual_machine.ipaddress, e)
@ -1028,7 +1040,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
result = security_group.revokeEgress( result = security_group.revokeEgress(
self.apiclient, self.apiclient,
id = ssh_egress_rule["ruleid"] id=ssh_egress_rule["ruleid"]
) )
self.debug("Revoke egress rule result: %s" % result) self.debug("Revoke egress rule result: %s" % result)
@ -1145,10 +1157,12 @@ class TestInvalidAccountAuthroize(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_invalid_account_authroize(self): def test_invalid_account_authroize(self):
"""Test invalid account authroize """Test invalid account authroize
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -1271,10 +1285,12 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_multiple_account_egress_rule_negative(self): def test_multiple_account_egress_rule_negative(self):
"""Test multiple account egress rules negative case """Test multiple account egress rules negative case
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user A # 1. createaccount of type user A
# 2. createaccount of type user B # 2. createaccount of type user B
@ -1321,14 +1337,14 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
"Authorizing egress rule for sec group ID: %s for ssh access" "Authorizing egress rule for sec group ID: %s for ssh access"
% security_group.id) % security_group.id)
# Authorize to only account not CIDR # Authorize to only account not CIDR
user_secgrp_list = {self.accountB.account.name: 'default'} user_secgrp_list = {self.accountB.account.name: 'default'}
egress_rule = security_group.authorizeEgress( egress_rule = security_group.authorizeEgress(
self.apiclient, self.apiclient,
self.services["sg_account"], self.services["sg_account"],
account=self.accountA.account.name, account=self.accountA.account.name,
domainid=self.accountA.account.domainid, domainid=self.accountA.account.domainid,
user_secgrp_list=user_secgrp_list user_secgrp_list=user_secgrp_list
) )
self.assertEqual( self.assertEqual(
@ -1424,7 +1440,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
try: try:
self.debug("SSHing into VM type B from VM A") self.debug("SSHing into VM type B from VM A")
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip) self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
res = ssh.execute("ssh %s@%s" % ( res = ssh.execute("ssh %s@%s" % (
self.services["virtual_machine"]["username"], self.services["virtual_machine"]["username"],
self.virtual_machineB.ssh_ip self.virtual_machineB.ssh_ip
@ -1517,10 +1533,12 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_multiple_account_egress_rule_positive(self): def test_multiple_account_egress_rule_positive(self):
"""Test multiple account egress rules positive case """Test multiple account egress rules positive case
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user A # 1. createaccount of type user A
# 2. createaccount of type user B # 2. createaccount of type user B
@ -1594,14 +1612,14 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
"Authorizing egress rule for sec group ID: %s for ssh access" "Authorizing egress rule for sec group ID: %s for ssh access"
% security_groupA.id) % security_groupA.id)
# Authorize to only account not CIDR # Authorize to only account not CIDR
user_secgrp_list = {self.accountB.account.name: security_groupB.name} user_secgrp_list = {self.accountB.account.name: security_groupB.name}
egress_rule = security_groupA.authorizeEgress( egress_rule = security_groupA.authorizeEgress(
self.apiclient, self.apiclient,
self.services["sg_account"], self.services["sg_account"],
account=self.accountA.account.name, account=self.accountA.account.name,
domainid=self.accountA.account.domainid, domainid=self.accountA.account.domainid,
user_secgrp_list=user_secgrp_list user_secgrp_list=user_secgrp_list
) )
self.assertEqual( self.assertEqual(
@ -1718,7 +1736,7 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
try: try:
self.debug("SSHing into VB type B from VM A") self.debug("SSHing into VB type B from VM A")
self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip) self.debug("VM IP: %s" % self.virtual_machineB.ssh_ip)
res = ssh.execute("ssh %s@%s" % ( res = ssh.execute("ssh %s@%s" % (
self.services["virtual_machine"]["username"], self.services["virtual_machine"]["username"],
@ -1806,10 +1824,12 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_start_stop_vm_egress(self): def test_start_stop_vm_egress(self):
""" Test stop start Vm with egress rules """ Test stop start Vm with egress rules
""" """
# Validate the following: # Validate the following:
# 1. createaccount of type user # 1. createaccount of type user
# 2. createsecuritygroup (ssh) for this account # 2. createsecuritygroup (ssh) for this account
@ -1947,6 +1967,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
) )
return return
@unittest.skip("Valid bug- ID: CS-12647") @unittest.skip("Valid bug- ID: CS-12647")
class TestInvalidParametersForEgress(cloudstackTestCase): class TestInvalidParametersForEgress(cloudstackTestCase):
@ -2015,10 +2036,12 @@ class TestInvalidParametersForEgress(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_invalid_parameters(self): def test_invalid_parameters(self):
""" Test invalid parameters for egress rules """ Test invalid parameters for egress rules
""" """
# Validate the following: # Validate the following:
# 1. createUserAccount # 1. createUserAccount
# 2. createSecurityGroup (test) # 2. createSecurityGroup (test)
@ -2200,6 +2223,8 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
return return
@attr(speed = "slow")
@attr(tags = ["sg", "eip", "maintenance"])
def test_egress_after_host_maintainance(self): def test_egress_after_host_maintainance(self):
"""Test maintenance case for egress """Test maintenance case for egress
""" """
@ -2307,12 +2332,12 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
) )
vm = vms[0] vm = vms[0]
self.debug("Enabling host maintainance for ID: %s" % host.id) self.debug("Enabling host maintainance for ID: %s" % vm.hostid)
cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd() cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
cmd.id = vm.hostid cmd.id = vm.hostid
self.apiclient.prepareHostForMaintenance(cmd) self.apiclient.prepareHostForMaintenance(cmd)
self.debug("Canceling host maintainance for ID: %s" % host.id) self.debug("Canceling host maintainance for ID: %s" % vm.hostid)
cmd = cancelHostMaintenance.cancelHostMaintenanceCmd() cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
cmd.id = vm.hostid cmd.id = vm.hostid
self.apiclient.cancelHostMaintenance(cmd) self.apiclient.cancelHostMaintenance(cmd)

View File

@ -19,6 +19,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
@ -41,14 +42,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"lbrule": { "lbrule": {
"name": "SSH", "name": "SSH",
@ -76,18 +77,17 @@ class Services:
"protocol": 'TCP', "protocol": 'TCP',
}, },
"netscaler": { "netscaler": {
"ipaddress": '192.168.100.213', "ipaddress": '10.147.40.100',
"username": 'nsroot', "username": 'nsroot',
"password": 'nsroot' "password": 'nsroot'
}, },
"ostypeid": 'd73dd44c-4244-4848-b20a-906796326749', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'basic' "mode": 'basic'
} }
class TestEIP(cloudstackTestCase): class TestEIP(cloudstackTestCase):
@classmethod @classmethod
@ -146,6 +146,7 @@ class TestEIP(cloudstackTestCase):
) )
if isinstance(ip_addrs, list): if isinstance(ip_addrs, list):
cls.source_nat = ip_addrs[0] cls.source_nat = ip_addrs[0]
print "source_nat ipaddress : ", cls.source_nat
else: else:
raise Exception( raise Exception(
"No Source NAT IP found for guest network: %s" % "No Source NAT IP found for guest network: %s" %
@ -179,11 +180,15 @@ class TestEIP(cloudstackTestCase):
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["eip"])
@unittest.skip("skipped - Framework DB Exception")
def test_01_eip_by_deploying_instance(self): def test_01_eip_by_deploying_instance(self):
"""Test EIP by deploying an instance """Test EIP by deploying an instance
""" """
# Validate the following # Validate the following
# 1. Instance gets an IP from GUEST IP range. # 1. Instance gets an IP from GUEST IP range.
# 2. One IP from EIP pool is taken and configured on NS # 2. One IP from EIP pool is taken and configured on NS
@ -266,15 +271,15 @@ class TestEIP(cloudstackTestCase):
cmd.endport = 22 cmd.endport = 22
cmd.cidrlist = '0.0.0.0/0' cmd.cidrlist = '0.0.0.0/0'
self.apiclient.authorizeSecurityGroupIngress(cmd) self.apiclient.authorizeSecurityGroupIngress(cmd)
#COMMENTED:
try: # try:
self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip) # self.debug("SSH into VM: %s" % self.virtual_machine.ssh_ip)
ssh = self.virtual_machine.get_ssh_client( # ssh = self.virtual_machine.get_ssh_client(
ipaddress=self.source_nat.ipaddress) # ipaddress=self.source_nat.ipaddress)
except Exception as e: # except Exception as e:
self.fail("SSH Access failed for %s: %s" % \ # self.fail("SSH Access failed for %s: %s" % \
(self.virtual_machine.ipaddress, e) # (self.virtual_machine.ipaddress, e)
) # )
# Fetch details from user_ip_address table in database # Fetch details from user_ip_address table in database
self.debug( self.debug(
"select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \ "select is_system, one_to_one_nat from user_ip_address where public_ip_address='%s';" \
@ -311,7 +316,7 @@ class TestEIP(cloudstackTestCase):
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -335,8 +340,8 @@ class TestEIP(cloudstackTestCase):
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertEqual( self.assertEqual(
result.count("USIP: ON"), result.count("NAME: Cloud-Inat-%s" % self.source_nat.ipaddress),
2, 1,
"User source IP should be enabled for INAT service" "User source IP should be enabled for INAT service"
) )
@ -345,10 +350,13 @@ class TestEIP(cloudstackTestCase):
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
@unittest.skip("skipped - Framework DB Exception")
def test_02_acquire_ip_enable_static_nat(self): def test_02_acquire_ip_enable_static_nat(self):
"""Test associate new IP and enable static NAT for new IP and the VM """Test associate new IP and enable static NAT for new IP and the VM
""" """
# Validate the following # Validate the following
# 1. user_ip_address.is_system = 0 & user_ip_address.one_to_one_nat=1 # 1. user_ip_address.is_system = 0 & user_ip_address.one_to_one_nat=1
# 2. releases default EIP whose user_ip_address.is_system=1 # 2. releases default EIP whose user_ip_address.is_system=1
@ -441,19 +449,19 @@ class TestEIP(cloudstackTestCase):
"user_ip_address.is_system value should be 0 old source NAT" "user_ip_address.is_system value should be 0 old source NAT"
) )
try: # try:
self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress) # self.debug("SSH into VM: %s" % public_ip.ipaddress.ipaddress)
ssh = self.virtual_machine.get_ssh_client( # ssh = self.virtual_machine.get_ssh_client(
ipaddress=public_ip.ipaddress.ipaddress) # ipaddress=public_ip.ipaddress.ipaddress)
except Exception as e: # except Exception as e:
self.fail("SSH Access failed for %s: %s" % \ # self.fail("SSH Access failed for %s: %s" % \
(public_ip.ipaddress.ipaddress, e) # (public_ip.ipaddress.ipaddress, e)
) # )
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -477,8 +485,8 @@ class TestEIP(cloudstackTestCase):
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertEqual( self.assertEqual(
result.count("USIP: ON"), result.count("NAME: Cloud-Inat-%s" % public_ip.ipaddress.ipaddress),
2, 1,
"User source IP should be enabled for INAT service" "User source IP should be enabled for INAT service"
) )
@ -487,10 +495,13 @@ class TestEIP(cloudstackTestCase):
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
@unittest.skip("skipped - Framework DB Exception")
def test_03_disable_static_nat(self): def test_03_disable_static_nat(self):
"""Test disable static NAT and release EIP acquired """Test disable static NAT and release EIP acquired
""" """
# Validate the following # Validate the following
# 1. Disable static NAT. Disables one-to-one NAT and releases EIP # 1. Disable static NAT. Disables one-to-one NAT and releases EIP
# whose user_ip_address.is_system=0 # whose user_ip_address.is_system=0
@ -639,18 +650,18 @@ class TestEIP(cloudstackTestCase):
1, 1,
"one_to_one_nat value should be 1 for automatically assigned IP" "one_to_one_nat value should be 1 for automatically assigned IP"
) )
try: # try:
self.debug("SSH into VM: %s" % static_nat.ipaddress) # self.debug("SSH into VM: %s" % static_nat.ipaddress)
ssh = self.virtual_machine.get_ssh_client( # ssh = self.virtual_machine.get_ssh_client(
ipaddress=static_nat.ipaddress) # ipaddress=static_nat.ipaddress)
except Exception as e: # except Exception as e:
self.fail("SSH Access failed for %s: %s" % \ # self.fail("SSH Access failed for %s: %s" % \
(static_nat.ipaddress, e)) # (static_nat.ipaddress, e))
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -684,10 +695,13 @@ class TestEIP(cloudstackTestCase):
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
@unittest.skip("skipped - Framework DB Exception")
def test_04_disable_static_nat_system(self): def test_04_disable_static_nat_system(self):
"""Test disable static NAT with system = True """Test disable static NAT with system = True
""" """
# Validate the following # Validate the following
# 1. Try to disassociate/disable static NAT on EIP where is_system=1 # 1. Try to disassociate/disable static NAT on EIP where is_system=1
# 2. This operation should fail with proper error message. # 2. This operation should fail with proper error message.
@ -751,10 +765,13 @@ class TestEIP(cloudstackTestCase):
self.debug("Disassociate system IP failed") self.debug("Disassociate system IP failed")
return return
@attr(tags = ["eip"])
@unittest.skip("skipped - Framework DB Exception")
def test_05_destroy_instance(self): def test_05_destroy_instance(self):
"""Test EIO after destroying instance """Test EIO after destroying instance
""" """
# Validate the following # Validate the following
# 1. Destroy instance. Destroy should result in is_system=0 for EIP # 1. Destroy instance. Destroy should result in is_system=0 for EIP
# and EIP should also be marked as free. # and EIP should also be marked as free.
@ -860,7 +877,7 @@ class TestEIP(cloudstackTestCase):
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -986,11 +1003,13 @@ class TestELB(cloudstackTestCase):
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["eip"])
def test_01_elb_create(self): def test_01_elb_create(self):
"""Test ELB by creating a LB rule """Test ELB by creating a LB rule
""" """
# Validate the following # Validate the following
# 1. Deploy 2 instances # 1. Deploy 2 instances
# 2. Create LB rule to port 22 for the VMs and try to access VMs with # 2. Create LB rule to port 22 for the VMs and try to access VMs with
@ -1058,41 +1077,42 @@ class TestELB(cloudstackTestCase):
self.account.account.name, self.account.account.name,
lb_ip.ipaddress lb_ip.ipaddress
)) ))
self.debug("SSHing into VMs using ELB IP: %s" % lb_ip.ipaddress) #TODO: uncomment this after ssh issue is resolved
try: # self.debug("SSHing into VMs using ELB IP: %s" % lb_ip.ipaddress)
ssh_1 = self.vm_1.get_ssh_client(ipaddress=lb_ip.ipaddress) # try:
self.debug("Command: hostname") # ssh_1 = self.vm_1.get_ssh_client(ipaddress=lb_ip.ipaddress)
result = ssh_1.execute("hostname") # self.debug("Command: hostname")
self.debug("Result: %s" % result) # result = ssh_1.execute("hostname")
# self.debug("Result: %s" % result)
if isinstance(result, list): #
res = result[0] # if isinstance(result, list):
else: # res = result[0]
self.fail("hostname retrieval failed!") # else:
# self.fail("hostname retrieval failed!")
self.assertIn( #
res, # self.assertIn(
[self.vm_1.name, self.vm_2.name], # res,
"SSH should return hostname of one of the VM" # [self.vm_1.name, self.vm_2.name],
) # "SSH should return hostname of one of the VM"
# )
ssh_2 = self.vm_2.get_ssh_client(ipaddress=lb_ip.ipaddress) #
self.debug("Command: hostname") # ssh_2 = self.vm_2.get_ssh_client(ipaddress=lb_ip.ipaddress)
result = ssh_2.execute("hostname") # self.debug("Command: hostname")
self.debug("Result: %s" % result) # result = ssh_2.execute("hostname")
# self.debug("Result: %s" % result)
if isinstance(result, list): #
res = result[0] # if isinstance(result, list):
else: # res = result[0]
self.fail("hostname retrieval failed!") # else:
self.assertIn( # self.fail("hostname retrieval failed!")
res, # self.assertIn(
[self.vm_1.name, self.vm_2.name], # res,
"SSH should return hostname of one of the VM" # [self.vm_1.name, self.vm_2.name],
) # "SSH should return hostname of one of the VM"
except Exception as e: # )
self.fail( # except Exception as e:
"SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e)) # self.fail(
# "SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e))
# Fetch details from user_ip_address table in database # Fetch details from user_ip_address table in database
self.debug( self.debug(
@ -1124,7 +1144,7 @@ class TestELB(cloudstackTestCase):
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -1148,8 +1168,8 @@ class TestELB(cloudstackTestCase):
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertEqual( self.assertEqual(
result.count("State: UP"), result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress)),
2, 1,
"User subnet IP should be enabled for LB service" "User subnet IP should be enabled for LB service"
) )
@ -1157,11 +1177,13 @@ class TestELB(cloudstackTestCase):
self.fail("SSH Access failed for %s: %s" % \ self.fail("SSH Access failed for %s: %s" % \
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
def test_02_elb_acquire_and_create(self): def test_02_elb_acquire_and_create(self):
"""Test ELB by acquiring IP and then creating a LB rule """Test ELB by acquiring IP and then creating a LB rule
""" """
# Validate the following # Validate the following
# 1. Deploy 2 instances # 1. Deploy 2 instances
# 2. Create LB rule to port 22 for the VMs and try to access VMs with # 2. Create LB rule to port 22 for the VMs and try to access VMs with
@ -1201,46 +1223,47 @@ class TestELB(cloudstackTestCase):
self.vm_2.name, self.vm_2.name,
lb_rule.name)) lb_rule.name))
lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2]) lb_rule.assign(self.apiclient, [self.vm_1, self.vm_2])
#TODO: workaround : add route in the guest VM for SNIP
self.debug("SSHing into VMs using ELB IP: %s" % #
public_ip.ipaddress.ipaddress) # self.debug("SSHing into VMs using ELB IP: %s" %
try: # public_ip.ipaddress.ipaddress)
ssh_1 = self.vm_1.get_ssh_client( # try:
ipaddress=public_ip.ipaddress.ipaddress) # ssh_1 = self.vm_1.get_ssh_client(
self.debug("Command: hostname") # ipaddress=public_ip.ipaddress.ipaddress)
result = ssh_1.execute("hostname") # self.debug("Command: hostname")
self.debug("Result: %s" % result) # result = ssh_1.execute("hostname")
# self.debug("Result: %s" % result)
if isinstance(result, list): #
res = result[0] # if isinstance(result, list):
else: # res = result[0]
self.fail("hostname retrieval failed!") # else:
self.assertIn( # self.fail("hostname retrieval failed!")
res, # self.assertIn(
[self.vm_1.name, self.vm_2.name], # res,
"SSH should return hostname of one of the VM" # [self.vm_1.name, self.vm_2.name],
) # "SSH should return hostname of one of the VM"
# )
ssh_2 = self.vm_2.get_ssh_client( #
ipaddress=public_ip.ipaddress.ipaddress) # ssh_2 = self.vm_2.get_ssh_client(
self.debug("Command: hostname") # ipaddress=public_ip.ipaddress.ipaddress)
result = ssh_2.execute("hostname") # self.debug("Command: hostname")
self.debug("Result: %s" % result) # result = ssh_2.execute("hostname")
# self.debug("Result: %s" % result)
if isinstance(result, list): #
res = result[0] # if isinstance(result, list):
else: # res = result[0]
self.fail("hostname retrieval failed!") # else:
self.assertIn( # self.fail("hostname retrieval failed!")
res, # self.assertIn(
[self.vm_1.name, self.vm_2.name], # res,
"SSH should return hostname of one of the VM" # [self.vm_1.name, self.vm_2.name],
) # "SSH should return hostname of one of the VM"
except Exception as e: # )
self.fail( # except Exception as e:
"SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e)) # self.fail(
# "SSH Access failed for %s: %s" % (self.vm_1.ipaddress, e))
# Fetch details from user_ip_address table in database #
## Fetch details from user_ip_address table in database
self.debug( self.debug(
"select is_system from user_ip_address where public_ip_address='%s';" \ "select is_system from user_ip_address where public_ip_address='%s';" \
% public_ip.ipaddress.ipaddress) % public_ip.ipaddress.ipaddress)
@ -1270,7 +1293,7 @@ class TestELB(cloudstackTestCase):
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -1294,8 +1317,8 @@ class TestELB(cloudstackTestCase):
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertEqual( self.assertEqual(
result.count("State: UP"), result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (public_ip.ipaddress.ipaddress, public_ip.ipaddress.ipaddress)),
4, 1,
"User subnet IP should be enabled for LB service" "User subnet IP should be enabled for LB service"
) )
@ -1304,10 +1327,13 @@ class TestELB(cloudstackTestCase):
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
def test_03_elb_delete_lb_system(self): def test_03_elb_delete_lb_system(self):
"""Test delete LB rule generated with public IP with is_system = 1 """Test delete LB rule generated with public IP with is_system = 1
""" """
# Validate the following # Validate the following
# 1. Deleting LB rule should release EIP where is_system=1 # 1. Deleting LB rule should release EIP where is_system=1
# 2. check configuration changes for EIP reflects on NS # 2. check configuration changes for EIP reflects on NS
@ -1341,38 +1367,12 @@ class TestELB(cloudstackTestCase):
self.debug("Deleting LB rule: %s" % self.lb_rule.id) self.debug("Deleting LB rule: %s" % self.lb_rule.id)
self.lb_rule.delete(self.apiclient) self.lb_rule.delete(self.apiclient)
config = list_configurations(
self.apiclient,
name='network.gc.wait'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
gc_delay = config[0]
self.debug("network.gc.wait: %s" % gc_delay.value)
config = list_configurations(
self.apiclient,
name='network.gc.interval'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
gc_interval = config[0]
self.debug("network.gc.intervall: %s" % gc_interval.value)
# wait for exp_delay+exp_interval - cleans up VM
total_wait = int(gc_interval.value) + int(gc_delay.value)
time.sleep(total_wait)
time.sleep(60)
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -1385,7 +1385,7 @@ class TestELB(cloudstackTestCase):
self.assertEqual( self.assertEqual(
result.count(lb_ip.ipaddress), result.count(lb_ip.ipaddress),
1, 0,
"One IP from EIP pool should be taken and configured on NS" "One IP from EIP pool should be taken and configured on NS"
) )
@ -1394,10 +1394,10 @@ class TestELB(cloudstackTestCase):
result = str(res) result = str(res)
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertEqual( self.assertEqual(
result.count("State: UP"), result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress) ),
2, 0,
"User subnet IP should be enabled for LB service" "User subnet IP should be enabled for LB service"
) )
@ -1405,11 +1405,14 @@ class TestELB(cloudstackTestCase):
self.fail("SSH Access failed for %s: %s" % \ self.fail("SSH Access failed for %s: %s" % \
(self.services["netscaler"]["ipaddress"], e)) (self.services["netscaler"]["ipaddress"], e))
return return
@attr(tags = ["eip"])
@unittest.skip("valid bug : http://bugs.cloudstack.org/browse/CS-15077 : ListPublicIPAddress failing")
def test_04_delete_lb_on_eip(self): def test_04_delete_lb_on_eip(self):
"""Test delete LB rule generated on EIP """Test delete LB rule generated on EIP
""" """
# Validate the following # Validate the following
# 1. Deleting LB rule won't release EIP where is_system=0 # 1. Deleting LB rule won't release EIP where is_system=0
# 2. disassociateIP must release the above IP # 2. disassociateIP must release the above IP
@ -1471,6 +1474,7 @@ class TestELB(cloudstackTestCase):
ipaddress=public_ip, ipaddress=public_ip,
listall=True listall=True
) )
self.debug("ip address list: %s" % ip_addrs)
self.assertEqual( self.assertEqual(
isinstance(ip_addrs, list), isinstance(ip_addrs, list),
True, True,
@ -1499,34 +1503,7 @@ class TestELB(cloudstackTestCase):
except Exception as e: except Exception as e:
self.fail("Deleting LB rule failed for IP: %s-%s" % (public_ip, e)) self.fail("Deleting LB rule failed for IP: %s-%s" % (public_ip, e))
config = list_configurations( #TODO:check the lb rule list and then confirm that lb rule is deleted
self.apiclient,
name='network.gc.wait'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
gc_delay = config[0]
self.debug("network.gc.wait: %s" % gc_delay.value)
config = list_configurations(
self.apiclient,
name='network.gc.interval'
)
self.assertEqual(
isinstance(config, list),
True,
"Check list configurations response"
)
gc_interval = config[0]
self.debug("network.gc.intervall: %s" % gc_interval.value)
# wait for exp_delay+exp_interval - cleans up VM
total_wait = int(gc_interval.value) + int(gc_delay.value)
time.sleep(total_wait)
self.debug("LB rule deleted!") self.debug("LB rule deleted!")
ip_addrs = PublicIPAddress.list( ip_addrs = PublicIPAddress.list(
@ -1542,7 +1519,7 @@ class TestELB(cloudstackTestCase):
self.debug("SSH into netscaler: %s" % self.debug("SSH into netscaler: %s" %
self.services["netscaler"]["ipaddress"]) self.services["netscaler"]["ipaddress"])
try: try:
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["netscaler"]["ipaddress"], self.services["netscaler"]["ipaddress"],
22, 22,
self.services["netscaler"]["username"], self.services["netscaler"]["username"],
@ -1566,8 +1543,8 @@ class TestELB(cloudstackTestCase):
self.debug("Output: %s" % result) self.debug("Output: %s" % result)
self.assertNotEqual( self.assertNotEqual(
result.count("State: UP"), result.count("Cloud-VirtualServer-%s-22 (%s:22) - TCP" % (lb_ip.ipaddress, lb_ip.ipaddress)),
2, 1,
"User subnet IP should be enabled for LB service" "User subnet IP should be enabled for LB service"
) )

File diff suppressed because it is too large Load Diff

View File

@ -19,12 +19,13 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
@ -41,14 +42,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"network_offering": { "network_offering": {
"name": 'Network offering-VR services', "name": 'Network offering-VR services',
@ -57,16 +58,16 @@ class Services:
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat', "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
"traffictype": 'GUEST', "traffictype": 'GUEST',
"availability": 'Optional', "availability": 'Optional',
"serviceProviderList" : { "serviceProviderList": {
"Dhcp": 'VirtualRouter', "Dhcp": 'VirtualRouter',
"Dns": 'VirtualRouter', "Dns": 'VirtualRouter',
"SourceNat": 'VirtualRouter', "SourceNat": 'VirtualRouter',
"PortForwarding": 'VirtualRouter', "PortForwarding": 'VirtualRouter',
"Vpn": 'VirtualRouter', "Vpn": 'VirtualRouter',
"Firewall": 'VirtualRouter', "Firewall": 'VirtualRouter',
"Lb": 'VirtualRouter', "Lb": 'VirtualRouter',
"UserData": 'VirtualRouter', "UserData": 'VirtualRouter',
"StaticNat": 'VirtualRouter', "StaticNat": 'VirtualRouter',
}, },
}, },
"network_offering_netscaler": { "network_offering_netscaler": {
@ -76,7 +77,7 @@ class Services:
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat', "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
"traffictype": 'GUEST', "traffictype": 'GUEST',
"availability": 'Optional', "availability": 'Optional',
"serviceProviderList" : { "serviceProviderList": {
"Dhcp": 'VirtualRouter', "Dhcp": 'VirtualRouter',
"Dns": 'VirtualRouter', "Dns": 'VirtualRouter',
"SourceNat": 'VirtualRouter', "SourceNat": 'VirtualRouter',
@ -91,6 +92,7 @@ class Services:
"network": { "network": {
"name": "Test Network", "name": "Test Network",
"displaytext": "Test Network", "displaytext": "Test Network",
"vlan": 2370,
}, },
"lbrule": { "lbrule": {
"name": "SSH", "name": "SSH",
@ -118,7 +120,7 @@ class Services:
"publicport": 66, "publicport": 66,
"protocol": "TCP" "protocol": "TCP"
}, },
"fw_rule":{ "fw_rule": {
"startport": 1, "startport": 1,
"endport": 6000, "endport": 6000,
"cidr": '55.55.0.0/11', "cidr": '55.55.0.0/11',
@ -136,11 +138,11 @@ class Services:
"publicport": 22, "publicport": 22,
"protocol": 'TCP', "protocol": 'TCP',
}, },
"ostypeid": '9958b10f-9e5d-4ef1-908d-a047372d823b', "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode":'advanced' "mode": 'advanced'
} }
@ -209,10 +211,12 @@ class TestNOVirtualRouter(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced"])
def test_01_network_off_without_conserve_mode(self): def test_01_network_off_without_conserve_mode(self):
"""Test Network offering with Conserve mode off and VR - All services """Test Network offering with Conserve mode off and VR - All services
""" """
# Validate the following # Validate the following
# 1. Create a Network from the above network offering and deploy a VM. # 1. Create a Network from the above network offering and deploy a VM.
# 2. On source NAT ipaddress, we should NOT be allowed to add a # 2. On source NAT ipaddress, we should NOT be allowed to add a
@ -243,7 +247,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
self.debug("Created n/w offering with ID: %s" % self.debug("Created n/w offering with ID: %s" %
self.network_offering.id) self.network_offering.id)
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
# Creating network using the network offering created # Creating network using the network offering created
@ -255,7 +259,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
accountid=self.account.account.name, accountid=self.account.account.name,
domainid=self.account.account.domainid, domainid=self.account.account.domainid,
networkofferingid=self.network_offering.id, networkofferingid=self.network_offering.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
self.debug("Created network with ID: %s" % self.network.id) self.debug("Created network with ID: %s" % self.network.id)
@ -332,7 +336,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
ip_with_nat_rule.ipaddress.ipaddress) ip_with_nat_rule.ipaddress.ipaddress)
NATRule.create( NATRule.create(
self.apiclient, self.apiclient,
virtual_machine, virtual_machine,
self.services["natrule"], self.services["natrule"],
ipaddressid=ip_with_nat_rule.ipaddress.id ipaddressid=ip_with_nat_rule.ipaddress.id
) )
@ -452,10 +456,12 @@ class TestNOVirtualRouter(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced"])
def test_02_network_off_with_conserve_mode(self): def test_02_network_off_with_conserve_mode(self):
"""Test Network offering with Conserve mode ON and VR - All services """Test Network offering with Conserve mode ON and VR - All services
""" """
# Validate the following # Validate the following
# 1. Create a Network from the above network offering and deploy a VM. # 1. Create a Network from the above network offering and deploy a VM.
# 2. On source NAT ipaddress, we should be allowed to add a LB rules # 2. On source NAT ipaddress, we should be allowed to add a LB rules
@ -484,7 +490,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
self.debug("Created n/w offering with ID: %s" % self.debug("Created n/w offering with ID: %s" %
self.network_offering.id) self.network_offering.id)
# Enable Network offering # Enable Network offering
self.network_offering.update(self.apiclient, state='Enabled') self.network_offering.update(self.apiclient, state='Enabled')
# Creating network using the network offering created # Creating network using the network offering created
@ -496,7 +502,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
accountid=self.account.account.name, accountid=self.account.account.name,
domainid=self.account.account.domainid, domainid=self.account.account.domainid,
networkofferingid=self.network_offering.id, networkofferingid=self.network_offering.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
self.debug("Created network with ID: %s" % self.network.id) self.debug("Created network with ID: %s" % self.network.id)
@ -701,7 +707,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
vpns = Vpn.list( vpns = Vpn.list(
self.apiclient, self.apiclient,
publicipid=src_nat.id, publicipid=src_nat.id,
listall=True, listall=True,
) )
self.assertEqual( self.assertEqual(
@ -783,10 +789,12 @@ class TestNOWithNetscaler(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advancedns"])
def test_01_network_off_without_conserve_mode(self): def test_01_network_off_without_conserve_mode(self):
"""Test Nw off with Conserve mode off, VR-All services, LB-netscaler """Test Nw off with Conserve mode off, VR-All services, LB-netscaler
""" """
# Validate the following # Validate the following
# 1. Create a Network from the above network offering and deploy a VM. # 1. Create a Network from the above network offering and deploy a VM.
# 2. On source NAT ipaddress, we should NOT be allowed to add LB rule # 2. On source NAT ipaddress, we should NOT be allowed to add LB rule
@ -796,14 +804,13 @@ class TestNOWithNetscaler(cloudstackTestCase):
# 5. On an ipaddress that has Lb rules , we should NOT allow firewall # 5. On an ipaddress that has Lb rules , we should NOT allow firewall
# rules to be programmed. # rules to be programmed.
# 6. On an ipaddress that has Lb rules , we should NOT allow PF rules # 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
# to be programmed. # to be programmed.
# 7. We should be allowed to program multiple PF rules on the same Ip # 7. We should be allowed to program multiple PF rules on the same Ip
# address on different public ports. # address on different public ports.
# 8. We should be allowed to program multiple LB rules on the same Ip # 8. We should be allowed to program multiple LB rules on the same Ip
# address for different public port ranges. # address for different public port ranges.
# 9. On source NAT ipaddress, we should NOT be allowed to Enable VPN. # 9. On source NAT ipaddress, we should NOT be allowed to Enable VPN.
# Create a network offering with all virtual router services enabled # Create a network offering with all virtual router services enabled
self.debug( self.debug(
"Creating n/w offering with all services in VR & conserve mode:ON" "Creating n/w offering with all services in VR & conserve mode:ON"
@ -891,7 +898,7 @@ class TestNOWithNetscaler(cloudstackTestCase):
) )
self.debug("Creating firewall rule on source NAT: %s" % self.debug("Creating firewall rule on source NAT: %s" %
src_nat.ipaddress) src_nat.ipaddress)
#Create Firewall rule on source NAT #Create Firewall rule on source NAT
fw_rule = FireWallRule.create( fw_rule = FireWallRule.create(
self.apiclient, self.apiclient,
ipaddressid=src_nat.id, ipaddressid=src_nat.id,
@ -1051,10 +1058,12 @@ class TestNOWithNetscaler(cloudstackTestCase):
) )
return return
@attr(tags = ["advancedns"])
def test_02_network_off_with_conserve_mode_netscaler(self): def test_02_network_off_with_conserve_mode_netscaler(self):
"""Test NW off with Conserve mode ON, LB-Netscaler and VR-All services """Test NW off with Conserve mode ON, LB-Netscaler and VR-All services
""" """
# Validate the following # Validate the following
# 1. Create a Network from the above network offering and deploy a VM. # 1. Create a Network from the above network offering and deploy a VM.
# 2. On source NAT ipaddress, we should NOT be allowed to add LB rule # 2. On source NAT ipaddress, we should NOT be allowed to add LB rule
@ -1065,14 +1074,13 @@ class TestNOWithNetscaler(cloudstackTestCase):
# 5. On an ipaddress that has Lb rules , we should NOT allow firewall # 5. On an ipaddress that has Lb rules , we should NOT allow firewall
# rules to be programmed. # rules to be programmed.
# 6. On an ipaddress that has Lb rules , we should NOT allow PF rules # 6. On an ipaddress that has Lb rules , we should NOT allow PF rules
# to be programmed. # to be programmed.
# 7. We should be allowed to program multiple PF rules on the same Ip # 7. We should be allowed to program multiple PF rules on the same Ip
# address on different public ports. # address on different public ports.
# 8. We should be allowed to program multiple LB rules on the same Ip # 8. We should be allowed to program multiple LB rules on the same Ip
# address for different public port ranges. # address for different public port ranges.
# 9. On source NAT ipaddress, we should be allowed to Enable VPN. # 9. On source NAT ipaddress, we should be allowed to Enable VPN.
# Create a network offering with all virtual router services enabled # Create a network offering with all virtual router services enabled
self.debug( self.debug(
"Creating n/w offering with all services in VR & conserve mode:ON" "Creating n/w offering with all services in VR & conserve mode:ON"
@ -1425,10 +1433,13 @@ class TestNetworkUpgrade(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advancedns"])
def test_01_nwupgrade_netscaler_conserve_on(self): def test_01_nwupgrade_netscaler_conserve_on(self):
"""Test Nw upgrade to netscaler lb service and conserve mode ON """Test Nw upgrade to netscaler lb service and conserve mode ON
""" """
# Validate the following # Validate the following
# 1. Upgrade a network with VR and conserve mode ON TO # 1. Upgrade a network with VR and conserve mode ON TO
# A network that has Lb provided by "Netscaler" and all other # A network that has Lb provided by "Netscaler" and all other
@ -1579,7 +1590,7 @@ class TestNetworkUpgrade(cloudstackTestCase):
vpns = Vpn.list( vpns = Vpn.list(
self.apiclient, self.apiclient,
publicipid=src_nat.id, publicipid=src_nat.id,
listall=True, listall=True,
) )
self.assertEqual( self.assertEqual(
@ -1622,10 +1633,13 @@ class TestNetworkUpgrade(cloudstackTestCase):
) )
return return
@attr(speed = "slow")
@attr(tags = ["advancedns"])
def test_02_nwupgrade_netscaler_conserve_off(self): def test_02_nwupgrade_netscaler_conserve_off(self):
"""Test Nw upgrade to netscaler lb service and conserve mode OFF """Test Nw upgrade to netscaler lb service and conserve mode OFF
""" """
# Validate the following # Validate the following
# 1. Upgrade a network with VR and conserve mode ON TO # 1. Upgrade a network with VR and conserve mode ON TO
# A network that has Lb provided by "Netscaler" and all other # A network that has Lb provided by "Netscaler" and all other
@ -1798,3 +1812,131 @@ class TestNetworkUpgrade(cloudstackTestCase):
changecidr=True changecidr=True
) )
return return
@unittest.skip("Skipped since shared network requires StartIp/endIp/gateway/netmask")
class TestSharedNetworkWithoutIp(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestSharedNetworkWithoutIp,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostypeid"]
)
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [
cls.service_offering,
]
return
@classmethod
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
self.cleanup = []
return
def tearDown(self):
try:
self.account.delete(self.apiclient)
interval = list_configurations(
self.apiclient,
name='account.cleanup.interval'
)
# Sleep to ensure that all resources are deleted
time.sleep(int(interval[0].value) * 2)
#Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self.cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@attr(tags=["advanced", "advancedns", "simulator", "network", "api"])
def test_deployVmSharedNetworkWithoutIpRange(self):
"""Test deployVM in shared network without startIp/endIp
"""
# Steps for validation
# 1. create a shared network using shared network offering but do not
# specify startIp/endIp arguments
# 2. create an account
# 3. deploy a VM in this account using the above network
# Validate the following
# 1. listNetworks should return the created network
# 2. listAccounts to return the created account
# 3. VM deployment should succeed and NIC is in networks address space
# 4. delete the account
self.debug(
"Fetching default shared network offering from nw offerings")
network_offerings = NetworkOffering.list(
self.apiclient,
listall=True,
guestiptype="Shared",
name="DefaultSharedNetworkOffering",
displaytext="Offering for Shared networks"
)
self.assertEqual(
isinstance(network_offerings, list),
True,
"Nw offerings should have atleast a shared nw offering"
)
shared_nw_off = network_offerings[0]
self.debug("Shared netwrk offering: %s" % shared_nw_off.name)
self.debug("Creating a network from shared network offering")
self.network = Network.create(
self.apiclient,
self.services["network"],
accountid=self.account.account.name,
domainid=self.account.account.domainid,
networkofferingid=shared_nw_off.id,
zoneid=self.zone.id
)
self.debug("Created network with ID: %s" % self.network.id)
self.debug("Deploying VM in account: %s" % self.account.account.name)
try:
# Spawn an instance in that network
VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.account.name,
domainid=self.account.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
self.debug("Deployed VM in network: %s" % self.network.id)
except Exception as e:
self.fail("Deply Vm in shared network failed! - %s" % e)
return

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
@ -25,6 +26,7 @@ from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
import datetime import datetime
class Services: class Services:
"""Test Resource Limits Services """Test Resource Limits Services
""" """
@ -45,7 +47,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"user": { "user": {
"email": "administrator@clogeny.com", "email": "administrator@clogeny.com",
@ -54,7 +56,7 @@ class Services:
"username": "User", "username": "User",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
@ -84,10 +86,33 @@ class Services:
"template": { "template": {
"displaytext": "Cent OS Template", "displaytext": "Cent OS Template",
"name": "Cent OS Template", "name": "Cent OS Template",
"ostypeid": '471a4b5b-5523-448f-9608-7d6218995733', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
}, },
"ostypeid": '471a4b5b-5523-448f-9608-7d6218995733', "network_offering": {
"name": 'Network offering-VR services',
"displaytext": 'Network offering-VR services',
"guestiptype": 'Isolated',
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
"traffictype": 'GUEST',
"availability": 'Optional',
"serviceProviderList": {
"Dhcp": 'VirtualRouter',
"Dns": 'VirtualRouter',
"SourceNat": 'VirtualRouter',
"PortForwarding": 'VirtualRouter',
"Vpn": 'VirtualRouter',
"Firewall": 'VirtualRouter',
"Lb": 'VirtualRouter',
"UserData": 'VirtualRouter',
"StaticNat": 'VirtualRouter',
},
},
"network": {
"name": "Test Network",
"displaytext": "Test Network",
},
"ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
@ -100,13 +125,13 @@ class TestProjectLimits(cloudstackTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.api_client = super( cls.api_client = super(
TestProjectLimits, TestProjectLimits,
cls cls
).getClsTestClient().getApiClient() ).getClsTestClient().getApiClient()
cls.services = Services().services cls.services = Services().services
# Get Zone # Get Zone
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
# Create domains, account etc. # Create domains, account etc.
cls.domain = Domain.create( cls.domain = Domain.create(
cls.api_client, cls.api_client,
@ -125,10 +150,10 @@ class TestProjectLimits(cloudstackTestCase):
domainid=cls.domain.id domainid=cls.domain.id
) )
cls._cleanup = [ cls._cleanup = [
cls.admin, cls.admin,
cls.user, cls.user,
cls.domain cls.domain
] ]
return return
@classmethod @classmethod
@ -154,10 +179,10 @@ class TestProjectLimits(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_project_limits(self): def test_01_project_limits(self):
""" Test project limits """ Test project limits
""" """
# Validate the following # Validate the following
# 1. Create a Project. Verify once projects are created, they inherit # 1. Create a Project. Verify once projects are created, they inherit
# a default set of resource limits as configured by the Cloud Stack # a default set of resource limits as configured by the Cloud Stack
@ -183,9 +208,9 @@ class TestProjectLimits(cloudstackTestCase):
self.cleanup.append(project) self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % self.debug("Created project with domain admin with ID: %s" %
project.id) project.id)
list_projects_reponse = Project.list( list_projects_reponse = Project.list(
self.apiclient, self.apiclient,
id=project.id, id=project.id,
listall=True listall=True
) )
@ -223,7 +248,7 @@ class TestProjectLimits(cloudstackTestCase):
) )
# Reduce resource limits for project # Reduce resource limits for project
# Resource: 0 - Instance. Number of instances a user can create. # Resource: 0 - Instance. Number of instances a user can create.
# Resource: 1 - IP. Number of public IP addresses a user can own. # Resource: 1 - IP. Number of public IP addresses a user can own.
# Resource: 2 - Volume. Number of disk volumes a user can create. # Resource: 2 - Volume. Number of disk volumes a user can create.
# Resource: 3 - Snapshot. Number of snapshots a user can create. # Resource: 3 - Snapshot. Number of snapshots a user can create.
@ -261,7 +286,7 @@ class TestProjectLimits(cloudstackTestCase):
1, 1,
"Resource limit should be updated to 1" "Resource limit should be updated to 1"
) )
# Get the resource limits for domain # Get the resource limits for domain
resource_limits = list_resource_limits( resource_limits = list_resource_limits(
self.apiclient, self.apiclient,
@ -277,7 +302,7 @@ class TestProjectLimits(cloudstackTestCase):
0, 0,
"List resource API response should not be empty" "List resource API response should not be empty"
) )
for resource in resource_limits: for resource in resource_limits:
# Update domain resource limits to 2 # Update domain resource limits to 2
update_resource_limit( update_resource_limit(
@ -300,11 +325,12 @@ class TestProjectLimits(cloudstackTestCase):
projectid=project.id projectid=project.id
) )
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
@unittest.skip("No provision for updating resource limits from account through API") @unittest.skip("No provision for updating resource limits from account through API")
def test_02_project_limits_normal_user(self): def test_02_project_limits_normal_user(self):
""" Test project limits """ Test project limits
""" """
# Validate the following # Validate the following
# 1. Create a Project # 1. Create a Project
# 2. Reduce the projects limits as a domain admin. Verify resource # 2. Reduce the projects limits as a domain admin. Verify resource
@ -323,9 +349,9 @@ class TestProjectLimits(cloudstackTestCase):
self.cleanup.append(project) self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % self.debug("Created project with domain admin with ID: %s" %
project.id) project.id)
list_projects_reponse = Project.list( list_projects_reponse = Project.list(
self.apiclient, self.apiclient,
id=project.id, id=project.id,
listall=True listall=True
) )
@ -363,7 +389,7 @@ class TestProjectLimits(cloudstackTestCase):
) )
# Reduce resource limits for project # Reduce resource limits for project
# Resource: 0 - Instance. Number of instances a user can create. # Resource: 0 - Instance. Number of instances a user can create.
# Resource: 1 - IP. Number of public IP addresses a user can own. # Resource: 1 - IP. Number of public IP addresses a user can own.
# Resource: 2 - Volume. Number of disk volumes a user can create. # Resource: 2 - Volume. Number of disk volumes a user can create.
# Resource: 3 - Snapshot. Number of snapshots a user can create. # Resource: 3 - Snapshot. Number of snapshots a user can create.
@ -401,7 +427,7 @@ class TestProjectLimits(cloudstackTestCase):
1, 1,
"Resource limit should be updated to 1" "Resource limit should be updated to 1"
) )
self.debug("Adding %s user to project: %s" % ( self.debug("Adding %s user to project: %s" % (
self.user.account.name, self.user.account.name,
project.name project.name
@ -409,10 +435,10 @@ class TestProjectLimits(cloudstackTestCase):
# Add user to the project # Add user to the project
project.addAccount( project.addAccount(
self.apiclient, self.apiclient,
self.user.account.name, self.user.account.name,
) )
# Get the resource limits for domain # Get the resource limits for domain
resource_limits = list_resource_limits( resource_limits = list_resource_limits(
self.apiclient, self.apiclient,
@ -428,7 +454,7 @@ class TestProjectLimits(cloudstackTestCase):
0, 0,
"List resource API response should not be empty" "List resource API response should not be empty"
) )
for resource in resource_limits: for resource in resource_limits:
#with self.assertRaises(Exception): #with self.assertRaises(Exception):
self.debug( self.debug(
@ -524,10 +550,10 @@ class TestResourceLimitsProject(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_03_vm_per_project(self): def test_03_vm_per_project(self):
"""Test VM limit per project """Test VM limit per project
""" """
# Validate the following # Validate the following
# 1. Set max VM per project to 2 # 1. Set max VM per project to 2
# 2. Create account and start 2 VMs. Verify VM state is Up and Running # 2. Create account and start 2 VMs. Verify VM state is Up and Running
@ -535,7 +561,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
# should be raised # should be raised
self.debug( self.debug(
"Updating instance resource limits for project: %s" % "Updating instance resource limits for project: %s" %
self.project.id) self.project.id)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -586,10 +612,10 @@ class TestResourceLimitsProject(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "eip", "advancedns", "simulator"])
def test_04_publicip_per_project(self): def test_04_publicip_per_project(self):
"""Test Public IP limit per project """Test Public IP limit per project
""" """
# Validate the following # Validate the following
# 1. set max no of IPs per project to 2. # 1. set max no of IPs per project to 2.
# 2. Create an account in this domain # 2. Create an account in this domain
@ -599,7 +625,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
# appropriate error and an alert should be generated. # appropriate error and an alert should be generated.
self.debug( self.debug(
"Updating public IP resource limits for project: %s" % "Updating public IP resource limits for project: %s" %
self.project.id) self.project.id)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -625,7 +651,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
"Check VM state is Running or not" "Check VM state is Running or not"
) )
networks = Network.list( networks = Network.list(
self.apiclient, self.apiclient,
projectid=self.project.id, projectid=self.project.id,
listall=True listall=True
) )
@ -640,7 +666,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
"Check list networks response returns a valid network" "Check list networks response returns a valid network"
) )
network = networks[0] network = networks[0]
self.debug("Associating public IP for project: %s" % self.debug("Associating public IP for project: %s" %
self.project.id) self.project.id)
public_ip_1 = PublicIPAddress.create( public_ip_1 = PublicIPAddress.create(
self.apiclient, self.apiclient,
@ -671,19 +697,19 @@ class TestResourceLimitsProject(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_05_snapshots_per_project(self): def test_05_snapshots_per_project(self):
"""Test Snapshot limit per project """Test Snapshot limit per project
""" """
# Validate the following # Validate the following
# 1. set max no of snapshots per project to 1. # 1. set max no of snapshots per project to 1.
# 2. Create one snapshot in the project. Snapshot should be # 2. Create one snapshot in the project. Snapshot should be
# successfully created # successfully created
# 5. Try to create another snapshot in this project. It should give # 5. Try to create another snapshot in this project. It should give
# user an appropriate error and an alert should be generated. # user an appropriate error and an alert should be generated.
self.debug( self.debug(
"Updating snapshot resource limits for project: %s" % "Updating snapshot resource limits for project: %s" %
self.project.id) self.project.id)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -748,10 +774,10 @@ class TestResourceLimitsProject(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_06_volumes_per_project(self): def test_06_volumes_per_project(self):
"""Test Volumes limit per project """Test Volumes limit per project
""" """
# Validate the following # Validate the following
# 1. set max no of volume per project to 1. # 1. set max no of volume per project to 1.
# 2. Create 1 VM in this project # 2. Create 1 VM in this project
@ -760,7 +786,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
# should be generated. # should be generated.
self.debug( self.debug(
"Updating volume resource limits for project: %s" % "Updating volume resource limits for project: %s" %
self.project.id) self.project.id)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -796,12 +822,11 @@ class TestResourceLimitsProject(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
return return
@attr(tags=["advanced", "basic", "sg", "eip", "advancedns"])
def test_07_templates_per_project(self): def test_07_templates_per_project(self):
"""Test Templates limit per project """Test Templates limit per project
""" """
# Validate the following
# 1. set max no of templates per project to 1. # 1. set max no of templates per project to 1.
# 2. Create a template in this project. Both template should be in # 2. Create a template in this project. Both template should be in
# ready state # ready state
@ -816,7 +841,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
self.debug( self.debug(
"Updating template resource limits for domain: %s" % "Updating template resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -882,3 +907,141 @@ class TestResourceLimitsProject(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
return return
class TestMaxProjectNetworks(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestMaxProjectNetworks,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostypeid"]
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.network_offering = NetworkOffering.create(
cls.api_client,
cls.services["network_offering"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
cls.network_offering
]
return
@classmethod
def tearDownClass(cls):
try:
#Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
self.cleanup = []
return
def tearDown(self):
try:
#Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self.cleanup)
self.account.delete(self.apiclient)
interval = list_configurations(
self.apiclient,
name='account.cleanup.interval'
)
# Sleep to ensure that all resources are deleted
time.sleep(int(interval[0].value) * 2)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@attr(tags=["advanced", "advancedns", "simulator",
"api", "basic", "eip", "sg"])
def test_maxAccountNetworks(self):
"""Test Limit number of guest account specific networks
"""
# Steps for validation
# 1. Fetch max.account.networks from configurations
# 2. Create an account. Create account more that max.accout.network
# 3. Create network should fail
self.debug("Creating project with '%s' as admin" %
self.account.account.name)
# Create project as a domain admin
project = Project.create(
self.apiclient,
self.services["project"],
account=self.account.account.name,
domainid=self.account.account.domainid
)
# Cleanup created project at end of test
self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" %
project.id)
config = Configurations.list(
self.apiclient,
name='max.project.networks',
listall=True
)
self.assertEqual(
isinstance(config, list),
True,
"List configurations hsould have max.project.networks"
)
config_value = int(config[0].value)
self.debug("max.project.networks: %s" % config_value)
for ctr in range(config_value):
# Creating network using the network offering created
self.debug("Creating network with network offering: %s" %
self.network_offering.id)
network = Network.create(
self.apiclient,
self.services["network"],
projectid=project.id,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
self.debug("Created network with ID: %s" % network.id)
self.debug(
"Creating network in account already having networks : %s" %
config_value)
with self.assertRaises(Exception):
Network.create(
self.apiclient,
self.services["network"],
projectid=project.id,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
self.debug('Create network failed (as expected)')
return

View File

@ -18,6 +18,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
@ -26,6 +27,7 @@ from integration.lib.common import *
from marvin.remoteSSHClient import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
class Services: class Services:
"""Test Resource creation Services """Test Resource creation Services
""" """
@ -46,7 +48,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"user": { "user": {
"email": "administrator@clogeny.com", "email": "administrator@clogeny.com",
@ -55,14 +57,14 @@ class Services:
"username": "User", "username": "User",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Tiny Disk Offering", "displaytext": "Tiny Disk Offering",
@ -85,7 +87,7 @@ class Services:
"template": { "template": {
"displaytext": "Cent OS Template", "displaytext": "Cent OS Template",
"name": "Cent OS Template", "name": "Cent OS Template",
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
"ispublic": False, "ispublic": False,
}, },
@ -97,7 +99,7 @@ class Services:
"name": "Domainwide Network", "name": "Domainwide Network",
"displaytext": "Domainwide Network", "displaytext": "Domainwide Network",
"gateway": '192.168.100.1', "gateway": '192.168.100.1',
"netmask": '255.255.255.0', "netmask": '255.255.255.0',
"startip": '192.168.100.200', "startip": '192.168.100.200',
"endip": '192.168.100.201', "endip": '192.168.100.201',
"vlan": 4001, "vlan": 4001,
@ -128,13 +130,13 @@ class Services:
"endport": 22, "endport": 22,
"cidrlist": '0.0.0.0/0', "cidrlist": '0.0.0.0/0',
}, },
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'advanced', "mode": 'advanced',
} }
class TestOfferings(cloudstackTestCase): class TestOfferings(cloudstackTestCase):
@ -176,7 +178,7 @@ class TestOfferings(cloudstackTestCase):
cls.services["disk_offering"] cls.services["disk_offering"]
) )
cls._cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering, cls.service_offering,
cls.disk_offering cls.disk_offering
] ]
@ -205,10 +207,10 @@ class TestOfferings(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_service_offerings(self): def test_01_service_offerings(self):
""" Test service offerings in a project """ Test service offerings in a project
""" """
# Validate the following # Validate the following
# 1. Create a project. # 1. Create a project.
# 2. List service offerings for the project. All SO available in the # 2. List service offerings for the project. All SO available in the
@ -225,9 +227,9 @@ class TestOfferings(cloudstackTestCase):
self.cleanup.append(project) self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % self.debug("Created project with domain admin with ID: %s" %
project.id) project.id)
self.debug( self.debug(
"Deploying VM instance for project: %s & service offering: %s" % ( "Deploying VM instance for project: %s & service offering: %s" % (
project.id, project.id,
self.service_offering.id self.service_offering.id
)) ))
@ -247,6 +249,7 @@ class TestOfferings(cloudstackTestCase):
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_02_project_disk_offerings(self): def test_02_project_disk_offerings(self):
""" Test project disk offerings """ Test project disk offerings
""" """
@ -267,9 +270,9 @@ class TestOfferings(cloudstackTestCase):
self.cleanup.append(project) self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % self.debug("Created project with domain admin with ID: %s" %
project.id) project.id)
list_projects_reponse = Project.list( list_projects_reponse = Project.list(
self.apiclient, self.apiclient,
id=project.id, id=project.id,
listall=True listall=True
) )
@ -351,7 +354,7 @@ class TestNetwork(cloudstackTestCase):
domainid=cls.domain.id domainid=cls.domain.id
) )
cls._cleanup = [ cls._cleanup = [
cls.account, cls.account,
cls.service_offering, cls.service_offering,
] ]
return return
@ -379,10 +382,10 @@ class TestNetwork(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_03_network_create(self): def test_03_network_create(self):
""" Test create network in project """ Test create network in project
""" """
# Validate the following # Validate the following
# 1. Create a project. # 1. Create a project.
# 2. Add virtual/direct network resource to the project. User shared # 2. Add virtual/direct network resource to the project. User shared
@ -403,7 +406,7 @@ class TestNetwork(cloudstackTestCase):
self.cleanup.append(project) self.cleanup.append(project)
self.debug("Created project with domain admin with ID: %s" % self.debug("Created project with domain admin with ID: %s" %
project.id) project.id)
network_offerings = list_network_offerings( network_offerings = list_network_offerings(
self.apiclient, self.apiclient,
projectid=project.id, projectid=project.id,
@ -412,36 +415,36 @@ class TestNetwork(cloudstackTestCase):
state='Enabled' state='Enabled'
) )
self.assertEqual( self.assertEqual(
isinstance(network_offerings, list), isinstance(network_offerings, list),
True, True,
"Check for the valid network offerings" "Check for the valid network offerings"
) )
network_offering = network_offerings[0] network_offering = network_offerings[0]
self.debug("creating a network with network offering ID: %s" % self.debug("creating a network with network offering ID: %s" %
network_offering.id) network_offering.id)
self.services["network"]["zoneid"] = self.zone.id self.services["network"]["zoneid"] = self.zone.id
network = Network.create( network = Network.create(
self.apiclient, self.apiclient,
self.services["network"], self.services["network"],
networkofferingid=network_offering.id, networkofferingid=network_offering.id,
projectid=project.id projectid=project.id
) )
self.debug("Created network with ID: %s" % network.id) self.debug("Created network with ID: %s" % network.id)
networks= Network.list( networks = Network.list(
self.apiclient, self.apiclient,
projectid=project.id, projectid=project.id,
listall=True listall=True
) )
self.assertEqual( self.assertEqual(
isinstance(networks, list), isinstance(networks, list),
True, True,
"Check for the valid network list response" "Check for the valid network list response"
) )
network_response = networks[0] network_response = networks[0]
self.debug("Deploying VM with network: %s" % network.id) self.debug("Deploying VM with network: %s" % network.id)
virtual_machine = VirtualMachine.create( virtual_machine = VirtualMachine.create(
self.apiclient, self.apiclient,
self.services["server"], self.services["server"],
@ -466,24 +469,24 @@ class TestNetwork(cloudstackTestCase):
displaytext='Offering for Shared networks' displaytext='Offering for Shared networks'
) )
self.assertEqual( self.assertEqual(
isinstance(network_offerings, list), isinstance(network_offerings, list),
True, True,
"Check for the valid network offerings" "Check for the valid network offerings"
) )
network_offering = network_offerings[0] network_offering = network_offerings[0]
self.debug("creating a shared network in domain: %s" % self.debug("creating a shared network in domain: %s" %
self.domain.id) self.domain.id)
domain_network = Network.create( domain_network = Network.create(
self.apiclient, self.apiclient,
self.services["domain_network"], self.services["domain_network"],
domainid=self.domain.id, domainid=self.domain.id,
networkofferingid=network_offering.id, networkofferingid=network_offering.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
self._cleanup.append(domain_network) self._cleanup.append(domain_network)
self.debug("Created network with ID: %s" % domain_network.id) self.debug("Created network with ID: %s" % domain_network.id)
virtual_machine = VirtualMachine.create( virtual_machine = VirtualMachine.create(
self.apiclient, self.apiclient,
self.services["server"], self.services["server"],
@ -583,17 +586,16 @@ class TestTemplates(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_04_public_template_use_in_project(self): def test_04_public_template_use_in_project(self):
"""Test Templates creation in projects """Test Templates creation in projects
""" """
# Validate the following
# 1. Create a project # 1. Create a project
# 2. Verify Public templates can be used without any restriction # 2. Verify Public templates can be used without any restriction
# 3. Verify that template created in project can be used in project # 3. Verify that template created in project can be used in project
# without any restrictions # without any restrictions
self.debug("Deploying VM for with public template: %s" % self.debug("Deploying VM for with public template: %s" %
self.template.id) self.template.id)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -642,18 +644,17 @@ class TestTemplates(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_05_use_private_template_in_project(self): def test_05_use_private_template_in_project(self):
"""Test use of private template in a project """Test use of private template in a project
""" """
# Validate the following
# 1. Create a project # 1. Create a project
# 2. Verify that in order to use somebodys Private template for vm # 2. Verify that in order to use somebodys Private template for vm
# creation in the project, permission to use the template has to # creation in the project, permission to use the template has to
# be granted to the Project (use API “updateTemplatePermissions” # be granted to the Project (use API “updateTemplatePermissions”
# with project id to achieve that). # with project id to achieve that).
self.debug("Deploying VM for with public template: %s" % self.debug("Deploying VM for with public template: %s" %
self.template.id) self.template.id)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -701,7 +702,7 @@ class TestTemplates(cloudstackTestCase):
True, True,
"Check Template is in ready state or not" "Check Template is in ready state or not"
) )
# Update template permissions to grant permission to project # Update template permissions to grant permission to project
self.debug( self.debug(
"Updating template permissions:%s to grant access to project: %s" % ( "Updating template permissions:%s to grant access to project: %s" % (
@ -714,7 +715,7 @@ class TestTemplates(cloudstackTestCase):
op='add', op='add',
projectids=self.project.id projectids=self.project.id
) )
self.debug("Deploying VM for with privileged template: %s" % self.debug("Deploying VM for with privileged template: %s" %
self.template.id) self.template.id)
virtual_machine_2 = VirtualMachine.create( virtual_machine_2 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -808,10 +809,11 @@ class TestSnapshots(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_06_create_snapshots_in_project(self): def test_06_create_snapshots_in_project(self):
"""Test create snapshots in project """Test create snapshots in project
""" """
# Validate the following # Validate the following
# 1. Create a project # 1. Create a project
# 2. Add some snapshots to the project # 2. Add some snapshots to the project
@ -864,7 +866,7 @@ class TestSnapshots(cloudstackTestCase):
True, True,
"Check Snapshot state is Running or not" "Check Snapshot state is Running or not"
) )
snapshots = Snapshot.list( snapshots = Snapshot.list(
self.apiclient, self.apiclient,
account=self.account.account.name, account=self.account.account.name,
@ -929,7 +931,7 @@ class TestPublicIpAddress(cloudstackTestCase):
serviceofferingid=cls.service_offering.id, serviceofferingid=cls.service_offering.id,
projectid=cls.project.id projectid=cls.project.id
) )
cls._cleanup = [ cls._cleanup = [
cls.project, cls.project,
cls.service_offering, cls.service_offering,
@ -961,10 +963,10 @@ class TestPublicIpAddress(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns"])
def test_07_associate_public_ip(self): def test_07_associate_public_ip(self):
"""Test associate public IP within the project """Test associate public IP within the project
""" """
# Validate the following # Validate the following
# 1. Create a project # 1. Create a project
# 2. Add some public Ips to the project # 2. Add some public Ips to the project
@ -972,7 +974,7 @@ class TestPublicIpAddress(cloudstackTestCase):
# inside project # inside project
networks = Network.list( networks = Network.list(
self.apiclient, self.apiclient,
projectid=self.project.id, projectid=self.project.id,
listall=True listall=True
) )
@ -996,10 +998,10 @@ class TestPublicIpAddress(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
self.cleanup.append(public_ip) self.cleanup.append(public_ip)
#Create NAT rule #Create NAT rule
self.debug( self.debug(
"Creating a NAT rule within project, VM ID: %s" % "Creating a NAT rule within project, VM ID: %s" %
self.virtual_machine.id) self.virtual_machine.id)
nat_rule = NATRule.create( nat_rule = NATRule.create(
self.apiclient, self.apiclient,
@ -1028,9 +1030,9 @@ class TestPublicIpAddress(cloudstackTestCase):
nat_rule.id, nat_rule.id,
"Check Correct Port forwarding Rule is returned" "Check Correct Port forwarding Rule is returned"
) )
#Create Load Balancer rule and assign VMs to rule #Create Load Balancer rule and assign VMs to rule
self.debug("Created LB rule for public IP: %s" % self.debug("Created LB rule for public IP: %s" %
public_ip.ipaddress.ipaddress) public_ip.ipaddress.ipaddress)
lb_rule = LoadBalancerRule.create( lb_rule = LoadBalancerRule.create(
self.apiclient, self.apiclient,
@ -1065,7 +1067,7 @@ class TestPublicIpAddress(cloudstackTestCase):
lb_rule.id, lb_rule.id,
"Check List Load Balancer Rules returns valid Rule" "Check List Load Balancer Rules returns valid Rule"
) )
#Create Firewall rule with configurations from settings file #Create Firewall rule with configurations from settings file
fw_rule = FireWallRule.create( fw_rule = FireWallRule.create(
self.apiclient, self.apiclient,
@ -1077,7 +1079,7 @@ class TestPublicIpAddress(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
self.debug("Created firewall rule: %s" % fw_rule.id) self.debug("Created firewall rule: %s" % fw_rule.id)
# After Router start, FW rule should be in Active state # After Router start, FW rule should be in Active state
fw_rules = FireWallRule.list( fw_rules = FireWallRule.list(
self.apiclient, self.apiclient,
@ -1088,7 +1090,7 @@ class TestPublicIpAddress(cloudstackTestCase):
True, True,
"Check for list FW rules response return valid data" "Check for list FW rules response return valid data"
) )
self.assertEqual( self.assertEqual(
fw_rules[0].state, fw_rules[0].state,
'Active', 'Active',
@ -1105,7 +1107,7 @@ class TestPublicIpAddress(cloudstackTestCase):
str(self.services["fw_rule"]["endport"]), str(self.services["fw_rule"]["endport"]),
"Check end port of firewall rule" "Check end port of firewall rule"
) )
self.debug("Deploying VM for account: %s" % self.account.account.name) self.debug("Deploying VM for account: %s" % self.account.account.name)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -1116,7 +1118,7 @@ class TestPublicIpAddress(cloudstackTestCase):
serviceofferingid=self.service_offering.id, serviceofferingid=self.service_offering.id,
) )
self.cleanup.append(virtual_machine_1) self.cleanup.append(virtual_machine_1)
self.debug("VM state after deploy: %s" % virtual_machine_1.state) self.debug("VM state after deploy: %s" % virtual_machine_1.state)
# Verify VM state # Verify VM state
self.assertEqual( self.assertEqual(
@ -1124,7 +1126,7 @@ class TestPublicIpAddress(cloudstackTestCase):
'Running', 'Running',
"Check VM state is Running or not" "Check VM state is Running or not"
) )
self.debug("Creating NAT rule for VM (ID: %s) outside project" % self.debug("Creating NAT rule for VM (ID: %s) outside project" %
virtual_machine_1.id) virtual_machine_1.id)
with self.assertRaises(Exception): with self.assertRaises(Exception):
@ -1134,7 +1136,7 @@ class TestPublicIpAddress(cloudstackTestCase):
self.services["natrule"], self.services["natrule"],
public_ip.ipaddress.id, public_ip.ipaddress.id,
) )
self.debug("Creating LB rule for public IP: %s outside project" % self.debug("Creating LB rule for public IP: %s outside project" %
public_ip.ipaddress.ipaddress) public_ip.ipaddress.ipaddress)
with self.assertRaises(Exception): with self.assertRaises(Exception):
@ -1160,7 +1162,7 @@ class TestPublicIpAddress(cloudstackTestCase):
class TestSecurityGroup(cloudstackTestCase): class TestSecurityGroup(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
@ -1189,7 +1191,7 @@ class TestSecurityGroup(cloudstackTestCase):
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services) cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
template = get_template( template = get_template(
cls.api_client, cls.api_client,
cls.zone.id, cls.zone.id,
@ -1198,7 +1200,7 @@ class TestSecurityGroup(cloudstackTestCase):
cls.services["domainid"] = cls.domain.id cls.services["domainid"] = cls.domain.id
cls.services["server"]["zoneid"] = cls.zone.id cls.services["server"]["zoneid"] = cls.zone.id
cls.services["server"]["template"] = template.id cls.services["server"]["template"] = template.id
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
@ -1237,10 +1239,10 @@ class TestSecurityGroup(cloudstackTestCase):
return return
@attr(tags = ["sg", "eip"])
def test_08_security_group(self): def test_08_security_group(self):
"""Test security groups in project """Test security groups in project
""" """
# Validate the following: # Validate the following:
# 1. Create a project # 1. Create a project
# 2. Assign some security groups to that project # 2. Assign some security groups to that project
@ -1248,8 +1250,8 @@ class TestSecurityGroup(cloudstackTestCase):
# to that project. # to that project.
security_group = SecurityGroup.create( security_group = SecurityGroup.create(
self.apiclient, self.apiclient,
self.services["security_group"], self.services["security_group"],
projectid=self.project.id projectid=self.project.id
) )
self.debug("Created security group with ID: %s" % security_group.id) self.debug("Created security group with ID: %s" % security_group.id)
@ -1263,16 +1265,16 @@ class TestSecurityGroup(cloudstackTestCase):
True, True,
"Check for list security groups response" "Check for list security groups response"
) )
self.assertNotEqual( self.assertNotEqual(
len(sercurity_groups), len(sercurity_groups),
0, 0,
"Check List Security groups response" "Check List Security groups response"
) )
# Authorize Security group to SSH to VM # Authorize Security group to SSH to VM
ingress_rule = security_group.authorize( ingress_rule = security_group.authorize(
self.apiclient, self.apiclient,
self.services["security_group"], self.services["security_group"],
projectid=self.project.id projectid=self.project.id
) )
self.assertEqual( self.assertEqual(
@ -1280,9 +1282,9 @@ class TestSecurityGroup(cloudstackTestCase):
True, True,
"Check ingress rule created properly" "Check ingress rule created properly"
) )
self.debug( self.debug(
"Authorizing ingress rule for sec group ID: %s for ssh access" "Authorizing ingress rule for sec group ID: %s for ssh access"
% security_group.id) % security_group.id)
self.virtual_machine = VirtualMachine.create( self.virtual_machine = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -1296,8 +1298,8 @@ class TestSecurityGroup(cloudstackTestCase):
self.project.id self.project.id
)) ))
self.assertEqual( self.assertEqual(
self.virtual_machine.state, self.virtual_machine.state,
'Running', 'Running',
"VM state should be running after deployment" "VM state should be running after deployment"
) )
# Deploy another VM with same security group outside the project # Deploy another VM with same security group outside the project

View File

@ -18,14 +18,16 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
class Services: class Services:
"""Test Snapshots Services """Test Snapshots Services
""" """
@ -39,7 +41,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"project": { "project": {
"name": "Project", "name": "Project",
@ -49,8 +51,8 @@ class Services:
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
@ -73,7 +75,7 @@ class Services:
"templates": { "templates": {
"displaytext": 'Template', "displaytext": 'Template',
"name": 'Template', "name": 'Template',
"ostypeid": '471a4b5b-5523-448f-9608-7d6218995733', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2" "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
}, },
@ -85,7 +87,7 @@ class Services:
"isextractable": True, "isextractable": True,
"isfeatured": True, "isfeatured": True,
"ispublic": True, "ispublic": True,
"ostypeid": '471a4b5b-5523-448f-9608-7d6218995733', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
}, },
"lbrule": { "lbrule": {
"name": "SSH", "name": "SSH",
@ -103,11 +105,11 @@ class Services:
"username": "test", "username": "test",
"password": "test", "password": "test",
}, },
"ostypeid": '471a4b5b-5523-448f-9608-7d6218995733', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode":'advanced' "mode": 'advanced'
} }
@ -141,14 +143,14 @@ class TestVmUsage(cloudstackTestCase):
) )
cls.services["account"] = cls.account.account.name cls.services["account"] = cls.account.account.name
cls.project = Project.create( cls.project = Project.create(
cls.api_client, cls.api_client,
cls.services["project"], cls.services["project"],
account=cls.account.account.name, account=cls.account.account.name,
domainid=cls.account.account.domainid domainid=cls.account.account.domainid
) )
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
@ -190,10 +192,10 @@ class TestVmUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_vm_usage(self): def test_01_vm_usage(self):
"""Test Create/Destroy VM and verify usage calculation """Test Create/Destroy VM and verify usage calculation
""" """
# Validate the following # Validate the following
# 1. Create a VM. Verify usage_events table contains VM .create, # 1. Create a VM. Verify usage_events table contains VM .create,
# VM.start , Network.offering.assign , Volume.create events # VM.start , Network.offering.assign , Volume.create events
@ -206,17 +208,17 @@ class TestVmUsage(cloudstackTestCase):
self.debug("Stopping the VM: %s" % self.virtual_machine.id) self.debug("Stopping the VM: %s" % self.virtual_machine.id)
# Stop the VM # Stop the VM
self.virtual_machine.stop(self.apiclient) self.virtual_machine.stop(self.apiclient)
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
# Destroy the VM # Destroy the VM
self.debug("Destroying the VM: %s" % self.virtual_machine.id) self.debug("Destroying the VM: %s" % self.virtual_machine.id)
self.virtual_machine.delete(self.apiclient) self.virtual_machine.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -226,7 +228,7 @@ class TestVmUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -237,7 +239,7 @@ class TestVmUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -247,7 +249,7 @@ class TestVmUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -335,14 +337,14 @@ class TestPublicIPUsage(cloudstackTestCase):
) )
cls.services["account"] = cls.account.account.name cls.services["account"] = cls.account.account.name
cls.project = Project.create( cls.project = Project.create(
cls.api_client, cls.api_client,
cls.services["project"], cls.services["project"],
account=cls.account.account.name, account=cls.account.account.name,
domainid=cls.account.account.domainid domainid=cls.account.account.domainid
) )
cls.service_offering = ServiceOffering.create( cls.service_offering = ServiceOffering.create(
cls.api_client, cls.api_client,
cls.services["service_offering"] cls.services["service_offering"]
@ -355,7 +357,7 @@ class TestPublicIPUsage(cloudstackTestCase):
projectid=cls.project.id projectid=cls.project.id
) )
networks = Network.list( networks = Network.list(
cls.api_client, cls.api_client,
projectid=cls.project.id, projectid=cls.project.id,
listall=True listall=True
) )
@ -401,10 +403,10 @@ class TestPublicIPUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "eip", "advancedns", "simulator"])
def test_01_public_ip_usage(self): def test_01_public_ip_usage(self):
"""Test Assign new IP and verify usage calculation """Test Assign new IP and verify usage calculation
""" """
# Validate the following # Validate the following
# 1. Acquire a IP for the network of this account. Verify usage_event # 1. Acquire a IP for the network of this account. Verify usage_event
# table has Acquire IP event for the IP for this account # table has Acquire IP event for the IP for this account
@ -412,17 +414,17 @@ class TestPublicIPUsage(cloudstackTestCase):
# has IP.Release event for released IP for this account # has IP.Release event for released IP for this account
# 3. Delete the newly created account # 3. Delete the newly created account
self.debug("Deleting public IP: %s" % self.debug("Deleting public IP: %s" %
self.public_ip.ipaddress.ipaddress) self.public_ip.ipaddress.ipaddress)
# Release one of the IP # Release one of the IP
self.public_ip.delete(self.apiclient) self.public_ip.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -442,12 +444,12 @@ class TestPublicIPUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
@ -559,10 +561,10 @@ class TestVolumeUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_volume_usage(self): def test_01_volume_usage(self):
"""Test Create/delete a volume and verify correct usage is recorded """Test Create/delete a volume and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Volume.create event for both root and data disk is there for the # 1. Volume.create event for both root and data disk is there for the
# created account in cloud.usage_event table # created account in cloud.usage_event table
@ -582,8 +584,8 @@ class TestVolumeUsage(cloudstackTestCase):
listall=True listall=True
) )
self.assertEqual( self.assertEqual(
isinstance(volume_response, list), isinstance(volume_response, list),
True, True,
"Check for valid list volumes response" "Check for valid list volumes response"
) )
data_volume = volume_response[0] data_volume = volume_response[0]
@ -601,11 +603,11 @@ class TestVolumeUsage(cloudstackTestCase):
cmd.id = data_volume.id cmd.id = data_volume.id
self.apiclient.deleteVolume(cmd) self.apiclient.deleteVolume(cmd)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -615,7 +617,7 @@ class TestVolumeUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -626,12 +628,12 @@ class TestVolumeUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -642,7 +644,7 @@ class TestVolumeUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table # Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
@ -717,7 +719,7 @@ class TestTemplateUsage(cloudstackTestCase):
type='ROOT', type='ROOT',
listall=True listall=True
) )
if isinstance(list_volume, list): if isinstance(list_volume, list):
cls.volume = list_volume[0] cls.volume = list_volume[0]
else: else:
raise Exception("List Volumes failed!") raise Exception("List Volumes failed!")
@ -750,11 +752,11 @@ class TestTemplateUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_01_template_usage(self): def test_01_template_usage(self):
"""Test Upload/ delete a template and verify correct usage is generated """Test Upload/ delete a template and verify correct usage is generated
for the template uploaded for the template uploaded
""" """
# Validate the following # Validate the following
# 1. Create a account # 1. Create a account
# 2. Upload a template from this account. template.create event is # 2. Upload a template from this account. template.create event is
@ -775,11 +777,11 @@ class TestTemplateUsage(cloudstackTestCase):
self.template.delete(self.apiclient) self.template.delete(self.apiclient)
self.debug("Deleted template with ID: %s" % self.template.id) self.debug("Deleted template with ID: %s" % self.template.id)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -789,7 +791,7 @@ class TestTemplateUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -800,7 +802,7 @@ class TestTemplateUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -816,10 +818,10 @@ class TestTemplateUsage(cloudstackTestCase):
0, 0,
"Check DB Query result set" "Check DB Query result set"
) )
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table # Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
self.assertEqual( self.assertEqual(
qresult.count('TEMPLATE.CREATE'), qresult.count('TEMPLATE.CREATE'),
@ -846,7 +848,7 @@ class TestISOUsage(cloudstackTestCase):
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
cls.services["server"]["zoneid"] = cls.zone.id cls.services["server"]["zoneid"] = cls.zone.id
cls.services["iso"]["zoneid"] = cls.zone.id cls.services["iso"]["zoneid"] = cls.zone.id
# Create Account, ISO image etc # Create Account, ISO image etc
cls.account = Account.create( cls.account = Account.create(
cls.api_client, cls.api_client,
cls.services["account"], cls.services["account"],
@ -902,10 +904,10 @@ class TestISOUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_01_ISO_usage(self): def test_01_ISO_usage(self):
"""Test Create/Delete a ISO and verify its usage is generated correctly """Test Create/Delete a ISO and verify its usage is generated correctly
""" """
# Validate the following # Validate the following
# 1. Create a account # 1. Create a account
# 2. Upload a ISO from this account. ISO.create event is recorded in # 2. Upload a ISO from this account. ISO.create event is recorded in
@ -917,12 +919,12 @@ class TestISOUsage(cloudstackTestCase):
# Delete the ISO # Delete the ISO
self.debug("Deleting ISO with ID: %s" % self.iso.id) self.debug("Deleting ISO with ID: %s" % self.iso.id)
self.iso.delete(self.apiclient) self.iso.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -932,7 +934,7 @@ class TestISOUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -943,18 +945,18 @@ class TestISOUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -984,7 +986,7 @@ class TestLBRuleUsage(cloudstackTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.api_client = super( cls.api_client = super(
TestLBRuleUsage, TestLBRuleUsage,
cls cls
).getClsTestClient().getApiClient() ).getClsTestClient().getApiClient()
cls.services = Services().services cls.services = Services().services
@ -1028,7 +1030,7 @@ class TestLBRuleUsage(cloudstackTestCase):
projectid=cls.project.id projectid=cls.project.id
) )
networks = Network.list( networks = Network.list(
cls.api_client, cls.api_client,
projectid=cls.project.id, projectid=cls.project.id,
listall=True listall=True
) )
@ -1074,10 +1076,10 @@ class TestLBRuleUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "eip", "advancedns", "simulator"])
def test_01_lb_usage(self): def test_01_lb_usage(self):
"""Test Create/Delete a LB rule and verify correct usage is recorded """Test Create/Delete a LB rule and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Acquire a IP for this account. lb.rule.create event is registered # 1. Acquire a IP for this account. lb.rule.create event is registered
# for this account in cloud.usage_event table # for this account in cloud.usage_event table
@ -1087,7 +1089,7 @@ class TestLBRuleUsage(cloudstackTestCase):
# 4. Delete this account. # 4. Delete this account.
self.debug( self.debug(
"Creating load balancer rule for public IP: %s" % "Creating load balancer rule for public IP: %s" %
self.public_ip_1.ipaddress.id) self.public_ip_1.ipaddress.id)
#Create Load Balancer rule and assign VMs to rule #Create Load Balancer rule and assign VMs to rule
lb_rule = LoadBalancerRule.create( lb_rule = LoadBalancerRule.create(
@ -1100,11 +1102,11 @@ class TestLBRuleUsage(cloudstackTestCase):
self.debug("Deleting LB rule with ID: %s" % lb_rule.id) self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
lb_rule.delete(self.apiclient) lb_rule.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -1114,7 +1116,7 @@ class TestLBRuleUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1125,7 +1127,7 @@ class TestLBRuleUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1146,7 +1148,7 @@ class TestLBRuleUsage(cloudstackTestCase):
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table # Check for LB.CREATE, LB.DELETE in cloud.usage_event table
self.assertEqual( self.assertEqual(
qresult.count('LB.CREATE'), qresult.count('LB.CREATE'),
1, 1,
@ -1240,11 +1242,12 @@ class TestSnapshotUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_snapshot_usage(self): def test_01_snapshot_usage(self):
"""Test Create/Delete a manual snap shot and verify """Test Create/Delete a manual snap shot and verify
correct usage is recorded correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Create snapshot of the root disk for this account.Snapshot.create # 1. Create snapshot of the root disk for this account.Snapshot.create
# event is there for the created account in cloud.usage_event table # event is there for the created account in cloud.usage_event table
@ -1252,7 +1255,7 @@ class TestSnapshotUsage(cloudstackTestCase):
# generated for the destroyed Snapshot # generated for the destroyed Snapshot
# 3. Delete the account # 3. Delete the account
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
self.apiclient, self.apiclient,
projectid=self.project.id, projectid=self.project.id,
@ -1264,7 +1267,7 @@ class TestSnapshotUsage(cloudstackTestCase):
True, True,
"Check if list volumes return a valid data" "Check if list volumes return a valid data"
) )
volume = volumes[0] volume = volumes[0]
# Create a snapshot from the ROOTDISK # Create a snapshot from the ROOTDISK
@ -1275,11 +1278,11 @@ class TestSnapshotUsage(cloudstackTestCase):
self.debug("Deleting snapshot: %s" % snapshot.id) self.debug("Deleting snapshot: %s" % snapshot.id)
snapshot.delete(self.apiclient) snapshot.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -1289,7 +1292,7 @@ class TestSnapshotUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1300,12 +1303,12 @@ class TestSnapshotUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
@ -1386,7 +1389,7 @@ class TestNatRuleUsage(cloudstackTestCase):
projectid=cls.project.id projectid=cls.project.id
) )
networks = Network.list( networks = Network.list(
cls.api_client, cls.api_client,
projectid=cls.project.id, projectid=cls.project.id,
listall=True listall=True
) )
@ -1432,10 +1435,10 @@ class TestNatRuleUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_01_nat_usage(self): def test_01_nat_usage(self):
"""Test Create/Delete a PF rule and verify correct usage is recorded """Test Create/Delete a PF rule and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Acquire a IP for this account # 1. Acquire a IP for this account
# 2. Create a PF rule on the IP associated with this account. # 2. Create a PF rule on the IP associated with this account.
@ -1445,7 +1448,7 @@ class TestNatRuleUsage(cloudstackTestCase):
# is registered for this account in cloud.usage_event table # is registered for this account in cloud.usage_event table
# 4. Delete this account. # 4. Delete this account.
self.debug("Creating NAT rule with public IP: %s" % self.debug("Creating NAT rule with public IP: %s" %
self.public_ip_1.ipaddress.id) self.public_ip_1.ipaddress.id)
#Create NAT rule #Create NAT rule
nat_rule = NATRule.create( nat_rule = NATRule.create(
@ -1459,11 +1462,11 @@ class TestNatRuleUsage(cloudstackTestCase):
self.debug("Deleting NAT rule: %s" % nat_rule.id) self.debug("Deleting NAT rule: %s" % nat_rule.id)
nat_rule.delete(self.apiclient) nat_rule.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -1473,7 +1476,7 @@ class TestNatRuleUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1484,7 +1487,7 @@ class TestNatRuleUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1569,7 +1572,7 @@ class TestVpnUsage(cloudstackTestCase):
projectid=cls.project.id projectid=cls.project.id
) )
networks = Network.list( networks = Network.list(
cls.api_client, cls.api_client,
projectid=cls.project.id, projectid=cls.project.id,
listall=True listall=True
) )
@ -1615,19 +1618,19 @@ class TestVpnUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_01_vpn_usage(self): def test_01_vpn_usage(self):
"""Test Create/Delete a VPN and verify correct usage is recorded """Test Create/Delete a VPN and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Enable VPN for this IP. vpn.add.user event is registered for this # 1. Enable VPN for this IP. vpn.add.user event is registered for this
# account in cloud.usage_event table # account in cloud.usage_event table
# 2. Add user to this vpn # 2. Add user to this vpn
# 3. Delete user for this VPN. vpn.user.delete event is registered for # 3. Delete user for this VPN. vpn.user.delete event is registered for
# this account in cloud.usage_event table # this account in cloud.usage_event table
# 4. Delete this account. # 4. Delete this account.
self.debug("Created VPN with public IP: %s" % self.debug("Created VPN with public IP: %s" %
self.public_ip.ipaddress.id) self.public_ip.ipaddress.id)
#Assign VPN to Public IP #Assign VPN to Public IP
vpn = Vpn.create( vpn = Vpn.create(
@ -1636,7 +1639,7 @@ class TestVpnUsage(cloudstackTestCase):
projectid=self.project.id projectid=self.project.id
) )
self.debug("Created VPN user for account: %s" % self.debug("Created VPN user for account: %s" %
self.account.account.name) self.account.account.name)
vpnuser = VpnUser.create( vpnuser = VpnUser.create(
@ -1654,11 +1657,11 @@ class TestVpnUsage(cloudstackTestCase):
self.debug("Deleting VPN: %s" % vpn.publicipid) self.debug("Deleting VPN: %s" % vpn.publicipid)
vpn.delete(self.apiclient) vpn.delete(self.apiclient)
# Fetch project account ID from project UUID # Fetch project account ID from project UUID
self.debug( self.debug(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id) % self.project.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select project_account_id from projects where uuid = '%s';" \ "select project_account_id from projects where uuid = '%s';" \
% self.project.id % self.project.id
@ -1668,7 +1671,7 @@ class TestVpnUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1679,7 +1682,7 @@ class TestVpnUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1698,8 +1701,8 @@ class TestVpnUsage(cloudstackTestCase):
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for VPN user related events # Check for VPN user related events
self.assertEqual( self.assertEqual(
qresult.count('VPN.USER.ADD'), qresult.count('VPN.USER.ADD'),
1, 1,

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
@ -25,6 +26,7 @@ from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
import datetime import datetime
class Services: class Services:
"""Test Resource Limits Services """Test Resource Limits Services
""" """
@ -41,14 +43,16 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100,
"memory": 64, # In MBs # in MHz
"memory": 64,
# In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
@ -71,16 +75,40 @@ class Services:
"template": { "template": {
"displaytext": "Cent OS Template", "displaytext": "Cent OS Template",
"name": "Cent OS Template", "name": "Cent OS Template",
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
}, },
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "network_offering": {
"name": 'Network offering',
"displaytext": 'Network offering',
"guestiptype": 'Isolated',
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
"traffictype": 'GUEST',
"availability": 'Optional',
"serviceProviderList": {
"Dhcp": 'VirtualRouter',
"Dns": 'VirtualRouter',
"SourceNat": 'VirtualRouter',
"PortForwarding": 'VirtualRouter',
"Vpn": 'VirtualRouter',
"Firewall": 'VirtualRouter',
"Lb": 'VirtualRouter',
"UserData": 'VirtualRouter',
"StaticNat": 'VirtualRouter',
},
},
"network": {
"name": "test network",
"displaytext": "test network"
},
"ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'advanced', "mode": 'advanced',
} }
class TestResourceLimitsAccount(cloudstackTestCase): class TestResourceLimitsAccount(cloudstackTestCase):
@classmethod @classmethod
@ -150,6 +178,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_01_vm_per_account(self): def test_01_vm_per_account(self):
"""Test VM limit per account """Test VM limit per account
""" """
@ -161,7 +190,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# 3. Try to start 2 VMs account 2. Verify 2 SM are started properly # 3. Try to start 2 VMs account 2. Verify 2 SM are started properly
self.debug( self.debug(
"Updating instance resource limit for account: %s" % "Updating instance resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -172,7 +201,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
max=1 max=1
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_1.account.name) self.account_1.account.name)
virtual_machine = VirtualMachine.create( virtual_machine = VirtualMachine.create(
@ -203,7 +232,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
serviceofferingid=self.service_offering.id serviceofferingid=self.service_offering.id
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_2.account.name) self.account_2.account.name)
# Start 2 instances for account_2 # Start 2 instances for account_2
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
@ -223,7 +252,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_2.account.name) self.account_2.account.name)
virtual_machine_2 = VirtualMachine.create( virtual_machine_2 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -242,6 +271,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_02_publicip_per_account(self): def test_02_publicip_per_account(self):
"""Test Public IP limit per account """Test Public IP limit per account
""" """
@ -254,9 +284,9 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# denied to acquire more than one IP. # denied to acquire more than one IP.
# 5. Acquire 2 IP in account 2. Verify account 2 should be able to # 5. Acquire 2 IP in account 2. Verify account 2 should be able to
# Acquire IP without any warning # Acquire IP without any warning
self.debug( self.debug(
"Updating public IP resource limit for account: %s" % "Updating public IP resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -268,7 +298,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_1.account.name) self.account_1.account.name)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -287,7 +317,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_2.account.name) self.account_2.account.name)
# Create VM for second account # Create VM for second account
virtual_machine_2 = VirtualMachine.create( virtual_machine_2 = VirtualMachine.create(
@ -306,7 +336,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
"Check VM state is Running or not" "Check VM state is Running or not"
) )
self.debug( self.debug(
"Associating public IP for account: %s" % "Associating public IP for account: %s" %
virtual_machine_1.account) virtual_machine_1.account)
public_ip_1 = PublicIPAddress.create( public_ip_1 = PublicIPAddress.create(
self.apiclient, self.apiclient,
@ -341,7 +371,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Associating public IP for account: %s" % "Associating public IP for account: %s" %
virtual_machine_2.account) virtual_machine_2.account)
# Assign Public IP for account 2 # Assign Public IP for account 2
public_ip_3 = PublicIPAddress.create( public_ip_3 = PublicIPAddress.create(
@ -363,7 +393,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
"Check Public IP state is allocated or not" "Check Public IP state is allocated or not"
) )
self.debug( self.debug(
"Associating public IP for account: %s" % "Associating public IP for account: %s" %
virtual_machine_2.account) virtual_machine_2.account)
public_ip_4 = PublicIPAddress.create( public_ip_4 = PublicIPAddress.create(
self.apiclient, self.apiclient,
@ -384,6 +414,8 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
return return
@attr(speed="slow")
@attr(tags=["advanced", "advancedns", "simulator"])
def test_03_snapshots_per_account(self): def test_03_snapshots_per_account(self):
"""Test Snapshot limit per account """Test Snapshot limit per account
""" """
@ -398,7 +430,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# create snapshots without any warning # create snapshots without any warning
self.debug( self.debug(
"Updating public IP resource limit for account: %s" % "Updating public IP resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -410,7 +442,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_1.account.name) self.account_1.account.name)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -429,7 +461,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying VM instance in account: %s" % "Deploying VM instance in account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Create VM for second account # Create VM for second account
virtual_machine_2 = VirtualMachine.create( virtual_machine_2 = VirtualMachine.create(
@ -501,7 +533,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
"Check for list volume response return valid data" "Check for list volume response return valid data"
) )
volume = volumes[0] volume = volumes[0]
self.debug("Creating snapshot from volume: %s" % volumes[0].id) self.debug("Creating snapshot from volume: %s" % volumes[0].id)
# Create a snapshot from the ROOTDISK (Account 2) # Create a snapshot from the ROOTDISK (Account 2)
snapshot_2 = Snapshot.create(self.apiclient, snapshot_2 = Snapshot.create(self.apiclient,
@ -539,6 +571,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_04_volumes_per_account(self): def test_04_volumes_per_account(self):
"""Test Volumes limit per account """Test Volumes limit per account
""" """
@ -553,7 +586,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# create Volume without any warning # create Volume without any warning
self.debug( self.debug(
"Updating volume resource limit for account: %s" % "Updating volume resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -680,6 +713,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns"])
def test_05_templates_per_account(self): def test_05_templates_per_account(self):
"""Test Templates limit per account """Test Templates limit per account
""" """
@ -692,7 +726,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
# able to create template without any error # able to create template without any error
self.debug( self.debug(
"Updating template resource limit for account: %s" % "Updating template resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -704,7 +738,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Updating volume resource limit for account: %s" % "Updating volume resource limit for account: %s" %
self.account_1.account.name) self.account_1.account.name)
virtual_machine_1 = VirtualMachine.create( virtual_machine_1 = VirtualMachine.create(
self.apiclient, self.apiclient,
@ -723,7 +757,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
) )
self.debug( self.debug(
"Deploying virtual machine for account: %s" % "Deploying virtual machine for account: %s" %
self.account_2.account.name) self.account_2.account.name)
# Create VM for second account # Create VM for second account
virtual_machine_2 = VirtualMachine.create( virtual_machine_2 = VirtualMachine.create(
@ -909,6 +943,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_01_vm_per_domain(self): def test_01_vm_per_domain(self):
"""Test VM limit per domain """Test VM limit per domain
""" """
@ -920,7 +955,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# should be raised # should be raised
self.debug( self.debug(
"Updating instance resource limits for domain: %s" % "Updating instance resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -974,6 +1009,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_01_publicip_per_domain(self): def test_01_publicip_per_domain(self):
"""Test Public IP limit per domain """Test Public IP limit per domain
""" """
@ -987,7 +1023,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# appropriate error and an alert should be generated. # appropriate error and an alert should be generated.
self.debug( self.debug(
"Updating public IP resource limits for domain: %s" % "Updating public IP resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -1043,6 +1079,8 @@ class TestResourceLimitsDomain(cloudstackTestCase):
) )
return return
@attr(speed="slow")
@attr(tags=["advanced", "advancedns", "simulator"])
def test_03_snapshots_per_domain(self): def test_03_snapshots_per_domain(self):
"""Test Snapshot limit per domain """Test Snapshot limit per domain
""" """
@ -1057,7 +1095,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# user an appropriate error and an alert should be generated. # user an appropriate error and an alert should be generated.
self.debug( self.debug(
"Updating snapshot resource limits for domain: %s" % "Updating snapshot resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -1125,6 +1163,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns", "simulator"])
def test_04_volumes_per_domain(self): def test_04_volumes_per_domain(self):
"""Test Volumes limit per domain """Test Volumes limit per domain
""" """
@ -1138,7 +1177,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
# should be generated. # should be generated.
self.debug( self.debug(
"Updating volume resource limits for domain: %s" % "Updating volume resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -1177,11 +1216,12 @@ class TestResourceLimitsDomain(cloudstackTestCase):
) )
return return
@attr(tags=["advanced", "advancedns"])
def test_05_templates_per_domain(self): def test_05_templates_per_domain(self):
"""Test Templates limit per domain """Test Templates limit per domain
""" """
# Validate the following # Validate the following
# 1. set max no of templates per domain to 2. # 1. set max no of templates per domain to 2.
# 2. Create an account in this domain # 2. Create an account in this domain
# 3. Create 2 templates in this domain. Both template should be in # 3. Create 2 templates in this domain. Both template should be in
@ -1198,7 +1238,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
) )
self.debug( self.debug(
"Updating template resource limits for domain: %s" % "Updating template resource limits for domain: %s" %
self.account.account.domainid) self.account.account.domainid)
# Set usage_vm=1 for Account 1 # Set usage_vm=1 for Account 1
update_resource_limit( update_resource_limit(
@ -1286,19 +1326,41 @@ class TestResourceLimitsDomain(cloudstackTestCase):
return return
class TestResources(cloudstackTestCase): class TestMaxAccountNetworks(cloudstackTestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.api_client = super( cls.api_client = super(
TestResources, TestMaxAccountNetworks,
cls cls
).getClsTestClient().getApiClient() ).getClsTestClient().getApiClient()
cls.services = Services().services cls.services = Services().services
# Get Zone, Domain and templates # Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
cls._cleanup = [] cls.template = get_template(
return cls.api_client,
cls.zone.id,
cls.services["ostypeid"]
)
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls.network_offering = NetworkOffering.create(
cls.api_client,
cls.services["network_offering"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
cls._cleanup = [
cls.service_offering,
cls.network_offering
]
return
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
@ -1312,165 +1374,80 @@ class TestResources(cloudstackTestCase):
def setUp(self): def setUp(self):
self.apiclient = self.testClient.getApiClient() self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
self.cleanup = [] self.cleanup = []
return return
def tearDown(self): def tearDown(self):
try: try:
#Clean up, terminate the created instance, volumes and snapshots self.account.delete(self.apiclient)
interval = list_configurations(
self.apiclient,
name='account.cleanup.interval'
)
# Sleep to ensure that all resources are deleted
time.sleep(int(interval[0].value) * 2)
#Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.apiclient, self.cleanup)
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
def test_01_zones(self): @attr(tags=["advanced", "advancedns", "simulator",
"""Check the status of zones""" "api", "basic", "eip", "sg"])
def test_maxAccountNetworks(self):
# Validate the following """Test Limit number of guest account specific networks
# 1. List zones """
# 2. Check allocation state is "enabled" or not
zones = Zone.list(
self.apiclient,
id=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(zones, list),
True,
"Check if listZones returns a valid response"
)
for zone in zones:
self.assertEqual(
zone.allocationstate,
'Enabled',
"Zone allocation state should be enabled"
)
return
def test_02_pods(self): # Steps for validation
"""Check the status of pods""" # 1. Fetch max.account.networks from configurations
# 2. Create an account. Create account more that max.accout.network
# Validate the following # 3. Create network should fail
# 1. List pods
# 2. Check allocation state is "enabled" or not config = Configurations.list(
self.apiclient,
pods = Pod.list( name='max.account.networks',
self.apiclient, listall=True
zoneid=self.zone.id, )
listall=True
)
self.assertEqual( self.assertEqual(
isinstance(pods, list), isinstance(config, list),
True, True,
"Check if listPods returns a valid response" "List configurations should have max.account.networks"
) )
for pod in pods:
self.assertEqual( config_value = int(config[0].value)
pod.allocationstate, self.debug("max.account.networks: %s" % config_value)
'Enabled',
"Pods allocation state should be enabled" for ctr in range(config_value):
) # Creating network using the network offering created
return self.debug("Creating network with network offering: %s" %
self.network_offering.id)
def test_03_clusters(self): network = Network.create(
"""Check the status of clusters""" self.apiclient,
self.services["network"],
# Validate the following accountid=self.account.account.name,
# 1. List clusters domainid=self.account.account.domainid,
# 2. Check allocation state is "enabled" or not networkofferingid=self.network_offering.id,
zoneid=self.zone.id
clusters = Cluster.list( )
self.apiclient, self.debug("Created network with ID: %s" % network.id)
zoneid=self.zone.id, self.debug(
listall=True "Creating network in account already having networks : %s" %
) config_value)
self.assertEqual(
isinstance(clusters, list), with self.assertRaises(Exception):
True, Network.create(
"Check if listClusters returns a valid response" self.apiclient,
) self.services["network"],
for cluster in clusters: accountid=self.account.account.name,
self.assertEqual( domainid=self.account.account.domainid,
cluster.allocationstate, networkofferingid=self.network_offering.id,
'Enabled', zoneid=self.zone.id
"Clusters allocation state should be enabled" )
) self.debug('Create network failed (as expected)')
return
def test_04_hosts(self):
"""Check the status of hosts"""
# Validate the following
# 1. List hosts with type=Routing
# 2. Check state is "Up" or not
hosts = Host.list(
self.apiclient,
zoneid=self.zone.id,
type='Routing',
listall=True
)
self.assertEqual(
isinstance(hosts, list),
True,
"Check if listHosts returns a valid response"
)
for host in hosts:
self.assertEqual(
host.state,
'Up',
"Host should be in Up state and running"
)
return
def test_05_storage_pools(self):
"""Check the status of Storage pools"""
# Validate the following
# 1. List storage pools for the zone
# 2. Check state is "enabled" or not
storage_pools = StoragePool.list(
self.apiclient,
zoneid=self.zone.id,
listall=True
)
self.assertEqual(
isinstance(storage_pools, list),
True,
"Check if listStoragePools returns a valid response"
)
for storage_pool in storage_pools:
self.assertEqual(
storage_pool.state,
'Up',
"storage pool should be in Up state and running"
)
return
def test_06_secondary_storage(self):
"""Check the status of secondary storage"""
# Validate the following
# 1. List secondary storage
# 2. Check state is "Up" or not
sec_storages = Host.list(
self.apiclient,
zoneid=self.zone.id,
type='SecondaryStorage',
listall=True
)
self.assertEqual(
isinstance(sec_storages, list),
True,
"Check if listHosts returns a valid response"
)
for sec_storage in sec_storages:
self.assertEqual(
sec_storage.state,
'Up',
"Secondary storage should be in Up state"
)
return return

View File

@ -18,12 +18,13 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from marvin import remoteSSHClient
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin.remoteSSHClient import remoteSSHClient
#Import System modules #Import System modules
import time import time
@ -57,7 +58,7 @@ class Services:
}, },
"host": { "host": {
"username": "root", "username": "root",
"password": "fr3sca", "password": "password",
"publicport": 22, "publicport": 22,
}, },
"account": { "account": {
@ -80,16 +81,17 @@ class Services:
# Algorithm used for load balancing # Algorithm used for load balancing
"privateport": 22, "privateport": 22,
"publicport": 2222, "publicport": 2222,
"protocol": 'TCP',
}, },
"fw_rule":{ "fw_rule": {
"startport": 1, "startport": 1,
"endport": 6000, "endport": 6000,
"cidr": '55.55.0.0/11', "cidr": '55.55.0.0/11',
# Any network (For creating FW rule # Any network (For creating FW rule
}, },
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Used for Get_Template : CentOS 5.3 (64 bit) # Used for Get_Template : CentOS 5.3 (64 bit)
"mode": 'advanced', # Networking mode: Advanced, basic "mode": 'advanced', # Networking mode: Advanced, basic
} }
@ -166,10 +168,10 @@ class TestRouterServices(cloudstackTestCase):
self._cleanup = [] self._cleanup = []
return return
@attr(tags = ["advanced"])
def test_01_AdvancedZoneRouterServices(self): def test_01_AdvancedZoneRouterServices(self):
"""Test advanced zone router services """Test advanced zone router services
""" """
# Validate the following: # Validate the following:
# 1. Verify that list of services provided by this network are running # 1. Verify that list of services provided by this network are running
# a. DNS # a. DNS
@ -179,7 +181,7 @@ class TestRouterServices(cloudstackTestCase):
# e. LB # e. LB
# f. VPN # f. VPN
# g. userdata # g. userdata
# 2. wait for router to start and guest network to be created # 2. wait for router to start and guest network to be created
# a. listRouters account=user, domainid=1 (router state=Running) # a. listRouters account=user, domainid=1 (router state=Running)
# b. listNetworks account=user domainid=1 (network state=Implemented) # b. listNetworks account=user domainid=1 (network state=Implemented)
# c. listVirtualMachines account=user domainid=1 (VM state=Running) # c. listVirtualMachines account=user domainid=1 (VM state=Running)
@ -312,12 +314,13 @@ class TestRouterServices(cloudstackTestCase):
) )
return return
@attr(configuration = "network.gc")
@attr(tags = ["advanced"])
def test_02_NetworkGarbageCollection(self): def test_02_NetworkGarbageCollection(self):
"""Test network garbage collection """Test network garbage collection
""" """
# Validate the following # Validate the following
# 1. wait for router to start and guest network to be created # 1. wait for router to start and guest network to be created
# a.listRouters account=user, domainid=1 (router state=Running) # a.listRouters account=user, domainid=1 (router state=Running)
# b.listNetworks account=user domainid=1 (network state=Implemented) # b.listNetworks account=user domainid=1 (network state=Implemented)
# c.listVirtualMachines account=user domainid=1 (VM states=Running) # c.listVirtualMachines account=user domainid=1 (VM states=Running)
@ -435,9 +438,9 @@ class TestRouterServices(cloudstackTestCase):
) )
self.debug("network.gc.wait: %s" % gcwait[0].value) self.debug("network.gc.wait: %s" % gcwait[0].value)
total_wait = int(gcinterval[0].value) + int (gcwait[0].value) total_wait = int(gcinterval[0].value) + int(gcwait[0].value)
# Router is stopped after (network.gc.interval *2) time. Wait for # Router is stopped after (network.gc.interval *2) time. Wait for
# (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped' # (network.gc.interval+network.gc.wait) * 2 for moving router to 'Stopped'
time.sleep(total_wait * 2) time.sleep(total_wait * 2)
routers = list_routers( routers = list_routers(
@ -470,6 +473,7 @@ class TestRouterServices(cloudstackTestCase):
self._cleanup.append(self.vm_2) self._cleanup.append(self.vm_2)
return return
@attr(tags = ["advanced"])
def test_03_RouterStartOnVmDeploy(self): def test_03_RouterStartOnVmDeploy(self):
"""Test router start on VM deploy """Test router start on VM deploy
""" """
@ -578,7 +582,6 @@ class TestRouterServices(cloudstackTestCase):
return return
class TestRouterStopCreatePF(cloudstackTestCase): class TestRouterStopCreatePF(cloudstackTestCase):
@classmethod @classmethod
@ -645,20 +648,20 @@ class TestRouterStopCreatePF(cloudstackTestCase):
self._cleanup = [] self._cleanup = []
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_RouterStopCreatePF(self): def test_01_RouterStopCreatePF(self):
"""Test router stop create port forwarding """Test router stop create port forwarding
""" """
# validate the following # validate the following
# 1. wait for router to start, guest network to be implemented and # 1. wait for router to start, guest network to be implemented and
# VM to report Running # VM to report Running
# 2. stopRouter for this account # 2. stopRouter for this account
# 3. wait for listRouters to report Router as 'Stopped' # 3. wait for listRouters to report Router as 'Stopped'
# 4. listPublicIpAddresses account=user, domainid=1 - pick ipaddressid # 4. listPublicIpAddresses account=user, domainid=1 - pick ipaddressid
# 5. createPortForwardingRule (ipaddressid from step 5.) # 5. createPortForwardingRule (ipaddressid from step 5.)
# a. for port 22 (ssh) for user VM deployed in step 1. # a. for port 22 (ssh) for user VM deployed in step 1.
# b. public port 222 , private port 22 # b. public port 222 , private port 22
# 6. startRouter stopped for this account # 6. startRouter stopped for this account
# 7. wait for listRouters to show router as Running # 7. wait for listRouters to show router as Running
# Get router details associated for that account # Get router details associated for that account
@ -718,7 +721,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
) )
public_ip = public_ips[0] public_ip = public_ips[0]
# Open up firewall port for SSH # Open up firewall port for SSH
fw_rule = FireWallRule.create( fw_rule = FireWallRule.create(
self.apiclient, self.apiclient,
ipaddressid=public_ip.id, ipaddressid=public_ip.id,
@ -789,6 +792,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
) )
return return
class TestRouterStopCreateLB(cloudstackTestCase): class TestRouterStopCreateLB(cloudstackTestCase):
@classmethod @classmethod
@ -854,10 +858,10 @@ class TestRouterStopCreateLB(cloudstackTestCase):
self._cleanup = [] self._cleanup = []
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_RouterStopCreateLB(self): def test_01_RouterStopCreateLB(self):
"""Test router stop create Load balancing """Test router stop create Load balancing
""" """
# validate the following # validate the following
# 1. listLoadBalancerRules (publicipid=ipaddressid of source NAT) # 1. listLoadBalancerRules (publicipid=ipaddressid of source NAT)
# 2. rule should be for port 2222 as applied and # 2. rule should be for port 2222 as applied and
@ -921,8 +925,8 @@ class TestRouterStopCreateLB(cloudstackTestCase):
"Check for list public IPs response return valid data" "Check for list public IPs response return valid data"
) )
public_ip = public_ips[0] public_ip = public_ips[0]
# Open up firewall port for SSH # Open up firewall port for SSH
fw_rule = FireWallRule.create( fw_rule = FireWallRule.create(
self.apiclient, self.apiclient,
ipaddressid=public_ip.id, ipaddressid=public_ip.id,
@ -1064,17 +1068,17 @@ class TestRouterStopCreateFW(cloudstackTestCase):
self._cleanup = [] self._cleanup = []
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_RouterStopCreateFW(self): def test_01_RouterStopCreateFW(self):
"""Test router stop create Firewall rule """Test router stop create Firewall rule
""" """
# validate the following # validate the following
# 1. 1. listFirewallRules (filter by ipaddressid of sourcenat) # 1. 1. listFirewallRules (filter by ipaddressid of sourcenat)
# 2. rule should be for ports 1-600 and in state=Active # 2. rule should be for ports 1-600 and in state=Active
# (optional backend) # (optional backend)
# 3. verify on router using iptables -t nat -nvx if rules are applied # 3. verify on router using iptables -t nat -nvx if rules are applied
# Get the router details associated with account # Get the router details associated with account
routers = list_routers( routers = list_routers(
self.apiclient, self.apiclient,
account=self.account.account.name, account=self.account.account.name,
@ -1221,4 +1225,3 @@ class TestRouterStopCreateFW(cloudstackTestCase):
"Check public IP address" "Check public IP address"
) )
return return

File diff suppressed because it is too large Load Diff

View File

@ -18,12 +18,14 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
class Services: class Services:
"""Test Snapshots Services """Test Snapshots Services
@ -38,14 +40,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 200, # in MHz "cpuspeed": 200, # in MHz
"memory": 256, # In MBs "memory": 256, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small Disk", "displaytext": "Small Disk",
@ -65,26 +67,26 @@ class Services:
"mgmt_server": { "mgmt_server": {
"ipaddress": '192.168.100.21', "ipaddress": '192.168.100.21',
"username": "root", "username": "root",
"password": "fr3sca", "password": "password",
"port": 22, "port": 22,
}, },
"recurring_snapshot": { "recurring_snapshot": {
"intervaltype": 'HOURLY', "intervaltype": 'HOURLY',
# Frequency of snapshots # Frequency of snapshots
"maxsnaps": 1, # Should be min 2 "maxsnaps": 1, # Should be min 2
"schedule": 1, "schedule": 1,
"timezone": 'US/Arizona', "timezone": 'US/Arizona',
# Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack # Timezone Formats - http://cloud.mindtouch.us/CloudStack_Documentation/Developer's_Guide%3A_CloudStack
}, },
"templates": { "templates": {
"displaytext": 'Template', "displaytext": 'Template',
"name": 'Template', "name": 'Template',
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
}, },
"diskdevice": "/dev/xvda", "diskdevice": "/dev/xvda",
"diskname": "TestDiskServ", "diskname": "TestDiskServ",
"size": 1, # GBs "size": 1, # GBs
"mount_dir": "/mnt/tmp", "mount_dir": "/mnt/tmp",
"sub_dir": "test", "sub_dir": "test",
@ -92,11 +94,11 @@ class Services:
"sub_lvl_dir2": "test2", "sub_lvl_dir2": "test2",
"random_data": "random.data", "random_data": "random.data",
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode" : 'advanced', # Networking mode: Advanced, Basic "mode": 'advanced', # Networking mode: Advanced, Basic
} }
@ -162,10 +164,11 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_01_createVM_snapshotTemplate(self): def test_01_createVM_snapshotTemplate(self):
"""Test create VM, Snapshot and Template """Test create VM, Snapshot and Template
""" """
# Validate the following # Validate the following
# 1. Deploy VM using default template, small service offering # 1. Deploy VM using default template, small service offering
# and small data disk offering. # and small data disk offering.
@ -191,7 +194,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
serviceofferingid=self.service_offering.id serviceofferingid=self.service_offering.id
) )
self.debug("Created VM with ID: %s" % self.virtual_machine.id) self.debug("Created VM with ID: %s" % self.virtual_machine.id)
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
self.apiclient, self.apiclient,
virtualmachineid=self.virtual_machine.id, virtualmachineid=self.virtual_machine.id,
@ -326,27 +329,32 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
parse_url = (host.name).split('/') parse_url = (host.name).split('/')
# parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
# Stripping end ':' from storage type
storage_type = parse_url[0][:-1]
# Split IP address and export path from name # Split IP address and export path from name
sec_storage_ip = parse_url[2] sec_storage_ip = parse_url[2]
# Sec Storage IP: 192.168.100.21 # Sec Storage IP: 192.168.100.21
if sec_storage_ip[-1] != ":":
sec_storage_ip = sec_storage_ip + ":"
export_path = '/'.join(parse_url[3:]) export_path = '/'.join(parse_url[3:])
# Export path: export/test # Export path: export/test
# Sleep to ensure that snapshot is reflected in sec storage # Sleep to ensure that snapshot is reflected in sec storage
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
try: try:
# Login to VM to check snapshot present on sec disk # Login to VM to check snapshot present on sec disk
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["mgmt_server"]["ipaddress"], self.services["mgmt_server"]["ipaddress"],
self.services["mgmt_server"]["port"], self.services["mgmt_server"]["port"],
self.services["mgmt_server"]["username"], self.services["mgmt_server"]["username"],
self.services["mgmt_server"]["password"], self.services["mgmt_server"]["password"],
) )
cmds = [ cmds = [
"mkdir -p %s" % self.services["mount_dir"], "mkdir -p %s" % self.services["mount_dir"],
"mount %s/%s %s" % ( "mount -t %s %s/%s %s" % (
storage_type,
sec_storage_ip, sec_storage_ip,
export_path, export_path,
self.services["mount_dir"] self.services["mount_dir"]
@ -361,10 +369,10 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
self.debug("command: %s" % c) self.debug("command: %s" % c)
result = ssh_client.execute(c) result = ssh_client.execute(c)
self.debug("Result: %s" % result) self.debug("Result: %s" % result)
except Exception as e: except Exception as e:
self.fail("SSH failed for Management server: %s" % self.fail("SSH failed for Management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
uuids.append(result) uuids.append(result)
# Unmount the Sec Storage # Unmount the Sec Storage
cmds = [ cmds = [
@ -377,9 +385,9 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
self.debug("Result: %s" % result) self.debug("Result: %s" % result)
except Exception as e: except Exception as e:
self.fail("SSH failed for Management server: %s" % self.fail("SSH failed for Management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
res = str(uuids) res = str(uuids)
self.assertEqual( self.assertEqual(
res.count(snapshot_uuid), res.count(snapshot_uuid),
@ -430,7 +438,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
domainid=cls.account.account.domainid, domainid=cls.account.account.domainid,
serviceofferingid=cls.service_offering.id serviceofferingid=cls.service_offering.id
) )
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
cls.api_client, cls.api_client,
virtualmachineid=cls.virtual_machine.id, virtualmachineid=cls.virtual_machine.id,
@ -470,10 +478,11 @@ class TestAccountSnapshotClean(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_02_accountSnapshotClean(self): def test_02_accountSnapshotClean(self):
"""Test snapshot cleanup after account deletion """Test snapshot cleanup after account deletion
""" """
# Validate the following # Validate the following
# 1. listAccounts API should list out the newly created account # 1. listAccounts API should list out the newly created account
# 2. listVirtualMachines() command should return the deployed VM. # 2. listVirtualMachines() command should return the deployed VM.
@ -518,7 +527,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
for virtual_machine in virtual_machines: for virtual_machine in virtual_machines:
self.debug("VM ID: %s, VM state: %s" % ( self.debug("VM ID: %s, VM state: %s" % (
virtual_machine.id, virtual_machine.id,
virtual_machine.state virtual_machine.state
)) ))
self.assertEqual( self.assertEqual(
virtual_machine.state, virtual_machine.state,
@ -585,18 +594,23 @@ class TestAccountSnapshotClean(cloudstackTestCase):
parse_url = (host.name).split('/') parse_url = (host.name).split('/')
# parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
# Stripping end ':' from storage type
storage_type = parse_url[0][:-1]
# Split IP address and export path from name # Split IP address and export path from name
sec_storage_ip = parse_url[2] sec_storage_ip = parse_url[2]
# Sec Storage IP: 192.168.100.21 # Sec Storage IP: 192.168.100.21
if sec_storage_ip[-1] != ":":
sec_storage_ip = sec_storage_ip + ":"
export_path = '/'.join(parse_url[3:]) export_path = '/'.join(parse_url[3:])
# Export path: export/test # Export path: export/test
# Sleep to ensure that snapshot is reflected in sec storage # Sleep to ensure that snapshot is reflected in sec storage
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
try: try:
# Login to Secondary storage VM to check snapshot present on sec disk # Login to Secondary storage VM to check snapshot present on sec disk
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["mgmt_server"]["ipaddress"], self.services["mgmt_server"]["ipaddress"],
self.services["mgmt_server"]["port"], self.services["mgmt_server"]["port"],
self.services["mgmt_server"]["username"], self.services["mgmt_server"]["username"],
@ -605,7 +619,8 @@ class TestAccountSnapshotClean(cloudstackTestCase):
cmds = [ cmds = [
"mkdir -p %s" % self.services["mount_dir"], "mkdir -p %s" % self.services["mount_dir"],
"mount %s/%s %s" % ( "mount -t %s %s/%s %s" % (
storage_type,
sec_storage_ip, sec_storage_ip,
export_path, export_path,
self.services["mount_dir"] self.services["mount_dir"]
@ -621,7 +636,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
self.debug("command: %s" % c) self.debug("command: %s" % c)
result = ssh_client.execute(c) result = ssh_client.execute(c)
self.debug("Result: %s" % result) self.debug("Result: %s" % result)
uuids.append(result) uuids.append(result)
# Unmount the Sec Storage # Unmount the Sec Storage
@ -630,17 +645,17 @@ class TestAccountSnapshotClean(cloudstackTestCase):
] ]
for c in cmds: for c in cmds:
result = ssh_client.execute(c) result = ssh_client.execute(c)
except Exception: except Exception as e:
self.fail("SSH failed for management server: %s" % self.fail("SSH failed for management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
res = str(uuids) res = str(uuids)
self.assertEqual( self.assertEqual(
res.count(snapshot_uuid), res.count(snapshot_uuid),
1, 1,
"Check snapshot UUID in secondary storage and database" "Check snapshot UUID in secondary storage and database"
) )
self.debug("Deleting account: %s" % self.account.account.name) self.debug("Deleting account: %s" % self.account.account.name)
# Delete account # Delete account
self.account.delete(self.apiclient) self.account.delete(self.apiclient)
@ -655,7 +670,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
"Check list response returns a valid list" "Check list response returns a valid list"
) )
self.debug("account.cleanup.interval: %s" % interval[0].value) self.debug("account.cleanup.interval: %s" % interval[0].value)
# Wait for account cleanup interval # Wait for account cleanup interval
time.sleep(int(interval[0].value) * 2) time.sleep(int(interval[0].value) * 2)
@ -663,29 +678,35 @@ class TestAccountSnapshotClean(cloudstackTestCase):
self.apiclient, self.apiclient,
id=self.account.account.id id=self.account.account.id
) )
self.assertEqual(
accounts,
None,
"List accounts should return empty list after account deletion"
)
uuids = [] self.assertEqual(
accounts,
None,
"List accounts should return empty list after account deletion"
)
uuids = []
for host in hosts: for host in hosts:
# hosts[0].name = "nfs://192.168.100.21/export/test" # hosts[0].name = "nfs://192.168.100.21/export/test"
parse_url = (host.name).split('/') parse_url = (host.name).split('/')
# parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
# Stripping end ':' from storage type
storage_type = parse_url[0][:-1]
# Split IP address and export path from name # Split IP address and export path from name
sec_storage_ip = parse_url[2] sec_storage_ip = parse_url[2]
# Sec Storage IP: 192.168.100.21 # Sec Storage IP: 192.168.100.21
if sec_storage_ip[-1] != ":":
sec_storage_ip = sec_storage_ip + ":"
export_path = '/'.join(parse_url[3:]) export_path = '/'.join(parse_url[3:])
# Export path: export/test # Export path: export/test
try: try:
cmds = [ cmds = [
"mount %s/%s %s" % ( "mount -t %s %s/%s %s" % (
storage_type,
sec_storage_ip, sec_storage_ip,
export_path, export_path,
self.services["mount_dir"] self.services["mount_dir"]
@ -701,7 +722,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
self.debug("command: %s" % c) self.debug("command: %s" % c)
result = ssh_client.execute(c) result = ssh_client.execute(c)
self.debug("Result: %s" % result) self.debug("Result: %s" % result)
uuids.append(result) uuids.append(result)
# Unmount the Sec Storage # Unmount the Sec Storage
cmds = [ cmds = [
@ -712,10 +733,10 @@ class TestAccountSnapshotClean(cloudstackTestCase):
result = ssh_client.execute(c) result = ssh_client.execute(c)
self.debug("Result: %s" % result) self.debug("Result: %s" % result)
except Exception: except Exception as e:
self.fail("SSH failed for management server: %s" % self.fail("SSH failed for management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
res = str(uuids) res = str(uuids)
self.assertNotEqual( self.assertNotEqual(
res.count(snapshot_uuid), res.count(snapshot_uuid),
@ -801,10 +822,11 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_03_snapshot_detachedDisk(self): def test_03_snapshot_detachedDisk(self):
"""Test snapshot from detached disk """Test snapshot from detached disk
""" """
# Validate the following # Validate the following
# 1. login in VM and write some data on data disk(use fdisk to # 1. login in VM and write some data on data disk(use fdisk to
# partition datadisk,fdisk /dev/sdb, and make filesystem using # partition datadisk,fdisk /dev/sdb, and make filesystem using
@ -863,7 +885,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
self.services["sub_lvl_dir2"], self.services["sub_lvl_dir2"],
self.services["random_data"] self.services["random_data"]
), ),
"sync", "sync",
] ]
for c in cmds: for c in cmds:
self.debug(ssh_client.execute(c)) self.debug(ssh_client.execute(c))
@ -906,9 +928,9 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
"Check snapshot id in list resources call" "Check snapshot id in list resources call"
) )
except Exception as e: except Exception as e:
self.fail("SSH failed for VM with IP: %s" % self.fail("SSH failed for VM with IP: %s - %s" %
self.virtual_machine.ipaddress) (self.virtual_machine.ipaddress, e))
# Fetch values from database # Fetch values from database
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \ "select backup_snap_id, account_id, volume_id from snapshots where uuid = '%s';" \
@ -948,19 +970,25 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
parse_url = (host.name).split('/') parse_url = (host.name).split('/')
# parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
# Stripping end ':' from storage type
storage_type = parse_url[0][:-1]
# Split IP address and export path from name # Split IP address and export path from name
sec_storage_ip = parse_url[2] sec_storage_ip = parse_url[2]
# Sec Storage IP: 192.168.100.21 # Sec Storage IP: 192.168.100.21
if sec_storage_ip[-1] != ":":
sec_storage_ip = sec_storage_ip + ":"
export_path = '/'.join(parse_url[3:]) export_path = '/'.join(parse_url[3:])
# Export path: export/test # Export path: export/test
# Sleep to ensure that snapshot is reflected in sec storage # Sleep to ensure that snapshot is reflected in sec storage
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
try: try:
# Login to Management server to check snapshot present on # Login to Management server to check snapshot present on
# sec disk # sec disk
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["mgmt_server"]["ipaddress"], self.services["mgmt_server"]["ipaddress"],
self.services["mgmt_server"]["port"], self.services["mgmt_server"]["port"],
self.services["mgmt_server"]["username"], self.services["mgmt_server"]["username"],
@ -969,7 +997,8 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
cmds = [ cmds = [
"mkdir -p %s" % self.services["mount_dir"], "mkdir -p %s" % self.services["mount_dir"],
"mount %s/%s %s" % ( "mount -t %s %s/%s %s" % (
storage_type,
sec_storage_ip, sec_storage_ip,
export_path, export_path,
self.services["mount_dir"] self.services["mount_dir"]
@ -983,7 +1012,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
for c in cmds: for c in cmds:
result = ssh_client.execute(c) result = ssh_client.execute(c)
uuids.append(result) uuids.append(result)
# Unmount the Sec Storage # Unmount the Sec Storage
cmds = [ cmds = [
@ -992,9 +1021,9 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
for c in cmds: for c in cmds:
result = ssh_client.execute(c) result = ssh_client.execute(c)
except Exception as e: except Exception as e:
self.fail("SSH failed for management server: %s" % self.fail("SSH failed for management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
res = str(uuids) res = str(uuids)
self.assertEqual( self.assertEqual(
res.count(snapshot_uuid), res.count(snapshot_uuid),
@ -1073,18 +1102,19 @@ class TestSnapshotLimit(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_04_snapshot_limit(self): def test_04_snapshot_limit(self):
"""Test snapshot limit in snapshot policies """Test snapshot limit in snapshot policies
""" """
# Validate the following # Validate the following
# 1. Perform hourly recurring snapshot on the root disk of VM and keep # 1. Perform hourly recurring snapshot on the root disk of VM and keep
# the maxsnapshots as 1 # the maxsnapshots as 1
# 2. listSnapshots should list the snapshot that was created # 2. listSnapshots should list the snapshot that was created
# snapshot folder in secondary storage should contain only one # snapshot folder in secondary storage should contain only one
# snapshot image(/secondary/snapshots/$accountid/$volumeid/) # snapshot image(/secondary/snapshots/$accountid/$volumeid/)
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
self.apiclient, self.apiclient,
virtualmachineid=self.virtual_machine.id, virtualmachineid=self.virtual_machine.id,
@ -1116,7 +1146,7 @@ class TestSnapshotLimit(cloudstackTestCase):
True, True,
"Check list response returns a valid list" "Check list response returns a valid list"
) )
self.assertNotEqual( self.assertNotEqual(
snapshot_policy, snapshot_policy,
None, None,
@ -1148,7 +1178,7 @@ class TestSnapshotLimit(cloudstackTestCase):
snapshottype='RECURRING', snapshottype='RECURRING',
listall=True listall=True
) )
self.assertEqual( self.assertEqual(
isinstance(snapshots, list), isinstance(snapshots, list),
True, True,
@ -1159,7 +1189,7 @@ class TestSnapshotLimit(cloudstackTestCase):
self.services["recurring_snapshot"]["maxsnaps"], self.services["recurring_snapshot"]["maxsnaps"],
"Check maximum number of recurring snapshots retained" "Check maximum number of recurring snapshots retained"
) )
snapshot = snapshots[0] snapshot = snapshots[0]
# Sleep to ensure that snapshot is reflected in sec storage # Sleep to ensure that snapshot is reflected in sec storage
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
@ -1201,15 +1231,20 @@ class TestSnapshotLimit(cloudstackTestCase):
parse_url = (host.name).split('/') parse_url = (host.name).split('/')
# parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test'] # parse_url = ['nfs:', '', '192.168.100.21', 'export', 'test']
# Stripping end ':' from storage type
storage_type = parse_url[0][:-1]
# Split IP address and export path from name # Split IP address and export path from name
sec_storage_ip = parse_url[2] sec_storage_ip = parse_url[2]
# Sec Storage IP: 192.168.100.21 # Sec Storage IP: 192.168.100.21
if sec_storage_ip[-1] != ":":
sec_storage_ip = sec_storage_ip + ":"
export_path = '/'.join(parse_url[3:]) export_path = '/'.join(parse_url[3:])
# Export path: export/test # Export path: export/test
try: try:
# Login to VM to check snapshot present on sec disk # Login to VM to check snapshot present on sec disk
ssh_client = remoteSSHClient.remoteSSHClient( ssh_client = remoteSSHClient(
self.services["mgmt_server"]["ipaddress"], self.services["mgmt_server"]["ipaddress"],
self.services["mgmt_server"]["port"], self.services["mgmt_server"]["port"],
self.services["mgmt_server"]["username"], self.services["mgmt_server"]["username"],
@ -1218,7 +1253,8 @@ class TestSnapshotLimit(cloudstackTestCase):
cmds = [ cmds = [
"mkdir -p %s" % self.services["mount_dir"], "mkdir -p %s" % self.services["mount_dir"],
"mount %s/%s %s" % ( "mount -t %s %s/%s %s" % (
storage_type,
sec_storage_ip, sec_storage_ip,
export_path, export_path,
self.services["mount_dir"] self.services["mount_dir"]
@ -1243,8 +1279,8 @@ class TestSnapshotLimit(cloudstackTestCase):
result = ssh_client.execute(c) result = ssh_client.execute(c)
except Exception as e: except Exception as e:
raise Exception( raise Exception(
"SSH access failed for management server: %s" % "SSH access failed for management server: %s - %s" %
self.services["mgmt_server"]["ipaddress"]) (self.services["mgmt_server"]["ipaddress"], e))
res = str(uuids) res = str(uuids)
self.assertEqual( self.assertEqual(
@ -1324,17 +1360,18 @@ class TestSnapshotEvents(cloudstackTestCase):
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_05_snapshot_events(self): def test_05_snapshot_events(self):
"""Test snapshot events """Test snapshot events
""" """
# Validate the following # Validate the following
# 1. Perform snapshot on the root disk of this VM and check the events/alerts. # 1. Perform snapshot on the root disk of this VM and check the events/alerts.
# 2. delete the snapshots and check the events/alerts # 2. delete the snapshots and check the events/alerts
# 3. listEvents() shows created/deleted snapshot events # 3. listEvents() shows created/deleted snapshot events
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
self.apiclient, self.apiclient,
virtualmachineid=self.virtual_machine.id, virtualmachineid=self.virtual_machine.id,

View File

@ -18,6 +18,7 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
@ -43,14 +44,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
@ -71,15 +72,15 @@ class Services:
"diskname": "Test Volume", "diskname": "Test Volume",
}, },
"templates": { "templates": {
# Configs for different Template formats # Configs for different Template formats
# For Eg. raw image, zip etc # For Eg. raw image, zip etc
0:{ 0: {
"displaytext": "Public Template", "displaytext": "Public Template",
"name": "Public template", "name": "Public template",
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2", "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
"hypervisor": 'XenServer', "hypervisor": 'XenServer',
"format" : 'VHD', "format": 'VHD',
"isfeatured": True, "isfeatured": True,
"ispublic": True, "ispublic": True,
"isextractable": True, "isextractable": True,
@ -88,15 +89,15 @@ class Services:
"template": { "template": {
"displaytext": "Cent OS Template", "displaytext": "Cent OS Template",
"name": "Cent OS Template", "name": "Cent OS Template",
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
}, },
"templatefilter": 'self', "templatefilter": 'self',
"destzoneid": 2, # For Copy template (Destination zone) "destzoneid": 2, # For Copy template (Destination zone)
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode": 'advanced', # Networking mode: Advanced, basic "mode": 'advanced', # Networking mode: Advanced, basic
} }
@ -159,10 +160,10 @@ class TestCreateTemplate(cloudstackTestCase):
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_create_template(self): def test_01_create_template(self):
"""Test create public & private template """Test create public & private template
""" """
# Validate the following: # Validate the following:
# 1. Upload a templates in raw img format. Create a Vm instances from # 1. Upload a templates in raw img format. Create a Vm instances from
# raw img template. # raw img template.
@ -212,7 +213,7 @@ class TestCreateTemplate(cloudstackTestCase):
break break
elif timeout == 0: elif timeout == 0:
raise Exception("List template failed!") raise Exception("List template failed!")
time.sleep(5) time.sleep(5)
timeout = timeout - 1 timeout = timeout - 1
#Verify template response to check whether template added successfully #Verify template response to check whether template added successfully
@ -221,13 +222,13 @@ class TestCreateTemplate(cloudstackTestCase):
True, True,
"Check for list template response return valid data" "Check for list template response return valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(list_template_response), len(list_template_response),
0, 0,
"Check template available in List Templates" "Check template available in List Templates"
) )
template_response = list_template_response[0] template_response = list_template_response[0]
self.assertEqual( self.assertEqual(
template_response.isready, template_response.isready,
@ -314,10 +315,10 @@ class TestTemplates(cloudstackTestCase):
#Stop virtual machine #Stop virtual machine
cls.virtual_machine.stop(cls.api_client) cls.virtual_machine.stop(cls.api_client)
timeout = cls.services["timeout"] timeout = cls.services["timeout"]
#Wait before server has be successfully stopped #Wait before server has be successfully stopped
time.sleep(cls.services["sleep"]) time.sleep(cls.services["sleep"])
while True: while True:
list_volume = list_volumes( list_volume = list_volumes(
cls.api_client, cls.api_client,
@ -329,10 +330,10 @@ class TestTemplates(cloudstackTestCase):
break break
elif timeout == 0: elif timeout == 0:
raise Exception("List volumes failed.") raise Exception("List volumes failed.")
time.sleep(5) time.sleep(5)
timeout = timeout -1 timeout = timeout - 1
cls.volume = list_volume[0] cls.volume = list_volume[0]
#Create template from volume #Create template from volume
@ -375,6 +376,7 @@ class TestTemplates(cloudstackTestCase):
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_create_template_volume(self): def test_01_create_template_volume(self):
"""Test Create template from volume """Test Create template from volume
""" """
@ -391,7 +393,7 @@ class TestTemplates(cloudstackTestCase):
domainid=self.account.account.domainid, domainid=self.account.account.domainid,
serviceofferingid=self.service_offering.id, serviceofferingid=self.service_offering.id,
) )
self.debug("creating an instance with template ID: %s" % self.template.id) self.debug("creating an instance with template ID: %s" % self.template.id)
self.cleanup.append(virtual_machine) self.cleanup.append(virtual_machine)
vm_response = list_virtual_machines( vm_response = list_virtual_machines(
@ -414,13 +416,14 @@ class TestTemplates(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced", "advancedns", "multizone"])
def test_02_copy_template(self): def test_02_copy_template(self):
"""Test for copy template from one zone to another""" """Test for copy template from one zone to another"""
# Validate the following # Validate the following
# 1. copy template should be successful and # 1. copy template should be successful and
# secondary storage should contain new copied template. # secondary storage should contain new copied template.
self.debug( self.debug(
"Copying template from zone: %s to %s" % ( "Copying template from zone: %s to %s" % (
self.template.id, self.template.id,
@ -445,7 +448,7 @@ class TestTemplates(cloudstackTestCase):
True, True,
"Check for list template response return valid list" "Check for list template response return valid list"
) )
self.assertNotEqual( self.assertNotEqual(
len(list_template_response), len(list_template_response),
0, 0,
@ -471,6 +474,7 @@ class TestTemplates(cloudstackTestCase):
self.apiclient.deleteTemplate(cmd) self.apiclient.deleteTemplate(cmd)
return return
@attr(tags = ["advanced", "advancedns"])
def test_03_delete_template(self): def test_03_delete_template(self):
"""Test Delete template """Test Delete template
""" """
@ -492,7 +496,7 @@ class TestTemplates(cloudstackTestCase):
True, True,
"Check for list template response return valid list" "Check for list template response return valid list"
) )
self.assertNotEqual( self.assertNotEqual(
len(list_template_response), len(list_template_response),
0, 0,
@ -505,12 +509,12 @@ class TestTemplates(cloudstackTestCase):
self.template.id, self.template.id,
"Check display text of updated template" "Check display text of updated template"
) )
self.debug("Deleting template: %s" % self.template) self.debug("Deleting template: %s" % self.template)
# Delete the template # Delete the template
self.template.delete(self.apiclient) self.template.delete(self.apiclient)
self.debug("Delete template: %s successful" % self.template) self.debug("Delete template: %s successful" % self.template)
list_template_response = list_templates( list_template_response = list_templates(
self.apiclient, self.apiclient,
templatefilter=\ templatefilter=\
@ -525,6 +529,8 @@ class TestTemplates(cloudstackTestCase):
) )
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "advancedns"])
def test_04_template_from_snapshot(self): def test_04_template_from_snapshot(self):
"""Create Template from snapshot """Create Template from snapshot
""" """
@ -542,7 +548,7 @@ class TestTemplates(cloudstackTestCase):
listall=True listall=True
) )
volume = volumes[0] volume = volumes[0]
self.debug("Creating a snapshot from volume: %s" % volume.id) self.debug("Creating a snapshot from volume: %s" % volume.id)
#Create a snapshot of volume #Create a snapshot of volume
snapshot = Snapshot.create( snapshot = Snapshot.create(

View File

@ -18,14 +18,16 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
import datetime import datetime
class Services: class Services:
"""Test Snapshots Services """Test Snapshots Services
""" """
@ -39,7 +41,7 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
@ -69,7 +71,7 @@ class Services:
"templates": { "templates": {
"displaytext": 'Template', "displaytext": 'Template',
"name": 'Template', "name": 'Template',
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
"templatefilter": 'self', "templatefilter": 'self',
"url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2" "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2"
}, },
@ -81,7 +83,7 @@ class Services:
"isextractable": True, "isextractable": True,
"isfeatured": True, "isfeatured": True,
"ispublic": True, "ispublic": True,
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
}, },
"lbrule": { "lbrule": {
"name": "SSH", "name": "SSH",
@ -99,11 +101,11 @@ class Services:
"username": "test", "username": "test",
"password": "test", "password": "test",
}, },
"ostypeid": '144f66aa-7f74-4cfe-9799-80cc21439cb3', "ostypeid": '01853327-513e-4508-9628-f1f55db1946f',
# Cent OS 5.3 (64 bit) # Cent OS 5.3 (64 bit)
"sleep": 60, "sleep": 60,
"timeout": 10, "timeout": 10,
"mode":'advanced' "mode": 'advanced'
} }
@ -176,10 +178,10 @@ class TestVmUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_vm_usage(self): def test_01_vm_usage(self):
"""Test Create/Destroy VM and verify usage calculation """Test Create/Destroy VM and verify usage calculation
""" """
# Validate the following # Validate the following
# 1. Create a VM. Verify usage_events table contains VM .create, # 1. Create a VM. Verify usage_events table contains VM .create,
# VM.start , Network.offering.assign , Volume.create events # VM.start , Network.offering.assign , Volume.create events
@ -192,16 +194,16 @@ class TestVmUsage(cloudstackTestCase):
self.debug("Stopping the VM: %s" % self.virtual_machine.id) self.debug("Stopping the VM: %s" % self.virtual_machine.id)
# Stop the VM # Stop the VM
self.virtual_machine.stop(self.apiclient) self.virtual_machine.stop(self.apiclient)
time.sleep(self.services["sleep"]) time.sleep(self.services["sleep"])
# Destroy the VM # Destroy the VM
self.debug("Destroying the VM: %s" % self.virtual_machine.id) self.debug("Destroying the VM: %s" % self.virtual_machine.id)
self.virtual_machine.delete(self.apiclient) self.virtual_machine.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -211,7 +213,7 @@ class TestVmUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -222,7 +224,7 @@ class TestVmUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -232,7 +234,7 @@ class TestVmUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -367,10 +369,10 @@ class TestPublicIPUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "eip", "advancedns", "simulator"])
def test_01_public_ip_usage(self): def test_01_public_ip_usage(self):
"""Test Assign new IP and verify usage calculation """Test Assign new IP and verify usage calculation
""" """
# Validate the following # Validate the following
# 1. Aquire a IP for the network of this account. Verify usage_event # 1. Aquire a IP for the network of this account. Verify usage_event
# table has Acquire IP event for the IP for this account # table has Acquire IP event for the IP for this account
@ -378,16 +380,16 @@ class TestPublicIPUsage(cloudstackTestCase):
# has IP.Release event for released IP for this account # has IP.Release event for released IP for this account
# 3. Delete the newly created account # 3. Delete the newly created account
self.debug("Deleting public IP: %s" % self.debug("Deleting public IP: %s" %
self.public_ip.ipaddress.ipaddress) self.public_ip.ipaddress.ipaddress)
# Release one of the IP # Release one of the IP
self.public_ip.delete(self.apiclient) self.public_ip.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -407,12 +409,12 @@ class TestPublicIPUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
@ -514,10 +516,10 @@ class TestVolumeUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_volume_usage(self): def test_01_volume_usage(self):
"""Test Create/delete a volume and verify correct usage is recorded """Test Create/delete a volume and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Volume.create event for both root and data disk is there for the # 1. Volume.create event for both root and data disk is there for the
# created account in cloud.usage_event table # created account in cloud.usage_event table
@ -537,8 +539,8 @@ class TestVolumeUsage(cloudstackTestCase):
listall=True listall=True
) )
self.assertEqual( self.assertEqual(
isinstance(volume_response, list), isinstance(volume_response, list),
True, True,
"Check for valid list volumes response" "Check for valid list volumes response"
) )
data_volume = volume_response[0] data_volume = volume_response[0]
@ -556,10 +558,10 @@ class TestVolumeUsage(cloudstackTestCase):
cmd.id = data_volume.id cmd.id = data_volume.id
self.apiclient.deleteVolume(cmd) self.apiclient.deleteVolume(cmd)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -569,7 +571,7 @@ class TestVolumeUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -580,12 +582,12 @@ class TestVolumeUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -596,7 +598,7 @@ class TestVolumeUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table # Check VOLUME.CREATE, VOLUME.DESTROY events in cloud.usage_event table
@ -663,7 +665,7 @@ class TestTemplateUsage(cloudstackTestCase):
type='ROOT', type='ROOT',
listall=True listall=True
) )
if isinstance(list_volume, list): if isinstance(list_volume, list):
cls.volume = list_volume[0] cls.volume = list_volume[0]
else: else:
raise Exception("List Volumes failed!") raise Exception("List Volumes failed!")
@ -695,11 +697,11 @@ class TestTemplateUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_01_template_usage(self): def test_01_template_usage(self):
"""Test Upload/ delete a template and verify correct usage is generated """Test Upload/ delete a template and verify correct usage is generated
for the template uploaded for the template uploaded
""" """
# Validate the following # Validate the following
# 1. Create a account # 1. Create a account
# 2. Upload a template from this account. template.create event is # 2. Upload a template from this account. template.create event is
@ -719,10 +721,10 @@ class TestTemplateUsage(cloudstackTestCase):
self.template.delete(self.apiclient) self.template.delete(self.apiclient)
self.debug("Deleted template with ID: %s" % self.template.id) self.debug("Deleted template with ID: %s" % self.template.id)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -732,7 +734,7 @@ class TestTemplateUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -743,7 +745,7 @@ class TestTemplateUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -759,10 +761,10 @@ class TestTemplateUsage(cloudstackTestCase):
0, 0,
"Check DB Query result set" "Check DB Query result set"
) )
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table # Check for TEMPLATE.CREATE, TEMPLATE.DELETE in cloud.usage_event table
self.assertEqual( self.assertEqual(
qresult.count('TEMPLATE.CREATE'), qresult.count('TEMPLATE.CREATE'),
@ -789,7 +791,7 @@ class TestISOUsage(cloudstackTestCase):
cls.zone = get_zone(cls.api_client, cls.services) cls.zone = get_zone(cls.api_client, cls.services)
cls.services["server"]["zoneid"] = cls.zone.id cls.services["server"]["zoneid"] = cls.zone.id
cls.services["iso"]["zoneid"] = cls.zone.id cls.services["iso"]["zoneid"] = cls.zone.id
# Create Account, ISO image etc # Create Account, ISO image etc
cls.account = Account.create( cls.account = Account.create(
cls.api_client, cls.api_client,
cls.services["account"], cls.services["account"],
@ -838,10 +840,10 @@ class TestISOUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns"])
def test_01_ISO_usage(self): def test_01_ISO_usage(self):
"""Test Create/Delete a ISO and verify its usage is generated correctly """Test Create/Delete a ISO and verify its usage is generated correctly
""" """
# Validate the following # Validate the following
# 1. Create a account # 1. Create a account
# 2. Upload a ISO from this account. ISO.create event is recorded in # 2. Upload a ISO from this account. ISO.create event is recorded in
@ -853,11 +855,11 @@ class TestISOUsage(cloudstackTestCase):
# Delete the ISO # Delete the ISO
self.debug("Deleting ISO with ID: %s" % self.iso.id) self.debug("Deleting ISO with ID: %s" % self.iso.id)
self.iso.delete(self.apiclient) self.iso.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -867,7 +869,7 @@ class TestISOUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -878,18 +880,18 @@ class TestISOUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -989,10 +991,10 @@ class TestLBRuleUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "eip", "advancedns", "simulator"])
def test_01_lb_usage(self): def test_01_lb_usage(self):
"""Test Create/Delete a LB rule and verify correct usage is recorded """Test Create/Delete a LB rule and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Acquire a IP for this account. lb.rule.create event is registered # 1. Acquire a IP for this account. lb.rule.create event is registered
# for this account in cloud.usage_event table # for this account in cloud.usage_event table
@ -1002,7 +1004,7 @@ class TestLBRuleUsage(cloudstackTestCase):
# 4. Delete this account. # 4. Delete this account.
self.debug( self.debug(
"Creating load balancer rule for public IP: %s" % "Creating load balancer rule for public IP: %s" %
self.public_ip_1.ipaddress.id) self.public_ip_1.ipaddress.id)
#Create Load Balancer rule and assign VMs to rule #Create Load Balancer rule and assign VMs to rule
lb_rule = LoadBalancerRule.create( lb_rule = LoadBalancerRule.create(
@ -1015,10 +1017,10 @@ class TestLBRuleUsage(cloudstackTestCase):
self.debug("Deleting LB rule with ID: %s" % lb_rule.id) self.debug("Deleting LB rule with ID: %s" % lb_rule.id)
lb_rule.delete(self.apiclient) lb_rule.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -1028,7 +1030,7 @@ class TestLBRuleUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1039,7 +1041,7 @@ class TestLBRuleUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1060,7 +1062,7 @@ class TestLBRuleUsage(cloudstackTestCase):
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for LB.CREATE, LB.DELETE in cloud.usage_event table # Check for LB.CREATE, LB.DELETE in cloud.usage_event table
self.assertEqual( self.assertEqual(
qresult.count('LB.CREATE'), qresult.count('LB.CREATE'),
1, 1,
@ -1144,11 +1146,12 @@ class TestSnapshotUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(speed = "slow")
@attr(tags = ["advanced", "basic", "sg", "eip", "advancedns", "simulator"])
def test_01_snapshot_usage(self): def test_01_snapshot_usage(self):
"""Test Create/Delete a manual snap shot and verify """Test Create/Delete a manual snap shot and verify
correct usage is recorded correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Create snapshot of the root disk for this account.Snapshot.create # 1. Create snapshot of the root disk for this account.Snapshot.create
# event is there for the created account in cloud.usage_event table # event is there for the created account in cloud.usage_event table
@ -1156,7 +1159,7 @@ class TestSnapshotUsage(cloudstackTestCase):
# generated for the destroyed Snapshot # generated for the destroyed Snapshot
# 3. Delete the account # 3. Delete the account
# Get the Root disk of VM # Get the Root disk of VM
volumes = list_volumes( volumes = list_volumes(
self.apiclient, self.apiclient,
virtualmachineid=self.virtual_machine.id, virtualmachineid=self.virtual_machine.id,
@ -1168,7 +1171,7 @@ class TestSnapshotUsage(cloudstackTestCase):
True, True,
"Check if list volumes return a valid data" "Check if list volumes return a valid data"
) )
volume = volumes[0] volume = volumes[0]
# Create a snapshot from the ROOTDISK # Create a snapshot from the ROOTDISK
@ -1179,10 +1182,10 @@ class TestSnapshotUsage(cloudstackTestCase):
self.debug("Deleting snapshot: %s" % snapshot.id) self.debug("Deleting snapshot: %s" % snapshot.id)
snapshot.delete(self.apiclient) snapshot.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -1192,7 +1195,7 @@ class TestSnapshotUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1203,12 +1206,12 @@ class TestSnapshotUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
) )
self.assertEqual( self.assertEqual(
isinstance(qresultset, list), isinstance(qresultset, list),
True, True,
@ -1315,10 +1318,10 @@ class TestNatRuleUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns", "simulator"])
def test_01_nat_usage(self): def test_01_nat_usage(self):
"""Test Create/Delete a PF rule and verify correct usage is recorded """Test Create/Delete a PF rule and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Acquire a IP for this account # 1. Acquire a IP for this account
# 2. Create a PF rule on the IP associated with this account. # 2. Create a PF rule on the IP associated with this account.
@ -1328,7 +1331,7 @@ class TestNatRuleUsage(cloudstackTestCase):
# is registered for this account in cloud.usage_event table # is registered for this account in cloud.usage_event table
# 4. Delete this account. # 4. Delete this account.
self.debug("Creating NAT rule with public IP: %s" % self.debug("Creating NAT rule with public IP: %s" %
self.public_ip_1.ipaddress.id) self.public_ip_1.ipaddress.id)
#Create NAT rule #Create NAT rule
nat_rule = NATRule.create( nat_rule = NATRule.create(
@ -1342,10 +1345,10 @@ class TestNatRuleUsage(cloudstackTestCase):
self.debug("Deleting NAT rule: %s" % nat_rule.id) self.debug("Deleting NAT rule: %s" % nat_rule.id)
nat_rule.delete(self.apiclient) nat_rule.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -1355,7 +1358,7 @@ class TestNatRuleUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1366,7 +1369,7 @@ class TestNatRuleUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1477,19 +1480,19 @@ class TestVpnUsage(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_vpn_usage(self): def test_01_vpn_usage(self):
"""Test Create/Delete a VPN and verify correct usage is recorded """Test Create/Delete a VPN and verify correct usage is recorded
""" """
# Validate the following # Validate the following
# 1. Enable VPN for this IP. vpn.add.user event is registered for this # 1. Enable VPN for this IP. vpn.add.user event is registered for this
# account in cloud.usage_event table # account in cloud.usage_event table
# 2. Add user to this vpn # 2. Add user to this vpn
# 3. Delete user for this VPN. vpn.user.delete event is registered for # 3. Delete user for this VPN. vpn.user.delete event is registered for
# this account in cloud.usage_event table # this account in cloud.usage_event table
# 4. Delete this account. # 4. Delete this account.
self.debug("Created VPN with public IP: %s" % self.debug("Created VPN with public IP: %s" %
self.public_ip.ipaddress.id) self.public_ip.ipaddress.id)
#Assign VPN to Public IP #Assign VPN to Public IP
vpn = Vpn.create( vpn = Vpn.create(
@ -1499,7 +1502,7 @@ class TestVpnUsage(cloudstackTestCase):
domainid=self.account.account.domainid domainid=self.account.account.domainid
) )
self.debug("Created VPN user for account: %s" % self.debug("Created VPN user for account: %s" %
self.account.account.name) self.account.account.name)
vpnuser = VpnUser.create( vpnuser = VpnUser.create(
@ -1518,10 +1521,10 @@ class TestVpnUsage(cloudstackTestCase):
self.debug("Deleting VPN: %s" % vpn.publicipid) self.debug("Deleting VPN: %s" % vpn.publicipid)
vpn.delete(self.apiclient) vpn.delete(self.apiclient)
# Fetch account ID from account_uuid # Fetch account ID from account_uuid
self.debug("select id from account where uuid = '%s';" \ self.debug("select id from account where uuid = '%s';" \
% self.account.account.id) % self.account.account.id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \ "select id from account where uuid = '%s';" \
% self.account.account.id % self.account.account.id
@ -1531,7 +1534,7 @@ class TestVpnUsage(cloudstackTestCase):
True, True,
"Check DB query result set for valid data" "Check DB query result set for valid data"
) )
self.assertNotEqual( self.assertNotEqual(
len(qresultset), len(qresultset),
0, 0,
@ -1542,7 +1545,7 @@ class TestVpnUsage(cloudstackTestCase):
account_id = qresult[0] account_id = qresult[0]
self.debug("select type from usage_event where account_id = '%s';" \ self.debug("select type from usage_event where account_id = '%s';" \
% account_id) % account_id)
qresultset = self.dbclient.execute( qresultset = self.dbclient.execute(
"select type from usage_event where account_id = '%s';" \ "select type from usage_event where account_id = '%s';" \
% account_id % account_id
@ -1561,8 +1564,8 @@ class TestVpnUsage(cloudstackTestCase):
qresult = str(qresultset) qresult = str(qresultset)
self.debug("Query result: %s" % qresult) self.debug("Query result: %s" % qresult)
# Check for VPN user related events # Check for VPN user related events
self.assertEqual( self.assertEqual(
qresult.count('VPN.USER.ADD'), qresult.count('VPN.USER.ADD'),
1, 1,

View File

@ -18,12 +18,13 @@
""" """
#Import Local Modules #Import Local Modules
import marvin import marvin
from nose.plugins.attrib import attr
from marvin.cloudstackTestCase import * from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import * from marvin.cloudstackAPI import *
from integration.lib.utils import * from integration.lib.utils import *
from integration.lib.base import * from integration.lib.base import *
from integration.lib.common import * from integration.lib.common import *
from marvin import remoteSSHClient from marvin.remoteSSHClient import remoteSSHClient
#Import System modules #Import System modules
import os import os
import urllib import urllib
@ -44,14 +45,14 @@ class Services:
"username": "test", "username": "test",
# Random characters are appended for unique # Random characters are appended for unique
# username # username
"password": "fr3sca", "password": "password",
}, },
"service_offering": { "service_offering": {
"name": "Tiny Instance", "name": "Tiny Instance",
"displaytext": "Tiny Instance", "displaytext": "Tiny Instance",
"cpunumber": 1, "cpunumber": 1,
"cpuspeed": 100, # in MHz "cpuspeed": 100, # in MHz
"memory": 64, # In MBs "memory": 64, # In MBs
}, },
"disk_offering": { "disk_offering": {
"displaytext": "Small", "displaytext": "Small",
@ -78,10 +79,14 @@ class Services:
"name": "testISO", "name": "testISO",
"url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso",
# Source URL where ISO is located # Source URL where ISO is located
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
}, },
"custom_volume": {
"customdisksize": 2,
"diskname": "Custom disk",
},
"sleep": 50, "sleep": 50,
"ostypeid": '5776c0d2-f331-42db-ba3a-29f1f8319bc9', "ostypeid": 'bc66ada0-99e7-483b-befc-8fb0c2129b70',
"mode": 'advanced', "mode": 'advanced',
} }
@ -140,10 +145,10 @@ class TestAttachVolume(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection() self.dbclient = self.testClient.getDbConnection()
self.cleanup = [] self.cleanup = []
@attr(tags = ["advanced", "advancedns"])
def test_01_volume_attach(self): def test_01_volume_attach(self):
"""Test Attach volumes (max capacity) """Test Attach volumes (max capacity)
""" """
# Validate the following # Validate the following
# 1. Deploy a vm and create 5 data disk # 1. Deploy a vm and create 5 data disk
# 2. Attach all the created Volume to the vm. # 2. Attach all the created Volume to the vm.
@ -163,7 +168,7 @@ class TestAttachVolume(cloudstackTestCase):
) )
self.debug("Created volume: %s for account: %s" % ( self.debug("Created volume: %s for account: %s" % (
volume.id, volume.id,
self.account.account.name self.account.account.name
)) ))
# Check List Volume response for newly created volume # Check List Volume response for newly created volume
list_volume_response = list_volumes( list_volume_response = list_volumes(
@ -182,7 +187,7 @@ class TestAttachVolume(cloudstackTestCase):
) )
self.debug("Attach volume: %s to VM: %s" % ( self.debug("Attach volume: %s to VM: %s" % (
volume.id, volume.id,
self.virtual_machine.id self.virtual_machine.id
)) ))
# Check all volumes attached to same VM # Check all volumes attached to same VM
list_volume_response = list_volumes( list_volume_response = list_volumes(
@ -196,7 +201,7 @@ class TestAttachVolume(cloudstackTestCase):
True, True,
"Check list volumes response for valid list" "Check list volumes response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_volume_response,
None, None,
@ -246,7 +251,7 @@ class TestAttachVolume(cloudstackTestCase):
True, True,
"Check list VM response for valid list" "Check list VM response for valid list"
) )
#Verify VM response to check whether VM deployment was successful #Verify VM response to check whether VM deployment was successful
self.assertNotEqual( self.assertNotEqual(
len(vm_response), len(vm_response),
@ -276,7 +281,7 @@ class TestAttachVolume(cloudstackTestCase):
True, True,
"Check list VM response for valid list" "Check list VM response for valid list"
) )
#Verify VM response to check whether VM deployment was successful #Verify VM response to check whether VM deployment was successful
self.assertNotEqual( self.assertNotEqual(
len(vm_response), len(vm_response),
@ -292,6 +297,7 @@ class TestAttachVolume(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced", "advancedns"])
def test_02_volume_attach_max(self): def test_02_volume_attach_max(self):
"""Test attach volumes (more than max) to an instance """Test attach volumes (more than max) to an instance
""" """
@ -311,7 +317,7 @@ class TestAttachVolume(cloudstackTestCase):
) )
self.debug("Created volume: %s for account: %s" % ( self.debug("Created volume: %s for account: %s" % (
volume.id, volume.id,
self.account.account.name self.account.account.name
)) ))
# Check List Volume response for newly created volume # Check List Volume response for newly created volume
list_volume_response = list_volumes( list_volume_response = list_volumes(
@ -323,7 +329,7 @@ class TestAttachVolume(cloudstackTestCase):
True, True,
"Check list volumes response for valid list" "Check list volumes response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_volume_response,
None, None,
@ -333,7 +339,7 @@ class TestAttachVolume(cloudstackTestCase):
with self.assertRaises(Exception): with self.assertRaises(Exception):
self.debug("Trying to Attach volume: %s to VM: %s" % ( self.debug("Trying to Attach volume: %s to VM: %s" % (
volume.id, volume.id,
self.virtual_machine.id self.virtual_machine.id
)) ))
self.virtual_machine.attach_volume( self.virtual_machine.attach_volume(
self.apiclient, self.apiclient,
@ -422,6 +428,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
except Exception as e: except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
@attr(tags = ["advanced", "advancedns"])
def test_01_volume_attach_detach(self): def test_01_volume_attach_detach(self):
"""Test Volume attach/detach to VM (5 data volumes) """Test Volume attach/detach to VM (5 data volumes)
""" """
@ -447,7 +454,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
) )
self.debug("Created volume: %s for account: %s" % ( self.debug("Created volume: %s for account: %s" % (
volume.id, volume.id,
self.account.account.name self.account.account.name
)) ))
self.cleanup.append(volume) self.cleanup.append(volume)
volumes.append(volume) volumes.append(volume)
@ -462,7 +469,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
True, True,
"Check list volumes response for valid list" "Check list volumes response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_volume_response,
None, None,
@ -470,7 +477,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
) )
self.debug("Attach volume: %s to VM: %s" % ( self.debug("Attach volume: %s to VM: %s" % (
volume.id, volume.id,
self.virtual_machine.id self.virtual_machine.id
)) ))
# Attach volume to VM # Attach volume to VM
self.virtual_machine.attach_volume( self.virtual_machine.attach_volume(
@ -490,7 +497,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
True, True,
"Check list volumes response for valid list" "Check list volumes response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_volume_response,
None, None,
@ -506,7 +513,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
for volume in volumes: for volume in volumes:
self.debug("Detach volume: %s to VM: %s" % ( self.debug("Detach volume: %s to VM: %s" % (
volume.id, volume.id,
self.virtual_machine.id self.virtual_machine.id
)) ))
self.virtual_machine.detach_volume( self.virtual_machine.detach_volume(
self.apiclient, self.apiclient,
@ -528,7 +535,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
True, True,
"Check list VM response for valid list" "Check list VM response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
len(vm_response), len(vm_response),
0, 0,
@ -540,7 +547,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
'Running', 'Running',
"Check the state of VM" "Check the state of VM"
) )
# Stop VM # Stop VM
self.debug("Stopping the VM: %s" % self.virtual_machine.id) self.debug("Stopping the VM: %s" % self.virtual_machine.id)
self.virtual_machine.stop(self.apiclient) self.virtual_machine.stop(self.apiclient)
@ -669,6 +676,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
raise Exception("Warning: Exception during cleanup : %s" % e) raise Exception("Warning: Exception during cleanup : %s" % e)
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_volume_iso_attach(self): def test_01_volume_iso_attach(self):
"""Test Volumes and ISO attach """Test Volumes and ISO attach
""" """
@ -690,7 +698,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
) )
self.debug("Created volume: %s for account: %s" % ( self.debug("Created volume: %s for account: %s" % (
volume.id, volume.id,
self.account.account.name self.account.account.name
)) ))
# Check List Volume response for newly created volume # Check List Volume response for newly created volume
list_volume_response = list_volumes( list_volume_response = list_volumes(
@ -743,7 +751,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
domainid=self.account.account.domainid, domainid=self.account.account.domainid,
) )
self.debug("Created ISO with ID: %s for account: %s" % ( self.debug("Created ISO with ID: %s for account: %s" % (
iso.id, iso.id,
self.account.account.name self.account.account.name
)) ))
@ -775,7 +783,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
True, True,
"Check list VM response for valid list" "Check list VM response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
len(vm_response), len(vm_response),
0, 0,
@ -864,6 +872,7 @@ class TestVolumes(cloudstackTestCase):
cleanup_resources(self.apiclient, self.cleanup) cleanup_resources(self.apiclient, self.cleanup)
return return
@attr(tags = ["advanced", "advancedns"])
def test_01_attach_volume(self): def test_01_attach_volume(self):
"""Attach a created Volume to a Running VM """Attach a created Volume to a Running VM
""" """
@ -947,6 +956,7 @@ class TestVolumes(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced", "advancedns"])
def test_02_detach_volume(self): def test_02_detach_volume(self):
"""Detach a Volume attached to a VM """Detach a Volume attached to a VM
""" """
@ -974,7 +984,7 @@ class TestVolumes(cloudstackTestCase):
True, True,
"Check list volumes response for valid list" "Check list volumes response for valid list"
) )
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_volume_response,
None, None,
@ -994,6 +1004,7 @@ class TestVolumes(cloudstackTestCase):
) )
return return
@attr(tags = ["advanced", "advancedns"])
def test_03_delete_detached_volume(self): def test_03_delete_detached_volume(self):
"""Delete a Volume unattached to an VM """Delete a Volume unattached to an VM
""" """
@ -1020,3 +1031,139 @@ class TestVolumes(cloudstackTestCase):
"Check if volume exists in ListVolumes" "Check if volume exists in ListVolumes"
) )
return return
class TestDeployVmWithCustomDisk(cloudstackTestCase):
@classmethod
def setUpClass(cls):
cls.api_client = super(
TestDeployVmWithCustomDisk,
cls
).getClsTestClient().getApiClient()
cls.services = Services().services
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client, cls.services)
cls.zone = get_zone(cls.api_client, cls.services)
cls.disk_offering = DiskOffering.create(
cls.api_client,
cls.services["disk_offering"],
custom=True
)
template = get_template(
cls.api_client,
cls.zone.id,
cls.services["ostypeid"]
)
cls.services["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
cls.services["virtual_machine"]["template"] = template.id
# Create VMs, NAT Rules etc
cls.account = Account.create(
cls.api_client,
cls.services["account"],
domainid=cls.domain.id
)
cls.services["account"] = cls.account.account.name
cls.service_offering = ServiceOffering.create(
cls.api_client,
cls.services["service_offering"]
)
cls._cleanup = [
cls.service_offering,
cls.disk_offering,
cls.account
]
def setUp(self):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
@attr(tags=["advanced", "configuration", "advancedns", "simulator",
"api", "basic", "eip", "sg"])
def test_deployVmWithCustomDisk(self):
"""Test custom disk sizes beyond range
"""
# Steps for validation
# 1. listConfigurations - custom.diskoffering.size.min
# and custom.diskoffering.size.max
# 2. deployVm with custom disk offering size < min
# 3. deployVm with custom disk offering min< size < max
# 4. deployVm with custom disk offering size > max
# Validate the following
# 2. and 4. of deploy VM should fail.
# Only case 3. should succeed.
# cleanup all created data disks from the account
config = Configurations.list(
self.apiclient,
name="custom.diskoffering.size.min"
)
self.assertEqual(
isinstance(config, list),
True,
"custom.diskoffering.size.min should be present in global config"
)
# minimum size of custom disk (in GBs)
min_size = int(config[0].value)
self.debug("custom.diskoffering.size.min: %s" % min_size)
config = Configurations.list(
self.apiclient,
name="custom.diskoffering.size.max"
)
self.assertEqual(
isinstance(config, list),
True,
"custom.diskoffering.size.min should be present in global config"
)
# maximum size of custom disk (in GBs)
max_size = int(config[0].value)
self.debug("custom.diskoffering.size.max: %s" % max_size)
self.debug("Creating a volume with size less than min cust disk size")
self.services["custom_volume"]["customdisksize"] = (min_size - 1)
self.services["custom_volume"]["zoneid"] = self.zone.id
with self.assertRaises(Exception):
Volume.create_custom_disk(
self.apiclient,
self.services["custom_volume"],
account=self.account.account.name,
domainid=self.account.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Create volume failed!")
self.debug("Creating a volume with size more than max cust disk size")
self.services["custom_volume"]["customdisksize"] = (max_size + 1)
with self.assertRaises(Exception):
Volume.create_custom_disk(
self.apiclient,
self.services["custom_volume"],
account=self.account.account.name,
domainid=self.account.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Create volume failed!")
self.debug("Creating a volume with size more than min cust disk " +
"but less than max cust disk size"
)
self.services["custom_volume"]["customdisksize"] = (min_size + 1)
try:
Volume.create_custom_disk(
self.apiclient,
self.services["custom_volume"],
account=self.account.account.name,
domainid=self.account.account.domainid,
diskofferingid=self.disk_offering.id
)
self.debug("Create volume of cust disk size succeeded")
except Exception as e:
self.fail("Create volume failed with exception: %s" % e)
return

View File

@ -158,6 +158,45 @@ class User:
[setattr(cmd, k, v) for k, v in kwargs.items()] [setattr(cmd, k, v) for k, v in kwargs.items()]
return(apiclient.listUsers(cmd)) return(apiclient.listUsers(cmd))
@classmethod
def registerUserKeys(cls, apiclient, userid):
cmd = registerUserKeys.registerUserKeysCmd()
cmd.id = userid
return apiclient.registerUserKeys(cmd)
def update(self, apiclient, **kwargs):
"""Updates the user details"""
cmd = updateUser.updateUserCmd()
cmd.id = self.id
[setattr(cmd, k, v) for k, v in kwargs.items()]
return (apiclient.updateUser(cmd))
@classmethod
def update(cls, apiclient, id, **kwargs):
"""Updates the user details (class method)"""
cmd = updateUser.updateUserCmd()
cmd.id = id
[setattr(cmd, k, v) for k, v in kwargs.items()]
return (apiclient.updateUser(cmd))
@classmethod
def login(cls, apiclient, username, password, domain=None, domainid=None):
"""Logins to the CloudStack"""
cmd = login.loginCmd()
cmd.username = username
# MD5 hashcoded password
mdf = hashlib.md5()
mdf.update(password)
cmd.password = mdf.hexdigest()
if domain:
cmd.domain = domain
if domainid:
cmd.domainid = domainid
return apiclient.login(cmd)
class VirtualMachine: class VirtualMachine:
"""Manage virtual machine lifecycle""" """Manage virtual machine lifecycle"""
@ -174,7 +213,8 @@ class VirtualMachine:
@classmethod @classmethod
def create(cls, apiclient, services, templateid=None, accountid=None, def create(cls, apiclient, services, templateid=None, accountid=None,
domainid=None, networkids=None, serviceofferingid=None, domainid=None, networkids=None, serviceofferingid=None,
securitygroupids=None, projectid=None, mode='basic'): securitygroupids=None, projectid=None, startvm=None,
diskofferingid=None, hostid=None, mode='basic'):
"""Create the instance""" """Create the instance"""
cmd = deployVirtualMachine.deployVirtualMachineCmd() cmd = deployVirtualMachine.deployVirtualMachineCmd()
@ -219,6 +259,12 @@ class VirtualMachine:
if projectid: if projectid:
cmd.projectid = projectid cmd.projectid = projectid
if startvm is not None:
cmd.startvm = startvm
if hostid:
cmd.hostid = hostid
virtual_machine = apiclient.deployVirtualMachine(cmd) virtual_machine = apiclient.deployVirtualMachine(cmd)
# VM should be in Running state after deploy # VM should be in Running state after deploy
@ -392,12 +438,17 @@ class Volume:
return Volume(apiclient.createVolume(cmd).__dict__) return Volume(apiclient.createVolume(cmd).__dict__)
@classmethod @classmethod
def create_custom_disk(cls, apiclient, services, def create_custom_disk(cls, apiclient, services, account=None,
account=None, domainid=None): domainid=None, diskofferingid=None):
"""Create Volume from Custom disk offering""" """Create Volume from Custom disk offering"""
cmd = createVolume.createVolumeCmd() cmd = createVolume.createVolumeCmd()
cmd.name = services["diskname"] cmd.name = services["diskname"]
cmd.diskofferingid = services["customdiskofferingid"]
if diskofferingid:
cmd.diskofferingid = diskofferingid
elif "customdiskofferingid" in services:
cmd.diskofferingid = services["customdiskofferingid"]
cmd.size = services["customdisksize"] cmd.size = services["customdisksize"]
cmd.zoneid = services["zoneid"] cmd.zoneid = services["zoneid"]
@ -601,7 +652,9 @@ class Template:
time.sleep(interval) time.sleep(interval)
elif 'Installing' not in template.status: elif 'Installing' not in template.status:
raise Exception("ErrorInDownload") raise Exception(
"Error in downloading template: status - %s" %
template.status)
elif timeout == 0: elif timeout == 0:
break break
@ -693,10 +746,12 @@ class Iso:
return return
elif 'Downloaded' not in response.status and \ elif 'Downloaded' not in response.status and \
'Installing' not in response.status: 'Installing' not in response.status:
raise Exception("ErrorInDownload") raise Exception(
"Error In Downloading ISO: ISO Status - %s" %
response.status)
elif timeout == 0: elif timeout == 0:
raise Exception("TimeoutException") raise Exception("ISO download Timeout Exception")
else: else:
timeout = timeout - 1 timeout = timeout - 1
return return
@ -728,12 +783,12 @@ class PublicIPAddress:
if zoneid: if zoneid:
cmd.zoneid = zoneid cmd.zoneid = zoneid
elif "zoneid" in services: elif "zoneid" in services:
services["zoneid"] cmd.zoneid = services["zoneid"]
if domainid: if domainid:
cmd.domainid = domainid cmd.domainid = domainid
elif "domainid" in services: elif "domainid" in services:
services["domainid"] cmd.domainid = services["domainid"]
if networkid: if networkid:
cmd.networkid = networkid cmd.networkid = networkid
@ -1143,7 +1198,7 @@ class LoadBalancerRule:
apiclient.removeFromLoadBalancerRule(cmd) apiclient.removeFromLoadBalancerRule(cmd)
return return
def update(self, apiclient, algorithm=None, description=None, name=None): def update(self, apiclient, algorithm=None, description=None, name=None, **kwargs):
"""Updates the load balancing rule""" """Updates the load balancing rule"""
cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd() cmd = updateLoadBalancerRule.updateLoadBalancerRuleCmd()
cmd.id = self.id cmd.id = self.id
@ -1154,8 +1209,40 @@ class LoadBalancerRule:
if name: if name:
cmd.name = name cmd.name = name
[setattr(cmd, k, v) for k, v in kwargs.items()]
return apiclient.updateLoadBalancerRule(cmd) return apiclient.updateLoadBalancerRule(cmd)
def createSticky(self, apiclient, methodname, name, description=None, param=None):
"""Creates a sticky policy for the LB rule"""
cmd = createLBStickinessPolicy.createLBStickinessPolicyCmd()
cmd.lbruleid = self.id
cmd.methodname = methodname
cmd.name = name
if description:
cmd.description = description
if param:
cmd.param = []
for name, value in param.items():
cmd.param.append({'name': name, 'value': value})
return apiclient.createLBStickinessPolicy(cmd)
def deleteSticky(self, apiclient, id):
"""Deletes stickyness policy"""
cmd = deleteLBStickinessPolicy.deleteLBStickinessPolicyCmd()
cmd.id = id
return apiclient.deleteLBStickinessPolicy(cmd)
@classmethod
def listStickyPolicies(cls, apiclient, lbruleid, **kwargs):
"""Lists stickiness policies for load balancing rule"""
cmd= listLBStickinessPolicies.listLBStickinessPoliciesCmd()
cmd.lbruleid = lbruleid
[setattr(cmd, k, v) for k, v in kwargs.items()]
return apiclient.listLBStickinessPolicies(cmd)
@classmethod @classmethod
def list(cls, apiclient, **kwargs): def list(cls, apiclient, **kwargs):
"""List all Load balancing rules matching criteria""" """List all Load balancing rules matching criteria"""
@ -1404,6 +1491,15 @@ class Network:
[setattr(cmd, k, v) for k, v in kwargs.items()] [setattr(cmd, k, v) for k, v in kwargs.items()]
return(apiclient.updateNetwork(cmd)) return(apiclient.updateNetwork(cmd))
def restart(self, apiclient, cleanup=None):
"""Restarts the network"""
cmd = restartNetwork.restartNetworkCmd()
cmd.id = self.id
if cleanup:
cmd.cleanup = cleanup
return(apiclient.restartNetwork(cmd))
@classmethod @classmethod
def list(cls, apiclient, **kwargs): def list(cls, apiclient, **kwargs):
"""List all Networks matching criteria""" """List all Networks matching criteria"""

Some files were not shown because too many files have changed in this diff Show More