moving out NetScaler network element code from CloudStack core into plugins/network-elements/netscaler

This commit is contained in:
Murali reddy 2012-06-21 18:57:18 -07:00
parent 99ee0ba9a3
commit 49b88472a5
22 changed files with 157 additions and 874 deletions

View File

@ -285,7 +285,6 @@
</copy>
</target>
<target name="build-ovm" depends="compile-ovm" />
<target name="build-server" depends="compile-server">
<mkdir dir="${server.dist.dir}" />
@ -480,7 +479,7 @@
<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, build-ovm, package-oss-systemvm-iso">
<target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-console-proxy, build-ovm, package-oss-systemvm-iso, build-netscaler, build-dp-user-dispersing">
<copy overwrite="true" todir="${dist.dir}">
<fileset dir="${base.dir}/build/deploy/">
<include name="deploy-agent.sh" />
@ -586,17 +585,29 @@
<delete dir="${dist.dir}" />
<delete dir="${unittest.dir}"/>
</target>
<!-- ===================== Ovm.Jar ===================== -->
<target name="compile-ovm" depends="-init, compile-server" description="Compile OVM">
<ant antfile="${base.dir}/plugins/hypervisors/ovm/build.xml" target="build"/>
</target>
<target name="compile-all" description="Compile all of the jars" depends="compile-utils, compile-api, compile-core, compile-server, compile-ovm"/>
<target name="compile-all" description="Compile all of the jars" depends="compile-utils, compile-api, compile-core, compile-server, compile-ovm, compile-netscaler"/>
<target name="clean-all" depends="clean, clean-awsapi" description="Clean all of the generated files, including dependency cache and javadoc">
<delete dir="${target.dir}" />
</target>
<!-- ===================== Ovm.Jar ===================== -->
<target name="compile-ovm" depends="-init, compile-server" description="Compile OVM">
<ant antfile="${base.dir}/plugins/hypervisors/ovm/build.xml" target="build"/>
</target>
<target name="build-ovm" depends="compile-ovm" />
<!-- =====================cloud-dp-user-dispersing.jar.Jar ===================== -->
<target name="compile-dp-user-dispersing" depends="-init, compile-server" description="Compile dp-user-dispersing">
<ant antfile="${base.dir}/plugins/deployment-planners/user-dispersing/build.xml" target="build"/>
</target>
<target name="build-dp-user-dispersing" depends="compile-dp-user-dispersing" />
<!-- ===================== Cloud-Plugin-Netscaler.Jar ===================== -->
<target name="compile-netscaler" depends="-init, compile-server" description="Compile NetScaler plugin">
<ant antfile="${base.dir}/plugins/network-elements/netscaler/build.xml" target="build"/>
</target>
<target name="build-netscaler" depends="compile-netscaler"/>
</project>

View File

@ -133,9 +133,9 @@
<adapter name="DomainChecker" class="com.cloud.acl.DomainChecker"/>
</adapters>
<adapters key="com.cloud.network.element.NetworkElement">
<adapter name="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
<adapter name="Netscaler" class="com.cloud.network.element.NetscalerElement"/>
<adapter name="F5BigIp" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
<adapter name="JuniperSRX" class="com.cloud.network.element.JuniperSRXExternalFirewallElement"/>
<adapter name="Netscaler" class="com.cloud.network.element.NetscalerElement"/>
<adapter name="F5BigIp" class="com.cloud.network.element.F5ExternalLoadBalancerElement"/>
<adapter name="VirtualRouter" class="com.cloud.network.element.VirtualRouterElement"/>
<adapter name="Ovs" class="com.cloud.network.element.OvsElement"/>
<adapter name="ExternalDhcpServer" class="com.cloud.network.element.ExternalDhcpElement"/>
@ -158,6 +158,8 @@
<adapter name="BasicAgentAuthorizer" class="com.cloud.agent.manager.authn.impl.BasicAgentAuthManager"/>
</adapters>
<pluggableservice name="VirtualRouterElementService" key="com.cloud.network.element.VirtualRouterElementService" class="com.cloud.network.element.VirtualRouterElement"/>
<pluggableservice name="NetscalerExternalLoadBalancerElementService" key="com.cloud.network.element.NetscalerLoadBalancerElementService" class="com.cloud.network.element.NetscalerElement"/>
<dao name="NetScalerPodDao" class="com.cloud.network.dao.NetScalerPodDaoImpl" singleton="false"/>
</management-server>
<configuration-server class="com.cloud.server.ConfigurationServerImpl">

View File

