incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [14/50] [abbrv] git commit: moving out NetApp code to plugins/file-systems/netapp
Date Wed, 04 Jul 2012 00:35:29 GMT
moving out NetApp code to plugins/file-systems/netapp


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/8aa2b55d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/8aa2b55d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/8aa2b55d

Branch: refs/heads/vpc
Commit: 8aa2b55dd62cf488b63b7377610e1d8aa14a2fc6
Parents: 1581d65
Author: Murali reddy <Murali.Reddy@citrix.com>
Authored: Fri Jun 29 15:02:27 2012 -0700
Committer: Murali reddy <Murali.Reddy@citrix.com>
Committed: Mon Jul 2 08:34:02 2012 -0700

----------------------------------------------------------------------
 build/build-cloud-plugins.xml                      |   16 +-
 client/tomcatconf/components.xml.in                |    4 +
 plugins/file-systems/netapp/.classpath             |   11 +
 plugins/file-systems/netapp/.project               |   17 +
 plugins/file-systems/netapp/build.xml              |  129 ++
 .../cloud/api/commands/netapp/AssociateLunCmd.java |  100 ++
 .../cloud/api/commands/netapp/CreateLunCmd.java    |   98 ++
 .../commands/netapp/CreateVolumeOnFilerCmd.java    |  146 ++
 .../api/commands/netapp/CreateVolumePoolCmd.java   |   84 ++
 .../api/commands/netapp/DeleteVolumePoolCmd.java   |   76 ++
 .../cloud/api/commands/netapp/DestroyLunCmd.java   |   78 ++
 .../commands/netapp/DestroyVolumeOnFilerCmd.java   |   87 ++
 .../api/commands/netapp/DissociateLunCmd.java      |   79 ++
 .../com/cloud/api/commands/netapp/ListLunsCmd.java |   88 ++
 .../api/commands/netapp/ListVolumePoolsCmd.java    |   84 ++
 .../api/commands/netapp/ListVolumesOnFilerCmd.java |   94 ++
 .../api/commands/netapp/ModifyVolumePoolCmd.java   |   73 +
 .../netapp/src/com/cloud/netapp/LunVO.java         |  121 ++
 .../src/com/cloud/netapp/NetappAllocator.java      |   25 +
 .../cloud/netapp/NetappDefaultAllocatorImpl.java   |  142 ++
 .../netapp/src/com/cloud/netapp/NetappManager.java |   66 +
 .../src/com/cloud/netapp/NetappManagerImpl.java    | 1040 +++++++++++++++
 .../src/com/cloud/netapp/NetappVolumeVO.java       |  183 +++
 .../netapp/src/com/cloud/netapp/PoolVO.java        |   74 +
 .../netapp/src/com/cloud/netapp/dao/LunDao.java    |   31 +
 .../src/com/cloud/netapp/dao/LunDaoImpl.java       |   70 +
 .../netapp/src/com/cloud/netapp/dao/PoolDao.java   |   28 +
 .../src/com/cloud/netapp/dao/PoolDaoImpl.java      |   67 +
 .../netapp/src/com/cloud/netapp/dao/VolumeDao.java |   30 +
 .../src/com/cloud/netapp/dao/VolumeDaoImpl.java    |   99 ++
 .../cloud/api/commands/netapp/AssociateLunCmd.java |  100 --
 .../cloud/api/commands/netapp/CreateLunCmd.java    |   98 --
 .../commands/netapp/CreateVolumeOnFilerCmd.java    |  146 --
 .../api/commands/netapp/CreateVolumePoolCmd.java   |   84 --
 .../api/commands/netapp/DeleteVolumePoolCmd.java   |   76 --
 .../cloud/api/commands/netapp/DestroyLunCmd.java   |   78 --
 .../commands/netapp/DestroyVolumeOnFilerCmd.java   |   87 --
 .../api/commands/netapp/DissociateLunCmd.java      |   79 --
 .../com/cloud/api/commands/netapp/ListLunsCmd.java |   88 --
 .../api/commands/netapp/ListVolumePoolsCmd.java    |   84 --
 .../api/commands/netapp/ListVolumesOnFilerCmd.java |   94 --
 .../api/commands/netapp/ModifyVolumePoolCmd.java   |   73 -
 .../configuration/PremiumComponentLibrary.java     |    8 -
 server/src/com/cloud/netapp/LunVO.java             |  121 --
 server/src/com/cloud/netapp/NetappAllocator.java   |   25 -
 .../cloud/netapp/NetappDefaultAllocatorImpl.java   |  142 --
 server/src/com/cloud/netapp/NetappManager.java     |   66 -
 server/src/com/cloud/netapp/NetappManagerImpl.java | 1040 ---------------
 server/src/com/cloud/netapp/NetappVolumeVO.java    |  183 ---
 server/src/com/cloud/netapp/PoolVO.java            |   74 -
 server/src/com/cloud/netapp/dao/LunDao.java        |   31 -
 server/src/com/cloud/netapp/dao/LunDaoImpl.java    |   70 -
 server/src/com/cloud/netapp/dao/PoolDao.java       |   28 -
 server/src/com/cloud/netapp/dao/PoolDaoImpl.java   |   67 -
 server/src/com/cloud/netapp/dao/VolumeDao.java     |   30 -
 server/src/com/cloud/netapp/dao/VolumeDaoImpl.java |   99 --
 56 files changed, 3238 insertions(+), 3073 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/build/build-cloud-plugins.xml