@ -1,12 +0,0 @@
#Tue Jun 19 15:34:37 PDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,609 +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.
-->
<project name="Cloud Stack User Dispersing Deployment Planner" default="help" basedir=".">
<description>
Cloud Stack ant build file
</description>
<!--
Test
Always use this variable to refer to the base directory because this
variable is changeable
-->
<dirname property="base.dir" file="${ant.file.Cloud Stack}/.." />
<property name="build.dir" location="${base.dir}/build" />
<!-- Import anything that the user wants to set-->
<!-- Import properties files and environment variables here -->
<property environment="env" />
<condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
<available file="${build.dir}/override/build-cloud.properties" />
</condition>
<condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
<available file="${build.dir}/override/cloud.properties" />
</condition>
<condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
<available file="${build.dir}/override/replace.properties" />
</condition>
<echo message="Using build parameters from ${build-cloud.properties.file}" />
<property file="${build-cloud.properties.file}" />
<echo message="Using company info from ${cloud.properties.file}" />
<property file="${cloud.properties.file}" />
<echo message="Using override file from ${override.file}" />
<property file="${override.file}" />
<property file="${base.dir}/build/build.number" />
<import file="${build.dir}/build-common.xml" />
<!-- 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="deprecation" value="off" />
<property name="target.compat.version" value="1.6" />
<property name="source.compat.version" value="1.6" />
<property name="debug" value="true" />
<property name="debuglevel" value="lines,source"/>
<!-- directories for build and distribution -->
<property name="dist.dir" location="${base.dir}/dist/" />
<property name="target.dir" location="${base.dir}/target" />
<property name="classes.dir" location="${target.dir}/classes" />
<property name="jar.dir" location="${target.dir}/jar" />
<property name="dep.cache.dir" location="${target.dir}/dep-cache" />
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
<property name="deps.dir" location="${base.dir}/deps" />
<property name="tools.jar.dir" location="${base.dir}/tools/tooljars" />
<!-- directories for client compilation-->
<property name="client.dir" location="${base.dir}/client" />
<property name="client.test.dir" location="${client.dir}/test" />
<property name="client.target.dir" location="${target.dir}/ui" />
<property name="ui.user.dir" location="${base.dir}/ui" />
<property name="setup.db.dir" location="${base.dir}/setup/db" />
<property name="setup.apidoc.dir" location="${base.dir}/setup/apidoc" />
<!-- directories for server compilation-->
<property name="server.dir" location="${base.dir}/server" />
<property name="server.test.dir" location="${server.dir}/test" />
<property name="server.dist.dir" location="${dist.dir}/client" />
<property name="db.scripts.dir" location="${target.dir}/db"/>
<property name="apidoc.scripts.dir" location="${base.dir}/setup/apidoc/"/>
<!-- directories for core code compilation-->
<property name="core.dir" location="${base.dir}/core" />
<property name="core.test.dir" location="${core.dir}/test/" />
<!-- directories for agent code compilation-->
<property name="agent.dir" location="${base.dir}/agent" />
<property name="agent.test.dir" location="${utils.dir}/test/" />
<property name="agent.dist.dir" location="${dist.dir}/agent" />
<property name="scripts.dir" location="${base.dir}/scripts" />
<property name="scripts.target.dir" location="${target.dir}/scripts"/>
<!-- directories for console proxy compilation-->
<property name="console-proxy.dir" location="${base.dir}/console-proxy" />
<property name="console-proxy.dist.dir" location="${dist.dir}/console-proxy" />
<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="deploy.dir" location="${build.dir}/deploy" />
<property name="production.dir" location="${deploy.dir}/production" />
<property name="meld.home" location="/usr/local/bin" />
<property name="assertion" value="-da" />
<!-- directory for vmware-base library -->
<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="utils.jar" value="cloud-utils.jar" />
<property name="server.jar" value="cloud-server.jar" />
<property name="agent.jar" value="cloud-agent.jar" />
<property name="console-proxy.jar" value="cloud-console-proxy.jar" />
<property name="api.jar" value="cloud-api.jar"/>
<property name="vmware-base.jar" value="cloud-vmware-base.jar" />
<!--
Import information about the build version and company information
-->
<property name="version" value="${company.major.version}.${company.minor.version}.${company.patch.version}" />
<!-- Class paths -->
<path id="prod.src.path">
<pathelement location="${server.dir}/src" />
<pathelement location="${utils.dir}/src" />
<pathelement location="${core.dir}/src" />
<pathelement location="${agent.dir}/src" />
</path>
<path id="src.classpath">
</path>
<path id="compile.deps.classpath">
<fileset dir="${tools.jar.dir}" erroronmissingdir="true">
<include name="*.jar" />
</fileset>
</path>
<path id="deps.classpath">
<!--filelist files="${deps.classpath}" /-->
<fileset dir="${deps.dir}" erroronmissingdir="false">
<include name="*.jar" />
</fileset>
<path refid="compile.deps.classpath" />
</path>
<path id="dist.classpath">
<fileset dir="${target.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${target.dir}/jar">
<include name="**/*.jar" />
</fileset>
</path>
<path id="test.classpath">
<fileset dir="${dist.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- directories for util code compilation-->
<property name="utils.dir" location="${base.dir}/utils" />
<property name="utils.test.dir" location="${utils.dir}/test/" />
<path id="utils.classpath">
<path refid="deps.classpath" />
</path>
<target name="compile-utils" depends="-init" description="Compile the utilities jar that is shared.">
<compile-java jar.name="${utils.jar}" top.dir="${utils.dir}" classpath="utils.classpath" >
<include-files>
<fileset dir="${utils.dir}/certs">
<include name="*.keystore" />
</fileset>
</include-files>
</compile-java>
</target>
<property name="api.dir" location="${base.dir}/api" />
<property name="api.test.dir" location="${api.dir}/test/" />
<path id="api.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath"/>
</path>
<target name="compile-api" depends="-init, compile-utils" description="Compile the utilities jar that is shared.">
<compile-java jar.name="${api.jar}" top.dir="${api.dir}" classpath="api.classpath" />
</target>
<path id="core.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-core" depends="-init, compile-utils, compile-api, compile-vmware-base" description="Compile the core business logic.">
<compile-java jar.name="${core.jar}" top.dir="${core.dir}" classpath="core.classpath" />
</target>
<path id="vmware-base.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-vmware-base" depends="-init, compile-utils" description="Compile the VMware support library">
<compile-java jar.name="${vmware-base.jar}" top.dir="${vmware-base.dir}" classpath="vmware-base.classpath" />
</target>
<path id="server.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-server" depends="-init, compile-utils, compile-core, compile-agent" description="Compile the management server.">
<compile-java jar.name="${server.jar}" top.dir="${server.dir}" classpath="server.classpath" />
</target>
<path id="client.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="build-scripts" depends="-init">
<copy todir="${scripts.target.dir}">
<fileset dir="${scripts.dir}">
<include name="**/*"/>
<exclude name="**/fsimage.so"/>
<exclude name="**/ping.tar.bz2"/>
<exclude name="**/vhd-util"/>
<exclude name="**/.*" />
</fileset>
<filterset>
<filter token="VERSION" value="${impl.version}"/>
</filterset>
</copy>
<copy todir="${scripts.target.dir}">
<fileset dir="${scripts.dir}">
<include name="**/fsimage.so"/>
<include name="**/ping.tar.bz2"/>
<include name="**/vhd-util"/>
</fileset>
</copy>
</target>
<target name="build-ui" depends="-init" description="Builds the UI">
<mkdir dir="${client.target.dir}" />
<copy todir="${client.target.dir}">
<fileset dir="${ui.user.dir}">
<include name="**/*.html" />
<include name="**/*.js"/>
<include name="**/*.jsp"/>
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
<filterset>
<filter token="VERSION" value="${impl.version}"/>
</filterset>
</copy>
<copy todir="${client.target.dir}">
<fileset dir="${ui.user.dir}">
<include name="**/*"/>
<exclude name="**/*.html" />
<exclude name="**/*.js"/>
<exclude name="**/*.jsp"/>
<exclude name="**/.classpath" />
<exclude name="**/.project" />
</fileset>
</copy>
<copy todir="${client.target.dir}">
<fileset dir="${client.dir}/WEB-INF/classes">
<include name="**/*.properties"/>
</fileset>
</copy>
</target>
<target name="build-ovm" depends="compile-ovm" />
<target name="build-server" depends="compile-server">
<mkdir dir="${server.dist.dir}" />
<mkdir dir="${server.dist.dir}/lib" />
<mkdir dir="${server.dist.dir}/conf" />
<copy todir="${jar.dir}">
<fileset dir="${deps.dir}">
<include name="cloud-*.jar"/>
</fileset>
</copy>
<copy overwrite="true" todir="${server.dist.dir}/conf">
<fileset dir="${base.dir}/client/tomcatconf">
<include name="*.in" />
</fileset>
<globmapper from="*.in" to="*" />
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile" value="${override.file}" />
</filterreader>
</filterchain>
</copy>
<copy overwrite="true" todir="${server.dist.dir}/conf">
<fileset dir="${server.dir}/src/com/cloud/migration">
<include name="*.xml" />
</fileset>
</copy>
<copy overwrite="true" todir="${db.scripts.dir}">
<fileset dir="${setup.db.dir}">
<include name="**/*"/>
</fileset>
<filterset>
<filter token="VERSION" value="${impl.version}"/>
</filterset>
</copy>
</target>
<path id="console-proxy.classpath">
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-console-proxy" depends="-init" description="Compile the console proxy.">
<compile-java jar.name="${console-proxy.jar}" top.dir="${console-proxy.dir}" classpath="console-proxy.classpath" >
<include-files>
<fileset dir="${console-proxy.dir}/certs">
<include name="*.keystore" />
<include name="*.crt" />
<include name="*.key" />
</fileset>
</include-files>
</compile-java>
</target>
<target name="copy-console-proxy" depends="-init">
<property name="copyto.dir" value="${console-proxy.dist.dir}" />
<mkdir dir="${copyto.dir}" />
<mkdir dir="${copyto.dir}/conf" />
<mkdir dir="${copyto.dir}/logs" />
<mkdir dir="${copyto.dir}/applet" />
<mkdir dir="${copyto.dir}/images" />
<mkdir dir="${copyto.dir}/js" />
<mkdir dir="${copyto.dir}/ui" />
<mkdir dir="${copyto.dir}/css" />
<mkdir dir="${copyto.dir}/certs" />
<copy todir="${copyto.dir}">
<fileset dir="${deps.dir}">
<include name="log4j-1.2.15.jar" />
<include name="apache-log4j-extras-1.0.jar" />
<include name="gson.jar" />
</fileset>
</copy>
<copy todir="${copyto.dir}">
<fileset dir="${jar.dir}">
<include name="cloud-console-proxy.jar" />
</fileset>
</copy>
<copy todir="${copyto.dir}/conf">
<fileset dir="${production.dir}/consoleproxy/conf">
<include name="log4j-cloud.xml" />
<include name="consoleproxy.properties" />
</fileset>
</copy>
<copy todir="${copyto.dir}/images">
<fileset dir="${console-proxy.dir}/images">
<include name="*.jpg" />
<include name="*.gif" />
<include name="*.png" />
<include name="*.cur" />
</fileset>
</copy>
<copy todir="${copyto.dir}/js">
<fileset dir="${console-proxy.dir}/js">
<include name="*.js" />
</fileset>
</copy>
<copy todir="${copyto.dir}/ui">
<fileset dir="${console-proxy.dir}/ui">
<include name="*.ftl" />
</fileset>
</copy>
<copy todir="${copyto.dir}/css">
<fileset dir="${console-proxy.dir}/css">
<include name="*.css" />
</fileset>
</copy>
<copy todir="${copyto.dir}/certs">
<fileset dir="${console-proxy.dir}/certs">
<include name="*.keystore" />
<include name="*.crt" />
<include name="*.key" />
</fileset>
</copy>
</target>
<target name="build-console-proxy" depends="-init, compile-console-proxy, copy-console-proxy">
<copy todir="${console-proxy.dist.dir}">
<fileset dir="${console-proxy.dir}/scripts">
</fileset>
</copy>
<copy todir="${console-proxy.dist.dir}/conf">
<fileset dir="${console-proxy.dir}/conf">
</fileset>
</copy>
</target>
<path id="agent.classpath">
<path refid="deps.classpath" />
<fileset dir="${target.dir}">
<include name="**/${core.jar}" />
<include name="**/${utils.jar}" />
<include name="**/${api.jar}"/>
</fileset>
</path>
<target name="compile-agent" depends="-init, compile-utils, compile-core, compile-api" description="Compile the management agent.">
<compile-java jar.name="${agent.jar}" top.dir="${agent.dir}" classpath="agent.classpath" />
</target>
<target name="build-agent" depends="-init, compile-agent">
<mkdir dir="${agent.dist.dir}" />
<mkdir dir="${agent.dist.dir}/scripts" />
<mkdir dir="${agent.dist.dir}/conf" />
<mkdir dir="${agent.dist.dir}/logs" />
<mkdir dir="${agent.dist.dir}/db" />
<mkdir dir="${agent.dist.dir}/storagehdpatch" />
<condition property="agent.properties" value="override/agent.properties" else="agent.properties">
<available file="${agent.dir}/conf/override/agent.properties" />
</condition>
<condition property="developer.properties" value="override/developer.properties" else="developer.properties">
<available file="${agent.dir}/conf/override/developer.properties" />
</condition>
<copy overwrite="true" todir="${agent.dist.dir}/conf" flatten="true">
<fileset dir="${agent.dir}/conf">
<include name="${agent.properties}" />
<include name="${developer.properties}" />
</fileset>
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile" value="${override.file}" />
</filterreader>
</filterchain>
</copy>
<copy overwrite="true" todir="${agent.dist.dir}/conf" flatten="true">
<fileset dir="${agent.dir}/conf">
<include name="log4j-cloud.xml.in" />
</fileset>
<globmapper from="*.in" to="*" />
<filterchain>
<filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile" value="${override.file}" />
</filterreader>
</filterchain>
</copy>
<delete file="${agent.dist.dir}/conf/log4j-cloud.xml.in"/>
<copy todir="${agent.dist.dir}">
<fileset dir="${agent.dir}/scripts">
<include name="agent.sh" />
<include name="run.sh" />
</fileset>
</copy>
</target>
<target name="build-servers" depends="-init, build-server" />
<target name="build-opensource" depends="-init, build-server, build-agent, build-scripts, build-ui, build-ovm, 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">
<include name="setup/**/*" />
</fileset>
</copy>
<copy overwrite="true" todir="${jar.dir}">
<fileset dir="${deps.dir}">
<include name="vmware-*.jar" />
</fileset>
</copy>
<chmod file="${dist.dir}/deploy-agent.sh" perm="uog+xr" />
<chmod file="${dist.dir}/deploy-server.sh" perm="uog+xr" />
</target>
<target name="build-systemvm-patch" depends="-init">
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.dir}/build-patch" />
<mkdir dir="${dist.dir}/build-patch/usr/sbin" />
<copy overwrite="true" todir="${dist.dir}/build-patch">
<fileset dir="${base.dir}/patches/systemvm/debian/config/" >
<include name="**/*"/>
</fileset>
<fileset dir="${base.dir}/patches/systemvm/debian/vpn/" >
<include name="**/*"/>
</fileset>
<fileset dir="${base.dir}/patches/systemvm/debian/xe/" >
<include name="**/*"/>
<exclude name="**/xe-*" />
<exclude name="**/xen-*" />
</fileset>
</copy>
<copy overwrite="true" todir="${dist.dir}/build-patch/usr/sbin/">
<fileset dir="${base.dir}/patches/systemvm/debian/xe/" >
<include name="**/xe-*" />
<include name="**/xen-*" />
</fileset>
</copy>
<tar destfile="${dist.dir}/patch.tar">
<tarfileset dir="${dist.dir}/build-patch/" filemode="755">
<include name="**/*"/>
<exclude name="**/.classpath" />
<exclude name="**/.project" />
<exclude name="**/wscript_build" />
</tarfileset>
</tar>
<copy file="${base.dir}/patches/systemvm/debian/config/root/.ssh/authorized_keys" todir="${dist.dir}/"/>
<gzip destfile="${dist.dir}/cloud-scripts.tgz" src="${dist.dir}/patch.tar"/>
<delete file="${dist.dir}/patch.tar"/>
<delete dir="${dist.dir}/build-patch"/>
</target>
<target name="help">
<echo level="info" message="Ant Build File for CloudStack" />
<echo level="info" message="Type 'ant -projecthelp' to get a list of targets and their descriptions." />
</target>
<target name="usage" depends="help" />
<target name="-init">
<mkdir dir="${dist.dir}" />
<mkdir dir="${target.dir}" />
<record name="${build.log}" loglevel="verbose" action="start" />
<!-- create a UTC build timestamp using ISO 8601 formatting -->
<tstamp>
<format property="utc.build.timestamp" pattern="yyyy-MM-dd'T'HH:mm:ss'Z'" timezone="GMT" />
</tstamp>
<!-- remember who/where did the build -->
<exec executable="hostname" outputproperty="host.name" />
<property name="builder.at" value="${user.name} at ${host.name}" />
<property name="builder.id" value="${builder.at}, on ${utc.build.timestamp}" />
<property name="built.by" value="${builder.at}, ${utc.build.timestamp}" />
<echo level="info" message="builder: ${builder.id}" />
<!-- set build.number property, stored in eponymous file -->
<buildnumber file="${build.dir}/build.number" />
<condition property="impl.version" value="${version}.${manual.build.number}" else="${version}.${utc.build.timestamp}">
<isset property="manual.build.number"/>
</condition>
<echo message="Build number is ${impl.version}" />
<!-- Create the build directory structure used by compile -->
<mkdir dir="${jar.dir}" />
<mkdir dir="${docs.dir}" />
<mkdir dir="${dep.cache.dir}" />
<record name="${build.log}" action="stop" />
</target>
<target name="clean" description="clean up files generated by the build">
<delete file="${build.log}" />
<delete dir="${classes.dir}" />
<delete dir="${jar.dir}" />
<delete dir="${dist.dir}" />
<delete dir="${unittest.dir}"/>
</target>
<!-- ===================== Ovm.Jar ===================== -->
<property name="ovm.jar" value="cloud-ovm.jar" />
<property name="ovm.dir" location="${base.dir}/ovm" />
<property name="ovm-scripts.dir" location="${ovm.dir}/scripts" />
<path id="ovm.classpath" >
<path refid="deps.classpath" />
<path refid="dist.classpath" />
</path>
<target name="compile-ovm" depends="-init, compile-server" description="Compile OVM">
<compile-java jar.name="${ovm.jar}" top.dir="${ovm.dir}" classpath="ovm.classpath" />
</target>
<target name="compile-all" description="Compile all of the jars" depends="compile-utils, compile-api, compile-core, compile-server, compile-ovm"/>
<target name="clean-all" depends="clean, clean-awsapi" description="Clean all of the generated files, including dependency cache and javadoc">
<delete dir="${target.dir}" />
</target>
</project>

View File

@ -1,215 +0,0 @@
// 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
package com.cloud.deploy;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import com.cloud.configuration.Config;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
@Local(value=DeploymentPlanner.class)
public class UserDispersingPlanner extends FirstFitPlanner implements DeploymentPlanner {
private static final Logger s_logger = Logger.getLogger(UserDispersingPlanner.class);
/**
* This method should reorder the given list of Cluster Ids by applying any necessary heuristic
* for this planner
* For UserDispersingPlanner we need to order the clusters by considering the number of VMs for this account
* @return List<Long> ordered list of Cluster Ids
*/
@Override
protected List<Long> reorderClusters(long id, boolean isZone, Pair<List<Long>, Map<Long, Double>> clusterCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
List<Long> clusterIdsByCapacity = clusterCapacityInfo.first();
if(vmProfile.getOwner() == null){
return clusterIdsByCapacity;
}
long accountId = vmProfile.getOwner().getAccountId();
Pair<List<Long>, Map<Long, Double>> clusterIdsVmCountInfo = listClustersByUserDispersion(id, isZone, accountId);
//now we have 2 cluster lists - one ordered by capacity and the other by number of VMs for this account
//need to apply weights to these to find the correct ordering to follow
if(_userDispersionWeight == 1.0f){
List<Long> clusterIds = clusterIdsVmCountInfo.first();
clusterIds.retainAll(clusterIdsByCapacity);
return clusterIds;
}else{
//apply weights to the two lists
return orderByApplyingWeights(clusterCapacityInfo, clusterIdsVmCountInfo, accountId);
}
}
/**
* This method should reorder the given list of Pod Ids by applying any necessary heuristic
* for this planner
* For UserDispersingPlanner we need to order the pods by considering the number of VMs for this account
* @return List<Long> ordered list of Pod Ids
*/
@Override
protected List<Long> reorderPods(Pair<List<Long>, Map<Long, Double>> podCapacityInfo, VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan){
List<Long> podIdsByCapacity = podCapacityInfo.first();
if(vmProfile.getOwner() == null){
return podIdsByCapacity;
}
long accountId = vmProfile.getOwner().getAccountId();
Pair<List<Long>, Map<Long, Double>> podIdsVmCountInfo = listPodsByUserDispersion(plan.getDataCenterId(), accountId);
//now we have 2 pod lists - one ordered by capacity and the other by number of VMs for this account
//need to apply weights to these to find the correct ordering to follow
if(_userDispersionWeight == 1.0f){
List<Long> podIds = podIdsVmCountInfo.first();
podIds.retainAll(podIdsByCapacity);
return podIds;
}else{
//apply weights to the two lists
return orderByApplyingWeights(podCapacityInfo, podIdsVmCountInfo, accountId);
}
}
protected Pair<List<Long>, Map<Long, Double>> listClustersByUserDispersion(long id, boolean isZone, long accountId){
if (s_logger.isDebugEnabled()) {
s_logger.debug("Applying Userdispersion heuristic to clusters for account: "+ accountId);
}
Pair<List<Long>, Map<Long, Double>> clusterIdsVmCountInfo;
if(isZone){
clusterIdsVmCountInfo = _vmInstanceDao.listClusterIdsInZoneByVmCount(id, accountId);
}else{
clusterIdsVmCountInfo = _vmInstanceDao.listClusterIdsInPodByVmCount(id, accountId);
}
if (s_logger.isTraceEnabled()) {
s_logger.trace("List of clusters in ascending order of number of VMs: "+ clusterIdsVmCountInfo.first());
}
return clusterIdsVmCountInfo;
}
protected Pair<List<Long>, Map<Long, Double>> listPodsByUserDispersion(long dataCenterId, long accountId) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Applying Userdispersion heuristic to pods for account: "+ accountId);
}
Pair<List<Long>, Map<Long, Double>> podIdsVmCountInfo = _vmInstanceDao.listPodIdsInZoneByVmCount(dataCenterId, accountId);
if (s_logger.isTraceEnabled()) {
s_logger.trace("List of pods in ascending order of number of VMs: "+ podIdsVmCountInfo.first());
}
return podIdsVmCountInfo;
}
private List<Long> orderByApplyingWeights(Pair<List<Long>, Map<Long, Double>> capacityInfo, Pair<List<Long>, Map<Long, Double>> vmCountInfo, long accountId){
List<Long> capacityOrderedIds = capacityInfo.first();
List<Long> vmCountOrderedIds = vmCountInfo.first();
Map<Long, Double> capacityMap = capacityInfo.second();
Map<Long, Double> vmCountMap = vmCountInfo.second();
if (s_logger.isTraceEnabled()) {
s_logger.trace("Capacity Id list: "+ capacityOrderedIds + " , capacityMap:"+capacityMap);
}
if (s_logger.isTraceEnabled()) {
s_logger.trace("Vm Count Id list: "+ vmCountOrderedIds + " , vmCountMap:"+vmCountMap);
}
List<Long> idsReorderedByWeights = new ArrayList<Long>();
float capacityWeight = (1.0f -_userDispersionWeight);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Applying userDispersionWeight: "+ _userDispersionWeight);
}
//normalize the vmCountMap
LinkedHashMap<Long, Double> normalisedVmCountIdMap= new LinkedHashMap<Long, Double>();
Long totalVmsOfAccount = _vmInstanceDao.countRunningByAccount(accountId);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Total VMs for account: "+ totalVmsOfAccount);
}
for(Long id : vmCountOrderedIds){
Double normalisedCount = vmCountMap.get(id) / totalVmsOfAccount;
normalisedVmCountIdMap.put(id, normalisedCount);
}
//consider only those ids that are in capacity map.
SortedMap<Double, List<Long>> sortedMap= new TreeMap<Double, List<Long>>();
for(Long id : capacityOrderedIds){
Double weightedCapacityValue = capacityMap.get(id) * capacityWeight;
Double weightedVmCountValue = normalisedVmCountIdMap.get(id) * _userDispersionWeight;
Double totalWeight = weightedCapacityValue + weightedVmCountValue;
if(sortedMap.containsKey(totalWeight)){
List<Long> idList = sortedMap.get(totalWeight);
idList.add(id);
sortedMap.put(totalWeight, idList);
}else{
List<Long> idList = new ArrayList<Long>();
idList.add(id);
sortedMap.put(totalWeight, idList);
}
}
for(List<Long> idList : sortedMap.values()){
idsReorderedByWeights.addAll(idList);
}
if (s_logger.isTraceEnabled()) {
s_logger.trace("Reordered Id list: "+ idsReorderedByWeights);
}
return idsReorderedByWeights;
}
@Override
public boolean canHandle(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid) {
if(vm.getHypervisorType() != HypervisorType.BareMetal){
//check the allocation strategy
if (_allocationAlgorithm != null && _allocationAlgorithm.equals(AllocationAlgorithm.userdispersing.toString())) {
return true;
}
}
return false;
}
float _userDispersionWeight;
@Override
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
super.configure(name, params);
String weight = _configDao.getValue(Config.VmUserDispersionWeight.key());
_userDispersionWeight = NumbersUtil.parseFloat(weight, 1.0f);
return true;
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/core"/>
<classpathentry combineaccessrules="false" kind="src" path="/server"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>user-dispersing</name>
<name>netscaler</name>
<comment></comment>
<projects>
</projects>