----------------------------------------------------------------------
diff --git a/build/build-cloud-plugins.xml b/build/build-cloud-plugins.xml
index a464de9..dcadb93 100755
--- a/build/build-cloud-plugins.xml
+++ b/build/build-cloud-plugins.xml
@@ -184,9 +184,9 @@
   </path>
 
 
-  <target name="compile-plugins" description="Compile all of the jars corresponding to plugins" depends="compile-utils, compile-api, compile-core, compile-server, compile-hypervisors, compile-deployment-planners, compile-host-allocators, compile-network-elements, compile-user-authenticators, compile-storage-allocators "/>
+  <target name="compile-plugins" description="Compile all of the jars corresponding to plugins" depends="compile-utils, compile-api, compile-core, compile-server, compile-hypervisors, compile-deployment-planners, compile-host-allocators, compile-network-elements, compile-user-authenticators, compile-storage-allocators, compile-file-systems "/>
 
-  <target name="build-plugins" depends="build-hypervisors, build-network-elements, build-deployment-planners, build-host-allocators, build-storage-allocators, build-user-authenticators" description="Builds all jar's for the plug-in's"/>
+  <target name="build-plugins" depends="build-hypervisors, build-network-elements, build-deployment-planners, build-host-allocators, build-storage-allocators, build-user-authenticators, build-file-systems" description="Builds all jar's for the plug-in's"/>
 
   <target name="clean-plugins" description="Clean all of the generated files by the plugins">
       <delete file="${build.log}" />
@@ -302,4 +302,16 @@
   </target>
   <target name="build-ovs" depends="compile-ovs"/>
 
+
+  <!-- ===================== File Systems ===================== -->
+
+  <target name="compile-file-systems" depends="compile-netapp" description="Compils all supported file systems"/>
+  <target name="build-file-systems" depends="build-netapp" description="Builds all supported file systems"/>
+ 
+  <target name="compile-netapp" depends="-init, compile-server" description="Compile NetApp plugin">
+  	<ant antfile="${base.dir}/plugins/file-systems/netapp/build.xml" target="build"/>
+  </target>
+  <target name="build-netapp" depends="compile-netapp"/>
+
+
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/client/tomcatconf/components.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in
index c81e3f0..e4e062a 100755
--- a/client/tomcatconf/components.xml.in
+++ b/client/tomcatconf/components.xml.in
@@ -168,6 +168,10 @@
         <dao name="CiscoNexusVSMDeviceDao" class="com.cloud.network.dao.CiscoNexusVSMDeviceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelInterfaceDao" class="com.cloud.network.ovs.dao.OvsTunnelInterfaceDaoImpl" singleton="false"/>
         <dao name="OvsTunnelAccountDao" class="com.cloud.network.ovs.dao.OvsTunnelNetworkDaoImpl" singleton="false"/>