View File

@ -0,0 +1,129 @@
<?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.
-->
<project name="Cloud Stack NetScaler network element" default="help" basedir=".">
<description>
Cloud Stack ant build file
</description>
<dirname property="netscaler.base.dir" file="${ant.file.Cloud Stack NetScaler network element}/"/>
<!-- This directory must be set -->
<property name="top.dir" location="${netscaler.base.dir}/../../.."/>
<property name="build.dir" location="${top.dir}/build"/>
<echo message="build.dir=${build.dir}; top.dir=${top.dir}; netscaler.base.dir=${netscaler.base.dir}"/>
<!-- Import anything that the user wants to set-->
<!-- Import properties files and environment variables here -->
<property environment="env" />
<condition property="build-cloud.properties.file" value="${build.dir}/override/build-cloud.properties" else="${build.dir}/build-cloud.properties">
<available file="${build.dir}/override/build-cloud.properties" />
</condition>
<condition property="cloud.properties.file" value="${build.dir}/override/cloud.properties" else="${build.dir}/cloud.properties">
<available file="${build.dir}/override/cloud.properties" />
</condition>
<condition property="override.file" value="${build.dir}/override/replace.properties" else="${build.dir}/replace.properties">
<available file="${build.dir}/override/replace.properties" />
</condition>
<echo message="Using build parameters from ${build-cloud.properties.file}" />
<property file="${build-cloud.properties.file}" />
<echo message="Using company info from ${cloud.properties.file}" />
<property file="${cloud.properties.file}" />
<echo message="Using override file from ${override.file}" />
<property file="${override.file}" />
<property file="${build.dir}/build.number" />
<!-- In case these didn't get defined in the build-cloud.properties -->
<property name="branding.name" value="default" />
<property name="deprecation" value="off" />
<property name="target.compat.version" value="1.6" />
<property name="source.compat.version" value="1.6" />
<property name="debug" value="true" />
<property name="debuglevel" value="lines,source"/>
<echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
<!-- directories for build and distribution -->
<property name="target.dir" location="${top.dir}/target" />
<property name="classes.dir" location="${target.dir}/classes" />
<property name="jar.dir" location="${target.dir}/jar" />
<property name="dep.cache.dir" location="${target.dir}/dep-cache" />
<property name="build.log" location="${target.dir}/ant_verbose.txt" />
<property name="deps.dir" location="${top.dir}/deps" />
<property name="cloud-plugin-netscaler.jar" value="cloud-plugin-netscaler.jar" />
<import file="${build.dir}/build-common.xml"/>
<echo message="target.dir=${target.dir}; top.dir=${top.dir}"/>
<!-- This section needs to be replaced by some kind of dependency library-->
<path id="deps.classpath">
<!--filelist files="${deps.classpath}" /-->
<fileset dir="${deps.dir}" erroronmissingdir="false">
<include name="*.jar" />
</fileset>
</path>
<path id="cloudstack.classpath">
<fileset dir="${jar.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="netscaler.classpath">
<path refid="deps.classpath"/>
<path refid="cloudstack.classpath"/>
</path>
<!-- This section needs to be replaced by some kind of dependency library-->
<target name="deploy-netscaler" >
</target>
<target name="init" description="Initialize binaries directory">
<mkdir dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
<mkdir dir="${jar.dir}"/>
</target>
<target name="compile-netscaler" depends="init" description="Compile NetScaler">
<compile-java jar.name="${cloud-plugin-netscaler.jar}" top.dir="${netscaler.base.dir}" classpath="netscaler.classpath" />
</target>
<target name="clean-netscaler">
<delete dir="${classes.dir}/${cloud-plugin-netscaler.jar}"/>
</target>
<target name="build" depends="compile-netscaler"/>
<target name="clean" depends="clean-netscaler"/>
<target name="help" description="help">
<echo level="info" message="This is the build file for NetScaler"/>
<echo level="info" message="You can do a build by doing ant build or clean by doing ant clean" />
</target>
</project>