+        <dao name="NetappPool" class="com.cloud.netapp.dao.PoolDaoImpl" singleton="false"/>
+        <dao name="NetappVolume" class="com.cloud.netapp.dao.VolumeDaoImpl" singleton="false"/>
+        <dao name="NetappLun" class="com.cloud.netapp.dao.LunDaoImpl" singleton="false"/>
+        <manager name="NetappManager" key="com.cloud.netapp.NetappManager" class="com.cloud.netapp.NetappManagerImpl"/>
     </management-server>
 
     <configuration-server class="com.cloud.server.ConfigurationServerImpl">

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/.classpath
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/.classpath b/plugins/file-systems/netapp/.classpath
new file mode 100644
index 0000000..a3f5d12
--- /dev/null
+++ b/plugins/file-systems/netapp/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/api"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/core"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/server"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/utils"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/deps"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/.project
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/.project b/plugins/file-systems/netapp/.project
new file mode 100644
index 0000000..a4445c2
--- /dev/null
+++ b/plugins/file-systems/netapp/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>netapp</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/build.xml
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/build.xml b/plugins/file-systems/netapp/build.xml
new file mode 100755
index 0000000..6326e14
--- /dev/null
+++ b/plugins/file-systems/netapp/build.xml
@@ -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 Netapp FS" default="help" basedir=".">
+  <description>
+		Cloud Stack ant build file
+    </description>
+
+  <dirname property="netapp.base.dir" file="${ant.file.Cloud Stack Netapp FS}/"/>
+  <!-- This directory must be set -->
+  <property name="top.dir" location="${netapp.base.dir}/../../.."/>
+  <property name="build.dir" location="${top.dir}/build"/>
+	
+	<echo message="build.dir=${build.dir}; top.dir=${top.dir}; netapp.base.dir=${netapp.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-netapp.jar" value="cloud-plugin-netapp.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="netapp.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-netapp" >
+  </target>
+
+  <target name="init" description="Initialize binaries directory">
+  	<mkdir dir="${classes.dir}/${cloud-plugin-netapp.jar}"/>
+  	<mkdir dir="${jar.dir}"/>
+  </target>
+
+  <target name="compile-netapp" depends="init" description="Compile Netapp filesystem">
+    <compile-java jar.name="${cloud-plugin-netapp.jar}" top.dir="${netapp.base.dir}" classpath="netapp.classpath" />
+  </target>
+
+  <target name="clean-netapp">
+    <delete dir="${classes.dir}/${cloud-plugin-netapp.jar}"/>
+  </target>
+	
+  <target name="build" depends="compile-netapp"/>
+  <target name="clean" depends="clean-netapp"/>
+
+  <target name="help" description="help">
+    <echo level="info" message="This is the build file for NetApp FS for CloudStack"/>
+    <echo level="info" message="You can do a build by doing ant build or clean by doing ant clean" />
+  </target>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
new file mode 100644
index 0000000..db317e0
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java
@@ -0,0 +1,100 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.rmi.ServerException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.AssociateLunCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Associate a LUN with a guest IQN", responseObject = AssociateLunCmdResponse.class)
+public class AssociateLunCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(AssociateLunCmd.class.getName());
+    private static final String s_name = "associatelunresponse";
+
+	/////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="LUN name.")
+	private String lunName;
+    
+    @Parameter(name=ApiConstants.IQN, type=CommandType.STRING, required = true, description="Guest IQN to which the LUN associate.")
+	private String guestIqn;
+    
+    
+    ///////////////////////////////////////////////////
+	/////////////////// Accessors ///////////////////////
+	/////////////////////////////////////////////////////
+	 
+    
+    public String getLunName() {
+        return lunName;
+    }
+    
+    public String getGuestIQN() {
+    	return guestIqn;
+    }
+    
+	/////////////////////////////////////////////////////
+	/////////////// API Implementation///////////////////
+	/////////////////////////////////////////////////////
+
+	@Override
+	public String getCommandName() {
+		return s_name;
+	}
+	
+    @Override
+    public void execute(){
+    	ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	
+    	try {
+    		AssociateLunCmdResponse response = new AssociateLunCmdResponse();
+    		String returnVals[] = null;
+    		returnVals = netappMgr.associateLun(getGuestIQN(), getLunName());
+    		response.setLun(returnVals[0]);
+    		response.setIpAddress(returnVals[2]);
+    		response.setTargetIQN(returnVals[1]);
+    		response.setObjectName("lun");
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (ServerException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+    	}
+    }
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
new file mode 100644
index 0000000..2e0eb86
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java
@@ -0,0 +1,98 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.rmi.ServerException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.CreateLunCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Create a LUN from a pool", responseObject = CreateLunCmdResponse.class)
+public class CreateLunCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(CreateLunCmd.class.getName());
+    private static final String s_name = "createlunresponse";
+    
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+    
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+    
+    @Parameter(name=ApiConstants.SIZE, type=CommandType.LONG, required = true, description="LUN size.")
+    private long size;
+    
+    public String getPoolName() {
+    	return poolName;
+    }
+    
+    public long getLunSize() {
+    	return size;
+    }
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	
+    	try {
+    		CreateLunCmdResponse response = new CreateLunCmdResponse();
+    		String returnVals[] = null;
+    		returnVals = netappMgr.createLunOnFiler(getPoolName(), getLunSize());
+    		response.setPath(returnVals[0]);
+    		response.setIqn(returnVals[1]);
+    		response.setIpAddress(returnVals[2]);
+    		response.setObjectName("lun");
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (ServerException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+    	}
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
new file mode 100644
index 0000000..a301dee
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java
@@ -0,0 +1,146 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.net.UnknownHostException;
+import java.rmi.ServerException;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.CreateVolumeOnFilerCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class)
+public class CreateVolumeOnFilerCmd extends BaseCmd {
+    private static final String s_name = "createvolumeresponse";
+
+    @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
+	private String ipAddress;
+    
+    @Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
+	private String aggrName;
+
+    @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+    
+    @Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
+	private String volName;
+    
+    @Parameter(name=ApiConstants.SIZE, type=CommandType.INTEGER, required = true, description="volume size.")
+	private Integer volSize;
+    
+    @Parameter(name=ApiConstants.SNAPSHOT_POLICY, type=CommandType.STRING, required = false, description="snapshot policy.")
+	private String snapshotPolicy;
+    
+    @Parameter(name=ApiConstants.SNAPSHOT_RESERVATION, type=CommandType.INTEGER, required = false, description="snapshot reservation.")
+	private Integer snapshotReservation;
+    
+    @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="user name.")
+	private String userName;
+    
+    @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="password.")
+	private String password;
+    
+
+    public String getIpAddress() {
+    	return ipAddress;
+    }
+    
+    public String getAggrName() {
+    	return aggrName;
+    }
+    
+    public String getPoolName() {
+    	return poolName;
+    }
+    
+    public String volName() {
+    	return volName;
+    }
+    
+    public Integer getVolSize() {
+    	return volSize;
+    }
+    
+    public String getSnapshotPolicy() {
+    	return snapshotPolicy;
+    }
+    
+    public Integer getSnapshotReservation() {
+    	return snapshotReservation;
+    }
+    
+    public String getUserName() {
+    	return userName;
+    }
+    
+    public String getPassword() {
+    	return password;
+    }
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		//param checks
+		if(snapshotReservation != null && (snapshotReservation<0 || snapshotReservation>100))
+			throw new InvalidParameterValueException("Invalid snapshot reservation");
+		
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	
+		StringBuilder s = new StringBuilder(getVolSize().toString());
+		s.append("g");
+	
+		try {
+			netappMgr.createVolumeOnFiler(ipAddress, aggrName, poolName, volName, s.toString(), snapshotPolicy, snapshotReservation, userName, password);
+			CreateVolumeOnFilerCmdResponse response = new CreateVolumeOnFilerCmdResponse();
+			response.setResponseName(getCommandName());
+			this.setResponseObject(response);
+		} catch (ServerException e) {
+			throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+		} catch (InvalidParameterValueException e) {
+			throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+		} catch (UnknownHostException e) {
+			throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+		}
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
new file mode 100644
index 0000000..020493b
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java
@@ -0,0 +1,84 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.CreateVolumePoolCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Create a pool", responseObject = CreateVolumePoolCmdResponse.class)
+public class CreateVolumePoolCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(CreateVolumePoolCmd.class.getName());
+    private static final String s_name = "createpoolresponse";
+
+    @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+    @Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.")
+	private String algorithm;
+    
+    public String getPoolName() {
+    	return poolName;
+    }
+    
+    public String getAlgorithm() {
+    	return algorithm;
+    }
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	
+    	try {
+    		CreateVolumePoolCmdResponse response = new CreateVolumePoolCmdResponse();
+    		netappMgr.createPool(getPoolName(), getAlgorithm());
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+    	}
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
new file mode 100644
index 0000000..de12511
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java
@@ -0,0 +1,76 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.DeleteVolumePoolCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class)
+public class DeleteVolumePoolCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(DeleteVolumePoolCmd.class.getName());
+    private static final String s_name = "deletepoolresponse";
+    
+    @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+			netappMgr.deletePool(poolName);
+			DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse();
+			response.setResponseName(getCommandName());
+			this.setResponseObject(response);
+		} catch (InvalidParameterValueException e) {
+			throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+		} catch (ResourceInUseException e) {
+			throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+		}
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
new file mode 100644
index 0000000..76ccd0e
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java
@@ -0,0 +1,78 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.rmi.ServerException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.DeleteLUNCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Destroy a LUN", responseObject = DeleteLUNCmdResponse.class)
+public class DestroyLunCmd extends BaseCmd {
+    
+	public static final Logger s_logger = Logger.getLogger(DestroyLunCmd.class.getName());
+    private static final String s_name = "destroylunresponse";
+
+    @Parameter(name=ApiConstants.PATH, type=CommandType.STRING, required = true, description="LUN path.")
+	private String path;
+
+    @Override
+    public void execute() throws ResourceUnavailableException,
+    InsufficientCapacityException, ServerApiException,
+    ConcurrentOperationException, ResourceAllocationException {
+    	ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+			netappMgr.destroyLunOnFiler(path);
+    		DeleteLUNCmdResponse response = new DeleteLUNCmdResponse();
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	} catch (ServerException e) {
+    		throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+    	}
+    }
+
+    @Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
new file mode 100644
index 0000000..4bde7f5
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java
@@ -0,0 +1,87 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.rmi.ServerException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.DeleteVolumeOnFilerCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class)
+public class DestroyVolumeOnFilerCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(DestroyVolumeOnFilerCmd.class.getName());
+    private static final String s_name = "destroyvolumeresponse";
+    
+    @Parameter(name=ApiConstants.AGGREGATE_NAME, type=CommandType.STRING, required = true, description="aggregate name.")
+	private String aggrName;
+    
+    @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, required = true, description="ip address.")
+	private String ipAddr;
+    
+    @Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.")
+	private String volumeName;
+    
+    
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+    		netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName);
+    		DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse();
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	} catch (ResourceInUseException e) {
+    		throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString());
+    	} catch (ServerException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+		}
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
new file mode 100644
index 0000000..77425cb
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.rmi.ServerException;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.DissociateLunCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Dissociate a LUN", responseObject = DissociateLunCmdResponse.class)
+public class DissociateLunCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(DissociateLunCmd.class.getName());
+    private static final String s_name = "dissociatelunresponse";
+
+    @Parameter(name=ApiConstants.PATH, type=CommandType.STRING, required = true, description="LUN path.")
+	private String path;
+    
+    @Parameter(name=ApiConstants.IQN, type=CommandType.STRING, required = true, description="Guest IQN.")
+	private String guestIQN;
+    
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+    		netappMgr.disassociateLun(guestIQN, path);
+    		DissociateLunCmdResponse response = new DissociateLunCmdResponse();
+    		response.setResponseName(getCommandName());
+    		this.setResponseObject(response);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	} catch (ServerException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+		}
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
new file mode 100644
index 0000000..1101648
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.LunVO;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.ListLunsCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="List LUN", responseObject = ListLunsCmdResponse.class)
+public class ListLunsCmd extends BaseCmd 
+{
+	public static final Logger s_logger = Logger.getLogger(ListLunsCmd.class.getName());
+    private static final String s_name = "listlunresponse";
+
+    @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+    		List<LunVO> lunList = netappMgr.listLunsOnFiler(poolName);
+    		ListResponse<ListLunsCmdResponse> listResponse = new ListResponse<ListLunsCmdResponse>();
+    		List<ListLunsCmdResponse> responses = new ArrayList<ListLunsCmdResponse>();
+    		for (LunVO lun : lunList) {
+    			ListLunsCmdResponse response = new ListLunsCmdResponse();
+    			response.setId(lun.getId());
+    			response.setIqn(lun.getTargetIqn());
+    			response.setName(lun.getLunName());
+    			response.setVolumeId(lun.getVolumeId());
+    			response.setObjectName("lun");
+    			responses.add(response);
+    		}
+    		listResponse.setResponses(responses);
+    		listResponse.setResponseName(getCommandName());
+    		this.setResponseObject(listResponse);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	}		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
new file mode 100644
index 0000000..e646739
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java
@@ -0,0 +1,84 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.netapp.PoolVO;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.ListVolumePoolsCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="List Pool", responseObject = ListVolumePoolsCmdResponse.class)
+public class ListVolumePoolsCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(ListVolumePoolsCmd.class.getName());
+    private static final String s_name = "listpoolresponse";
+
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	try {
+    		List<PoolVO> poolList = netappMgr.listPools();
+    		ListResponse<ListVolumePoolsCmdResponse> listResponse = new ListResponse<ListVolumePoolsCmdResponse>();
+    		List<ListVolumePoolsCmdResponse> responses = new ArrayList<ListVolumePoolsCmdResponse>();
+    		for (PoolVO pool : poolList) {
+    			ListVolumePoolsCmdResponse response = new ListVolumePoolsCmdResponse();
+    			response.setId(pool.getId());
+    			response.setName(pool.getName());
+    			response.setAlgorithm(pool.getAlgorithm());
+    			response.setObjectName("pool");
+    			responses.add(response);
+    		}
+    		listResponse.setResponses(responses);
+    		listResponse.setResponseName(getCommandName());
+    		this.setResponseObject(listResponse);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString());
+    	}		
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
new file mode 100644
index 0000000..389053a
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java
@@ -0,0 +1,94 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.ListResponse;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.netapp.NetappVolumeVO;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.ListVolumesOnFilerCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class)
+public class ListVolumesOnFilerCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(ListVolumesOnFilerCmd.class.getName());
+    private static final String s_name = "listvolumesresponse";
+    
+    @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+
+	@Override
+	public void execute() throws ResourceUnavailableException,
+			InsufficientCapacityException, ServerApiException,
+			ConcurrentOperationException, ResourceAllocationException {
+		ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+    	
+    	try {
+    		List<NetappVolumeVO> volumes = netappMgr.listVolumesOnFiler(poolName);
+    		ListResponse<ListVolumesOnFilerCmdResponse> listResponse = new ListResponse<ListVolumesOnFilerCmdResponse>();
+    		List<ListVolumesOnFilerCmdResponse> responses = new ArrayList<ListVolumesOnFilerCmdResponse>();
+    		for (NetappVolumeVO volume : volumes) {
+    			ListVolumesOnFilerCmdResponse response = new ListVolumesOnFilerCmdResponse();
+    			response.setId(volume.getId());
+    			response.setIpAddress(volume.getIpAddress());
+    			response.setPoolName(volume.getPoolName());
+    			response.setAggrName(volume.getAggregateName());
+    			response.setVolumeName(volume.getVolumeName());
+    			response.setSnapshotPolicy(volume.getSnapshotPolicy());
+    			response.setSnapshotReservation(volume.getSnapshotReservation());
+    			response.setVolumeSize(volume.getVolumeSize());
+    			response.setObjectName("volume");
+    			responses.add(response);
+    		}
+    		listResponse.setResponses(responses);
+    		listResponse.setResponseName(getCommandName());
+    		this.setResponseObject(listResponse);
+    	} catch (InvalidParameterValueException e) {
+    		throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString());
+    	}
+		
+	}
+
+	@Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java
new file mode 100644
index 0000000..0bca290
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java
@@ -0,0 +1,73 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands.netapp;
+
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.netapp.NetappManager;
+import com.cloud.server.ManagementService;
+import com.cloud.server.api.response.netapp.ModifyVolumePoolCmdResponse;
+import com.cloud.utils.component.ComponentLocator;
+
+@Implementation(description="Modify pool", responseObject = ModifyVolumePoolCmdResponse.class)
+public class ModifyVolumePoolCmd extends BaseCmd {
+	public static final Logger s_logger = Logger.getLogger(ModifyVolumePoolCmd.class.getName());
+    private static final String s_name = "modifypoolresponse";
+
+    @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.")
+	private String poolName;
+
+    @Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.")
+	private String algorithm;
+
+    @Override
+    public void execute() throws ResourceUnavailableException,
+    InsufficientCapacityException, ServerApiException,
+    ConcurrentOperationException, ResourceAllocationException {
+    	ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
+    	NetappManager netappMgr = locator.getManager(NetappManager.class);
+
+    	netappMgr.modifyPool(poolName, algorithm);
+
+    	ModifyVolumePoolCmdResponse response = new ModifyVolumePoolCmdResponse();
+    	response.setResponseName(getCommandName());
+    	this.setResponseObject(response);
+    }
+
+    @Override
+	public String getCommandName() {
+		// TODO Auto-generated method stub
+		return s_name;
+	}
+
+	@Override
+	public long getEntityOwnerId() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/netapp/LunVO.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/LunVO.java b/plugins/file-systems/netapp/src/com/cloud/netapp/LunVO.java
new file mode 100644
index 0000000..af2e575
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/netapp/LunVO.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.netapp;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name="netapp_lun")
+public class LunVO {
+		
+	@Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id")
+    private Long id;
+	
+	@Column(name="lun_name")
+    private String lunName;
+
+	@Column(name="target_iqn")
+    private String targetIqn;
+	
+    @Column(name="path")
+	private String path;
+
+    @Column(name="volume_id")
+	private Long volumeId;
+
+    public Long getSize() {
+		return size;
+	}
+
+	public void setSize(Long size) {
+		this.size = size;
+	}
+
+
+	@Column(name="size")
+	private Long size;
+
+	public LunVO(){
+		
+	}
+	
+	public LunVO(String path, Long volumeId, Long size, String lunName, String targetIqn) {
+		this.path = path;
+		this.volumeId = volumeId;
+		this.size = size;
+		this.lunName = lunName;
+		this.targetIqn = targetIqn;
+	}
+	
+	public String getLunName() {
+		return lunName;
+	}
+
+	public void setLunName(String lunName) {
+		this.lunName = lunName;
+	}
+
+	public LunVO(Long id, String path, Long volumeId, Long size, String lunName, String targetIqn) {
+		this.id = id;
+		this.path = path;
+		this.volumeId = volumeId;
+		this.size = size;
+		this.lunName = lunName;
+		this.targetIqn = targetIqn;
+	}
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getPath() {
+		return path;
+	}
+
+	public void setPath(String path) {
+		this.path = path;
+	}
+
+	public Long getVolumeId() {
+		return volumeId;
+	}
+
+	public void setVolumeId(Long volumeId) {
+		this.volumeId = volumeId;
+	}
+	
+	public void setTargetIqn(String iqn){
+		this.targetIqn = iqn;
+	}
+	
+	public String getTargetIqn(){
+		return targetIqn;
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/netapp/NetappAllocator.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappAllocator.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappAllocator.java
new file mode 100644
index 0000000..0cc3629
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappAllocator.java
@@ -0,0 +1,25 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.netapp;
+
+
+public interface NetappAllocator{
+
+	public NetappVolumeVO chooseVolumeFromPool(String poolName, long lunSizeGb) ;
+
+	public NetappVolumeVO chooseLeastFullVolumeFromPool(String poolName,long lunSizeGb);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/netapp/NetappDefaultAllocatorImpl.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappDefaultAllocatorImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappDefaultAllocatorImpl.java
new file mode 100644
index 0000000..3692983
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappDefaultAllocatorImpl.java
@@ -0,0 +1,142 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.netapp;
+
+import java.io.IOException;
+import java.rmi.ServerException;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import netapp.manage.NaException;
+
+public class NetappDefaultAllocatorImpl implements NetappAllocator
+{
+	private static HashMap<String, Integer> _poolNameToLastVolumeIdAllocated = new HashMap<String, Integer>();
+	private NetappManager _netappMgr;
+    public static final Logger s_logger = Logger.getLogger(NetappDefaultAllocatorImpl.class.getName());
+	
+	public NetappDefaultAllocatorImpl(NetappManager netappMgr) {
+		_netappMgr = netappMgr;
+	}
+	
+	public synchronized NetappVolumeVO chooseLeastFullVolumeFromPool(String poolName, long lunSizeGb) 
+	{
+		List<NetappVolumeVO> volumesOnPoolAscending = _netappMgr.listVolumesAscending(poolName);
+		
+		if(volumesOnPoolAscending==null)
+		{
+			//no pools exist in db
+			return null;
+		}
+		
+		long maxAvailable = 0;
+		NetappVolumeVO selectedVol = null;
+		for(NetappVolumeVO vol : volumesOnPoolAscending)
+		{
+			try {
+				long availableBytes = _netappMgr.returnAvailableVolumeSize(vol.getVolumeName(), vol.getUsername(), vol.getPassword(), vol.getIpAddress());
+
+				if(lunSizeGb <= bytesToGb(availableBytes) && availableBytes>maxAvailable)
+				{
+					maxAvailable = availableBytes; //new max
+					selectedVol = vol; //new least loaded vol
+				}
+			} catch (ServerException se) {
+				s_logger.debug("Ignoring failure to obtain volume size for volume " + vol.getVolumeName());
+				continue;	
+			}
+		}
+		
+		return selectedVol;
+	}
+	
+	/**
+	 * This method does the actual round robin allocation
+	 * @param poolName 
+	 * @param lunSizeGb
+	 * @return -- the selected volume to create the lun on
+	 * @throws IOException
+	 * @throws NaException
+	 */
+	public synchronized NetappVolumeVO chooseVolumeFromPool(String poolName, long lunSizeGb)
+	{
+		int pos = 0; //0 by default
+		List<NetappVolumeVO> volumesOnPoolAscending = _netappMgr.listVolumesAscending(poolName);
+		
+		if(volumesOnPoolAscending==null)
+		{
+			//no pools exist in db
+			return null;
+		}
+		
+		//get the index of the record from the map
+		if(_poolNameToLastVolumeIdAllocated.get(poolName)==null)
+		{
+			pos=0;
+		}
+		else
+		{
+			pos=_poolNameToLastVolumeIdAllocated.get(poolName);
+		}
+		
+		//update for RR effect
+		_poolNameToLastVolumeIdAllocated.put(poolName, (pos+1)%volumesOnPoolAscending.size());
+		
+		//now iterate over the records
+		Object[] volumesOnPoolAscendingArray = volumesOnPoolAscending.toArray();
+		int counter=0;
+		while (counter < volumesOnPoolAscendingArray.length)
+		{
+			NetappVolumeVO vol = (NetappVolumeVO)volumesOnPoolAscendingArray[pos];
+			
+			//check if the volume fits the bill
+			long availableBytes;
+			try {
+				availableBytes = _netappMgr.returnAvailableVolumeSize(vol.getVolumeName(), vol.getUsername(), vol.getPassword(), vol.getIpAddress());
+									
+				if(lunSizeGb <= bytesToGb(availableBytes))
+				{
+					//found one
+					return vol;
+				}
+				pos = (pos + 1) % volumesOnPoolAscendingArray.length;
+				counter++;
+			} catch (ServerException e) {
+				s_logger.debug("Ignoring failure to obtain volume size for volume " + vol.getVolumeName());
+				continue;
+			}
+		}
+		
+		return null;
+	}
+	
+	
+	/**
+	 * This method does the byte to gb conversion
+	 * @param bytes 
+	 * @return -- converted gb
+	 */
+	private long bytesToGb(long bytes){
+		long returnVal = (bytes/(1024*1024*1024));
+		return returnVal;
+	}
+
+}
+
+	 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/8aa2b55d/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java
----------------------------------------------------------------------
diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java
new file mode 100644
index 0000000..7216c50
--- /dev/null
+++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java
@@ -0,0 +1,66 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.netapp;
+
+import java.net.UnknownHostException;
+import java.rmi.ServerException;
+import java.util.List;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceInUseException;
+import com.cloud.utils.component.Manager;
+
+public interface NetappManager  extends Manager {
+	enum AlgorithmType {
+		RoundRobin,
+		LeastFull
+	}
+	void destroyVolumeOnFiler(String ipAddress, String aggrName, String volName) throws ServerException, InvalidParameterValueException, ResourceInUseException;
+
+	void createVolumeOnFiler(String ipAddress, String aggName, String poolName,
+			String volName, String volSize, String snapshotPolicy,
+			Integer snapshotReservation, String username, String password)
+			throws UnknownHostException, ServerException, InvalidParameterValueException;
+
+	public String[] associateLun(String guestIqn, String path) throws ServerException, InvalidParameterValueException;
+
+
+	void disassociateLun(String iGroup, String path) throws ServerException, InvalidParameterValueException;
+
+	List<LunVO> listLunsOnFiler(String poolName);
+
+	void destroyLunOnFiler(String path) throws ServerException, InvalidParameterValueException;
+
+	List<NetappVolumeVO> listVolumesOnFiler(String poolName);
+
+	List<NetappVolumeVO> listVolumesAscending(String poolName);
+
+	long returnAvailableVolumeSize(String volName, String userName,
+			String password, String serverIp) throws ServerException;
+
+	void createPool(String poolName, String algorithm) throws InvalidParameterValueException;
+
+	void modifyPool(String poolName, String algorithm) throws InvalidParameterValueException;
+
+	void deletePool(String poolName) throws InvalidParameterValueException, ResourceInUseException;
+
+	List<PoolVO> listPools();
+
+	public String[] createLunOnFiler(String poolName, Long lunSize) throws InvalidParameterValueException, ServerException, ResourceAllocationException;
+
+}


Mime
View raw message