View File

@ -81,7 +81,6 @@ import com.cloud.network.dao.InlineLoadBalancerNicMapDaoImpl;
import com.cloud.network.dao.LBStickinessPolicyDaoImpl;
import com.cloud.network.dao.LoadBalancerDaoImpl;
import com.cloud.network.dao.LoadBalancerVMMapDaoImpl;
import com.cloud.network.dao.NetScalerPodDaoImpl;
import com.cloud.network.dao.NetworkDaoImpl;
import com.cloud.network.dao.NetworkDomainDaoImpl;
import com.cloud.network.dao.NetworkExternalFirewallDaoImpl;
@ -101,8 +100,6 @@ import com.cloud.network.element.F5ExternalLoadBalancerElement;
import com.cloud.network.element.F5ExternalLoadBalancerElementService;
import com.cloud.network.element.JuniperSRXExternalFirewallElement;
import com.cloud.network.element.JuniperSRXFirewallElementService;
import com.cloud.network.element.NetscalerElement;
import com.cloud.network.element.NetscalerLoadBalancerElementService;
import com.cloud.network.element.VirtualRouterElement;
import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.network.firewall.FirewallManagerImpl;
@ -323,7 +320,6 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
addDao("ExternalFirewallDeviceDao", ExternalFirewallDeviceDaoImpl.class);
addDao("NetworkExternalLoadBalancerDao", NetworkExternalLoadBalancerDaoImpl.class);
addDao("NetworkExternalFirewallDao", NetworkExternalFirewallDaoImpl.class);
addDao("NetScalerPodDao", NetScalerPodDaoImpl.class);
addDao("CiscoNexusVSMDeviceDao", CiscoNexusVSMDeviceDaoImpl.class);
addDao("ClusterVSMMapDao", ClusterVSMMapDaoImpl.class);
addDao("PortProfileDao", PortProfileDaoImpl.class);
@ -420,7 +416,6 @@ public class DefaultComponentLibrary extends ComponentLibraryBase implements Com
protected void populateServices() {
addService("VirtualRouterElementService", VirtualRouterElementService.class, VirtualRouterElement.class);
addService("NetscalerExternalLoadBalancerElementService", NetscalerLoadBalancerElementService.class, NetscalerElement.class);
addService("F5LoadBalancerElementService", F5ExternalLoadBalancerElementService.class, F5ExternalLoadBalancerElement.class);
addService("JuniperSRXFirewallElementService", JuniperSRXFirewallElementService.class, JuniperSRXExternalFirewallElement.class);
addService("CiscoNexusVSMElementService", CiscoNexusVSMElementService.class, CiscoNexusVSMElement.class);

View File

@ -56,10 +56,8 @@ import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.VpnUserDao;
import com.cloud.network.element.F5ExternalLoadBalancerElementService;
import com.cloud.network.element.JuniperSRXFirewallElementService;
import com.cloud.network.element.NetscalerLoadBalancerElementService;
import com.cloud.network.resource.F5BigIpResource;
import com.cloud.network.resource.JuniperSrxResource;
import com.cloud.network.resource.NetscalerResource;
import com.cloud.network.rules.dao.PortForwardingRulesDao;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.resource.ServerResource;
@ -106,7 +104,6 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
@Inject NetworkExternalLoadBalancerDao _networkExternalLBDao;
@Inject NetworkExternalFirewallDao _networkExternalFirewallDao;
@PlugService NetscalerLoadBalancerElementService _netsclarLbService;
@PlugService F5ExternalLoadBalancerElementService _f5LbElementService;
@PlugService JuniperSRXFirewallElementService _srxElementService;
@ -187,21 +184,6 @@ public class ExternalNetworkDeviceManagerImpl implements ExternalNetworkDeviceMa
} else {
throw new CloudRuntimeException("Failed to add SRX firewall device due to internal error");
}
} else if (cmd.getDeviceType().equalsIgnoreCase(NetworkDevice.NetscalerMPXLoadBalancer.getName()) ||
cmd.getDeviceType().equalsIgnoreCase(NetworkDevice.NetscalerVPXLoadBalancer.getName()) ||
cmd.getDeviceType().equalsIgnoreCase(NetworkDevice.NetscalerSDXLoadBalancer.getName())) {
Long physicalNetworkId = (params.get(ApiConstants.PHYSICAL_NETWORK_ID)==null)?Long.parseLong((String)params.get(ApiConstants.PHYSICAL_NETWORK_ID)):null;
String url = (String) params.get(ApiConstants.URL);
String username = (String) params.get(ApiConstants.USERNAME);
String password = (String) params.get(ApiConstants.PASSWORD);
ExternalLoadBalancerDeviceManager lbDeviceMgr = (ExternalLoadBalancerDeviceManager) _netsclarLbService;
ExternalLoadBalancerDeviceVO lbDeviceVO = lbDeviceMgr.addExternalLoadBalancer(physicalNetworkId,
url, username, password, cmd.getDeviceType(), (ServerResource) new NetscalerResource());
if (lbDeviceVO != null) {
return _hostDao.findById(lbDeviceVO.getHostId());
} else {
throw new CloudRuntimeException("Failed to add Netscaler load balancer device due to internal error");
}
} else if (cmd.getDeviceType().equalsIgnoreCase(NetworkDevice.F5BigIpLoadBalancer.getName())) {
Long physicalNetworkId = (params.get(ApiConstants.PHYSICAL_NETWORK_ID)==null)?Long.parseLong((String)params.get(ApiConstants.PHYSICAL_NETWORK_ID)):null;
String url = (String) params.get(ApiConstants.URL);