diff --git a/client/pom.xml b/client/pom.xml index 7a11972ec3b..63905b1dfb1 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -1081,21 +1081,6 @@ - - netapp - - - noredist - - - - - org.apache.cloudstack - cloud-plugin-netapp - ${project.version} - - - f5 diff --git a/cloud-cli/bindir/cloudvoladm b/cloud-cli/bindir/cloudvoladm deleted file mode 100755 index 16f31bde89f..00000000000 --- a/cloud-cli/bindir/cloudvoladm +++ /dev/null @@ -1,607 +0,0 @@ -#!/usr/bin/env python - -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -import sys -import os -import subprocess -import cloudtool -import urllib2 -from optparse import OptionParser, OptionGroup, OptParseError, BadOptionError, OptionError, OptionConflictError, OptionValueError -import xml.dom.minidom - -NetAppServerIP=None -NetAppUserName=None -NetAppPassword=None -CloudStackSvrIP=None -CloudStackSvrPort=8096 - - -cmds=["createvol","deletevol", "listvol", "createlun", "listlun", "destroylun", "assoclun", "disassoclun", "createpool", "modifypool", "destroypool", "listpools"] -header = "Volume Manager CLI, the available COMMANDS are:" - - -def cmd_help(): - print header - print - print "createpool add a new pool to the system" - print "modifypool change the allocation algorithm for a pool" - print "destroypool destroy a pool" - print "listpools list all the pools" - print "createvol add volume to a storage server" - print "deletevol delete volume on a storage server" - print "listvol list volume on a storage server" - print "createlun create LUN on a storage server" - print "listlun list LUN on a storage server" - print "destroylun destroy LUN on a storage server" - print "assoclun assoc LUN on a storage server" - print "disassoclun disassoc LUN on a storage server" - print - print "\"cloudvoladm COMMAND --help\" for more information on a specific command" - print - print "Global Options:" - print "--cloudStackMgtSvrIP the IP address of CloudStack Management Server" - print - print "Config file is ~/.cloudvoladmrc, Config options including: " - print "cloudStackMgtSvrIP=Cloudstack Management Server Address, which can be overriden by --cloudStackMgtSvrIP. If neither is provided, localhost is used." - -usage="Volume Manager CLI: add a new volume to a storage pool" -addvolParser= OptionParser(usage) -addvolParser.add_option("-i", metavar="server ip", dest="server_ip", help="The IP address of the storage server") -addvolParser.add_option("-u", metavar="username", dest="username", help="username to access the storage server with") -addvolParser.add_option("-w", metavar="password", dest="password", help="the password to access the storage server with") -addvolParser.add_option("-p", dest="pool_name", help="the name of the pool to allocate from") -addvolParser.add_option("-a", dest="aggregate_name", help="the name of aggregate") -addvolParser.add_option("-v", dest="vol_name", help="the name of volume") -addvolParser.add_option("-s", dest="size", help="size in GB eg.1") -optionalGroup = OptionGroup(addvolParser, "Optional") -optionalGroup.add_option("-r", dest="percentage", help="Percentage used for snapshot reserve") -optionalGroup.add_option("-S", dest="snapshots", help="Snapshot schedule in @ @ e.g. \"2 4 5@1,4 6@2,5\"") -addvolParser.add_option_group(optionalGroup) - -usage="Volume Manager CLI: remove a volume from a pool" -delvolParser= OptionParser(usage) -delvolParser.add_option("-i", metavar="server ip", dest="server_ip", help="The IP address of the storage server") -delvolParser.add_option("-a", dest="aggregate_name", help="The name of aggregate") -delvolParser.add_option("-v", dest="vol_name", help="The name of volume") - -usage="Volume Manager CLI: list all volumes known to exist in a pool" -listvolParser= OptionParser(usage) -listvolParser.add_option("-p", dest="pool_name", help="The name of the pool to list volumes from") - -usage="Volume Manager CLI: create a LUN on a pool" -createlunParser = OptionParser(usage) -createlunParser.add_option("-p", dest="pool_name", help="The name of the pool to add the volume to") -createlunParser.add_option("-s", dest="size", help="The size in GB e.g. 100") - -usage="Volume Manager CLI: list LUN on a pool" -listlunParser = OptionParser(usage) -listlunParser.add_option("-p", dest="pool_name", help="The pool name") - -usage="Volume Manager CLI: destroy a LUN " -destroylunParser = OptionParser(usage) -destroylunParser.add_option("-l", dest="lun_name", help="The LUN name") - -usage="Volume Manager CLI: Add a new pool to the system" -createPoolParser = OptionParser(usage) -createPoolParser.add_option("-p", dest="pool_name", help="The pool name") -createPoolParser.add_option("-A", dest="algorithm", help="roundrobin or leastfull") - - -usage="Volume Manager CLI: change the allocation algorithm for a pool" -modifyPoolParser = OptionParser(usage) -modifyPoolParser.add_option("-p", dest="pool_name", help="The pool name") -modifyPoolParser.add_option("-A", dest="algorithm", help="roundrobin or leastfull") - -usage="Volume Manager CLI: destroy a pool" -destroyPoolParser = OptionParser(usage) -destroyPoolParser.add_option("-p", dest="pool_name", help="The pool name") - -usage="Volume Manager CLI: list pools" -listPoolParser = OptionParser(usage) - -usage="Volume Manager CLI: associate a LUN with a guest that uses the stated IQN as client" -assocLunParser = OptionParser(usage) -assocLunParser.add_option("-g", dest="guest_iqn", help="the guest IQN. By default, it reads from /etc/iscsi/initiatorname.iscsi") -assocLunParser.add_option("-l", dest="lun_name", help="The LUN name") - -usage="Volume Manager CLI: disassociate a LUN with a guest that uses the stated IQN as client" -disassocLunParser = OptionParser(usage) -disassocLunParser.add_option("-g", dest="guest_iqn", help="the guest IQN. By default, it reads from /etc/iscsi/initiatorname.iscsi") -disassocLunParser.add_option("-l", dest="lun_name", help="The LUN name") - -cmdParsers = {cmds[0]:addvolParser, cmds[1]:delvolParser, cmds[2]:listvolParser, cmds[3]:createlunParser, cmds[4]:listlunParser, - cmds[5]:destroylunParser, cmds[6]:assocLunParser, cmds[7]:disassocLunParser, cmds[8]:createPoolParser, cmds[9]:modifyPoolParser, cmds[10]:destroyPoolParser, cmds[11]:listPoolParser} - - -def validate_parameter(input, signature): - (options, args) = signature.parse_args([]) - inputDict = input.__dict__ - sigDict = options.__dict__ - for k,v in sigDict.iteritems(): - inputValue = inputDict[k] - if inputValue == None: - print "Volume Manager CLI: missing operand " - print - signature.parse_args(["--help"]) - -def help_callback(option, opt, value, parser): - argv = sys.argv[1:] - try: - argv.remove(opt) - except: - argv.remove("--h") - - if len(argv) == 0: - cmd_help() - return - (options, args) = parser.parse_args(argv) - for cmd in cmds: - if cmd == args[0]: - cmdParsers[cmd].parse_args(["--help"]) - -def Help(): - usage = "usage: %prog cmd[createpool|listpools|modifypool|destroypool|createvol|deletevol|listvol|createlun|listlun|destroylun|assoclun|disassoclun] arg1 arg2 [--help, -h]" - parser = OptionParser(usage=usage, add_help_option=False) - parser.add_option("-h", "--help", action="callback", callback=help_callback); - parser.add_option("-i", metavar="server ip", dest="server_ip", help="The IP address of the storage server") - parser.add_option("--cloudstackSvr", dest="cloudstackSvr", help="cloudStack Server IP") - parser.add_option("-u", metavar="username", dest="username", help="username to access the storage server with") - parser.add_option("-w", metavar="password", dest="password", help="the password to access the storage server with") - parser.add_option("-p", dest="pool_name", help="the name of the pool to allocate from") - parser.add_option("-v", dest="vol_name", help="the name of volume") - parser.add_option("-A", dest="algorithm", help="roundrobin or leastfull") - parser.add_option("-a", dest="aggregate_name", help="The name of aggregate") - parser.add_option("-o", dest="options", help="requested option string for the NFS export or attach") - parser.add_option("-S", dest="snapshots", help="Snapshot schedule e.g.2 4 5@1,4 6@2,5") - parser.add_option("-r", dest="percentage", help="Percentage used for snapshot reservation") - parser.add_option("-s", dest="size", help="size in GB eg.1") - parser.add_option("-t", dest="target_iqn", help="the target IQN") - parser.add_option("-g", dest="guest_iqn", help="the guest IQN") - parser.add_option("-l", dest="lun_name", help="the LUN name") - - return parser - -def httpErrorHandler(code, msg): - try: - errtext = xml.dom.minidom.parseString(msg) - if errtext.getElementsByTagName("errortext") is not None: - err = getText(errtext.getElementsByTagName("errortext")[0].childNodes).strip() - print err - except: - print "Internal Error %s"%msg - -def getText(nodelist): - rc = [] - for node in nodelist: - if node.nodeType == node.TEXT_NODE: rc.append(node.data) - return ''.join(rc) - -def createvol(options): - args = [] - if options.pool_name == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - if options.aggregate_name == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - if options.vol_name == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - - if options.snapshots != None: - args += ['--snapshotpolicy=' + options.snapshots] - - if options.size == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - - if options.percentage != None: - args += ['--snapshotreservation=' + options.percentage] - - if NetAppServerIP == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - - if NetAppUserName == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - - if NetAppPassword == None: - print "Volume Manager CLI: missing operand " - print - addvolParser.parse_args(["--help"]) - - ''' - snapshot = options.snapshots - tokens = snapshot.split(" ") - print tokens - pos = 0; - for token in tokens: - if pos == 0: - #week - try: - week = int(token) - if week < 0: - raise - except: - print "Pls input correct week" - sys.exit(1) - elif pos == 1: - try: - day = int(token) - if day < 0: - raise - except: - print "Pls input correct day" - sys.exit(1) - - elif pos == 2: - try: - hours = token.split("@") - if int(hours[0]) < 0: - raise - hourlists = hours[1].split(",") - for hour in hourlists: - if int(hour) < 0 or int(hour) > 24: - raise - except: - print "Pls input correct hour" - sys.exit(1) - elif pos == 3: - try: - minutes = token.split("@") - if int(minutes[0]) < 0: - raise - - minuteslist = minutes[1].split(",") - for minute in minuteslist: - if int(minute) < 0 or int(minute) > 60: - raise - except: - print "Pls input correct hour" - sys.exit(1) - - ''' - - - try: - output = cloudtool.main(['cloud-tool', 'createVolumeOnFiler', '--ipaddress=' + NetAppServerIP , '--aggregatename=' + options.aggregate_name, - '--poolname=' + options.pool_name, '--volumename=' + options.vol_name, - '--size=' + options.size, - '--username=' + NetAppUserName, '--password=' + NetAppPassword, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"] + args) - print "Successfully added volume" - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing createvol cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing createvol cmd failed: %s" % (err.reason) - sys.exit(1) - - -def deletevol(options): - validate_parameter(options, delvolParser) - - try: - output = cloudtool.main(['cloud-tool', 'destroyVolumeOnFiler', '--ipaddress=' + NetAppServerIP, '--aggregatename=' + options.aggregate_name, - '--volumename=' + options.vol_name, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully deleted volume" - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing deletevol cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing deletevol cmd failed: %s" % (err.reason) - sys.exit(1) - -def listvol(options): - validate_parameter(options, listvolParser) - - try: - output = cloudtool.main(['cloud-tool', 'listVolumesOnFiler', '--poolname=' + options.pool_name, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]).strip("\n") - - xmlResult = xml.dom.minidom.parseString(output) - print "%-10s %-20s %-20s %-40s %-20s %-30s "%('Id', 'Address', 'Aggregate', 'Volume', 'Size(GB)', 'snapshotPolicy', ) - for volume in xmlResult.getElementsByTagName("volume"): - aggregatename = getText(volume.getElementsByTagName('aggregatename')[0].childNodes).strip() - id = getText(volume.getElementsByTagName('id')[0].childNodes).strip() - volumeName = getText(volume.getElementsByTagName('volumename')[0].childNodes).strip() - snapshotPolicy = getText(volume.getElementsByTagName('snapshotpolicy')[0].childNodes).strip() - ipaddress = getText(volume.getElementsByTagName('ipaddress')[0].childNodes).strip() - volSize = getText(volume.getElementsByTagName('size')[0].childNodes).strip() - print "%-10s %-20s %-20s %-40s %-20s %-30s "%(id, ipaddress, aggregatename, volumeName, volSize, snapshotPolicy) - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing listvol cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing listvol cmd failed: %s" % (err.reason) - sys.exit(1) - - -def createlun(options): - validate_parameter(options, createlunParser) - - try: - output = cloudtool.main(['cloud-tool', 'createLunOnFiler', '--name=' + options.pool_name, - '--size=' + options.size, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - - xmlResult = xml.dom.minidom.parseString(output.strip("\n")) - path = getText(xmlResult.getElementsByTagName("path")[0].childNodes).strip() - iqn = getText(xmlResult.getElementsByTagName("iqn")[0].childNodes).strip() - ipAddr = getText(xmlResult.getElementsByTagName('ipaddress')[0].childNodes).strip() - print "%-30s %-30s %-50s "%('LUN Name', 'Address', 'Target IQN') - print "%-30s %-30s %-50s "%(path, ipAddr, iqn) - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing createlun cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing createlun cmd failed: %s" % (err.reason) - sys.exit(1) - -def listlun(options): - validate_parameter(options, listlunParser) - - args = ["--poolname=" + options.pool_name, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"] - try: - output = cloudtool.main(['cloud-tool', 'listLunsOnFiler'] + args).strip("\n") - xmlResult = xml.dom.minidom.parseString(output) - - print "%-10s %-10s %-50s %-30s "%('LUN Id', 'Volume Id', 'Target IQN', 'LUN Name') - for volume in xmlResult.getElementsByTagName("lun"): - uuid = getText(volume.getElementsByTagName('id')[0].childNodes).strip() - path = getText(volume.getElementsByTagName('name')[0].childNodes).strip() - targetiqn = getText(volume.getElementsByTagName('iqn')[0].childNodes).strip() - volumeId = getText(volume.getElementsByTagName('volumeid')[0].childNodes).strip() - print "%-10s %-10s %-50s %-30s "%(uuid, volumeId, targetiqn, path) - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing listlun cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing listlun cmd failed: %s" % (err.reason) - sys.exit(1) - -def destroylun(options): - validate_parameter(options, destroylunParser) - - try: - output = cloudtool.main(['cloud-tool', 'destroyLunOnFiler', '--path=' + options.lun_name, - "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully destroyed LUN" - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing destroylun cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing destroylun failed: %s" % (err.reason) - sys.exit(1) - -def assoclun(options): - validate_parameter(options, assocLunParser) - - try: - output = cloudtool.main(['cloud-tool', 'associateLun', '--name=' + options.lun_name, - '--iqn=' + options.guest_iqn, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - xmlResult = xml.dom.minidom.parseString(output.strip("\n")) - lunid = getText(xmlResult.getElementsByTagName("id")[0].childNodes).strip() - iqn = getText(xmlResult.getElementsByTagName("targetiqn")[0].childNodes).strip() - ipAddr = getText(xmlResult.getElementsByTagName('ipaddress')[0].childNodes).strip() - print "%-30s %-30s %-50s "%('LUN Id', 'Address', 'Target IQN') - print "%-30s %-30s %-50s" % (lunid, ipAddr, iqn) - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing assoclun cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing assoclun failed: %s" % (err.reason) - sys.exit(1) - -def disassoclun(options): - validate_parameter(options, disassocLunParser) - - try: - output = cloudtool.main(['cloud-tool', 'dissociateLun', '--path=' + options.lun_name, - '--iqn=' + options.guest_iqn, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully dissociated LUN" - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing disassoclun cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing disassoclun failed: %s" % (err.reason) - sys.exit(1) - -def createpool(options): - validate_parameter(options, createPoolParser) - - if not (options.algorithm == "roundrobin" or options.algorithm == "leastfull"): - print "Only roundrobin or leastfull algorithm is supported" - sys.exit(1) - try: - output = cloudtool.main(['cloud-tool', 'createPool', '--name=' + options.pool_name, - '--algorithm=' + options.algorithm, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully created pool" - except urllib2.HTTPError, err: - code = err.code - print "executing createpool cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, err.read()) - sys.exit(1) - except urllib2.URLError, err: - print "executing createpool failed: %s" % (err.reason) - sys.exit(1) - -def listpools(options): - try: - output = cloudtool.main(['cloud-tool', 'listPools', - "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - output = output.strip("\n") - xmlResult = xml.dom.minidom.parseString(output) - print "%-10s %-40s %-10s" %('Id', 'Pool Name', 'Algorithm') - for volume in xmlResult.getElementsByTagName("pool"): - id = getText(volume.getElementsByTagName('id')[0].childNodes).strip() - poolname = getText(volume.getElementsByTagName('name')[0].childNodes).strip() - alg = getText(volume.getElementsByTagName('algorithm')[0].childNodes).strip() - print "%-10s %-40s %-10s"%(id, poolname, alg) - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing listpools cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing listpools failed, due to: %s" % (err.reason) - sys.exit(1) - -def modifypool(options): - validate_parameter(options, modifyPoolParser) - - try: - output = cloudtool.main(['cloud-tool', 'modifyPool', '--poolname=' + options.pool_name, - '--algorithm=' + options.algorithm, "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully modified pool" - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing modifypool cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing modifypool failed, due to: %s" % (err.reason) - sys.exit(1) - -def destroypool(options): - validate_parameter(options, destroyPoolParser) - - try: - output = cloudtool.main(['cloud-tool', 'deletePool', '--poolname=' + options.pool_name, - "--server=" + CloudStackSvrIP + ":" + str(CloudStackSvrPort), "--stripxml=false"]) - print "Successfully destroyed pool: " + options.pool_name - except urllib2.HTTPError, err: - code = err.code - msg = err.read() - print "executing destroypool cmd failed, http returning error code: %s" % (code) - httpErrorHandler(code, msg) - sys.exit(1) - except urllib2.URLError, err: - print "executing destroypool failed, due to: %s" % (err.reason) - sys.exit(1) - -def loadCfgFile(): - options = dict() - try: - cfgFile = open(os.environ['HOME'] + "/.cloudvoladmrc") - for line in cfgFile: - option = line.split("=") - if option[0] == "cloudStackMgtSvrIP": - options["cloudStackMgtSvrIP"] = option[1].strip("\n") - - except: - return None - - return options - -def getGuestIQN(): - try: - initialFile = open("/etc/iscsi/initiatorname.iscsi") - for line in initialFile: - iqn = line.split("=") - if iqn[0] == "InitiatorName": - return iqn[1].strip("\n") - except: - return None - return None - -if __name__ == '__main__': - parser = Help() - (options, args) = parser.parse_args() - - globalCfg = loadCfgFile() - - NetAppServerIP= options.server_ip - - NetAppUserName = options.username - - NetAppPassword = options.password - - CloudStackSvrIP = options.cloudstackSvr - if CloudStackSvrIP == None: - if globalCfg != None and "cloudStackMgtSvrIP" in globalCfg: - CloudStackSvrIP = globalCfg["cloudStackMgtSvrIP"] - if CloudStackSvrIP == None: - CloudStackSvrIP = "127.0.0.1" - - if options.guest_iqn == None: - GuestIQN = getGuestIQN() - options.__dict__["guest_iqn"] = GuestIQN - - if len(args) == 0: - sys.exit(1) - cmd = args[0] - if cmd == "createvol": - createvol(options) - elif cmd == "deletevol": - deletevol(options) - elif cmd == "listvol": - listvol(options) - elif cmd == "createlun": - createlun(options) - elif cmd == "listlun": - listlun(options) - elif cmd == "destroylun": - destroylun(options) - elif cmd == "assoclun": - assoclun(options) - elif cmd == "disassoclun": - disassoclun(options) - elif cmd == "createpool": - createpool(options) - elif cmd == "modifypool": - modifypool(options) - elif cmd == "destroypool": - destroypool(options) - elif cmd == "listpools": - listpools(options) - else: - print "Unrecoginzied command" - cmd_help() - sys.exit(1) diff --git a/deps/install-non-oss.sh b/deps/install-non-oss.sh index ee7482d17ee..632e718c670 100755 --- a/deps/install-non-oss.sh +++ b/deps/install-non-oss.sh @@ -24,11 +24,6 @@ mvn install:install-file -Dfile=cloud-iControl.jar -DgroupId=com.cloud.com. # Version: unknown mvn install:install-file -Dfile=cloud-netscaler-sdx.jar -DgroupId=com.cloud.com.citrix -DartifactId=netscaler-sdx -Dversion=1.0 -Dpackaging=jar -# From http://support.netapp.com/ (not available online, contact your support representative) -# Version: 4.0 -if [ -e cloud-manageontap.jar ]; then mv cloud-manageontap.jar manageontap.jar; fi -mvn install:install-file -Dfile=manageontap.jar -DgroupId=com.cloud.com.netapp -DartifactId=manageontap -Dversion=4.0 -Dpackaging=jar - # From https://my.vmware.com/group/vmware/get-download?downloadGroup=VSP510-WEBSDK-510 # Version: 5.1, Release-date: 2012-09-10, Build: 774886 mvn install:install-file -Dfile=vim25_51.jar -DgroupId=com.cloud.com.vmware -DartifactId=vmware-vim25 -Dversion=5.1 -Dpackaging=jar diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2213to2214.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2213to2214.java index f155d6fe91d..9dc3f5be2d8 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2213to2214.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade2213to2214.java @@ -91,16 +91,6 @@ public class Upgrade2213to2214 implements DbUpgrade { throw new CloudRuntimeException("Unable to execute cloud_usage usage_event table update", e); } - //Drop netapp_volume primary key and add it again - DbUpgradeUtils.dropPrimaryKeyIfExists(conn, "cloud.netapp_volume"); - try { - PreparedStatement pstmt = conn.prepareStatement("ALTER TABLE `cloud`.`netapp_volume` add PRIMARY KEY (`id`)"); - pstmt.executeUpdate(); - pstmt.close(); - } catch (SQLException e) { - throw new CloudRuntimeException("Unable to update primary key for netapp_volume", e); - } - //Drop i_snapshots__removed key (if exists) and re-add it again keys = new ArrayList(); keys.add("i_snapshots__removed"); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-227to228-premium.sql b/engine/schema/src/main/resources/META-INF/db/schema-227to228-premium.sql index 8c3af0cc2ba..26d555e59a8 100755 --- a/engine/schema/src/main/resources/META-INF/db/schema-227to228-premium.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-227to228-premium.sql @@ -18,45 +18,6 @@ --; -- Schema upgrade from 2.2.7 to 2.2.8; --; -CREATE TABLE IF NOT EXISTS `cloud`.`netapp_pool` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `name` varchar(255) NOT NULL UNIQUE COMMENT 'name for the pool', - `algorithm` varchar(255) NOT NULL COMMENT 'algorithm', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE IF NOT EXISTS `cloud`.`netapp_volume` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `ip_address` varchar(255) NOT NULL COMMENT 'ip address/fqdn of the volume', - `pool_id` bigint unsigned NOT NULL COMMENT 'id for the pool', - `pool_name` varchar(255) NOT NULL COMMENT 'name for the pool', - `aggregate_name` varchar(255) NOT NULL COMMENT 'name for the aggregate', - `volume_name` varchar(255) NOT NULL COMMENT 'name for the volume', - `volume_size` varchar(255) NOT NULL COMMENT 'volume size', - `snapshot_policy` varchar(255) NOT NULL COMMENT 'snapshot policy', - `snapshot_reservation` int NOT NULL COMMENT 'snapshot reservation', - `username` varchar(255) NOT NULL COMMENT 'username', - `password` varchar(200) COMMENT 'password', - `round_robin_marker` int COMMENT 'This marks the volume to be picked up for lun creation, RR fashion', - PRIMARY KEY (`ip_address`,`aggregate_name`,`volume_name`), - CONSTRAINT `fk_netapp_volume__pool_id` FOREIGN KEY `fk_netapp_volume__pool_id` (`pool_id`) REFERENCES `netapp_pool` (`id`) ON DELETE CASCADE, - INDEX `i_netapp_volume__pool_id`(`pool_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -CREATE TABLE IF NOT EXISTS `cloud`.`netapp_lun` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `lun_name` varchar(255) NOT NULL COMMENT 'lun name', - `target_iqn` varchar(255) NOT NULL COMMENT 'target iqn', - `path` varchar(255) NOT NULL COMMENT 'lun path', - `size` bigint NOT NULL COMMENT 'lun size', - `volume_id` bigint unsigned NOT NULL COMMENT 'parent volume id', - PRIMARY KEY (`id`), - CONSTRAINT `fk_netapp_lun__volume_id` FOREIGN KEY `fk_netapp_lun__volume_id` (`volume_id`) REFERENCES `netapp_volume` (`id`) ON DELETE CASCADE, - INDEX `i_netapp_lun__volume_id`(`volume_id`), - INDEX `i_netapp_lun__lun_name`(`lun_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; --; -- Cleanup usage records for bug # 10727; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql index adf566e07fe..0b426dc680f 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-481to490-cleanup.sql @@ -47,9 +47,6 @@ ALTER TABLE `cloud`.`iam_policy` DROP INDEX `id` ; ALTER TABLE `cloud`.`iam_policy_permission` DROP INDEX `id` ; ALTER TABLE `cloud`.`image_store_details` DROP INDEX `id` ; ALTER TABLE `cloud`.`instance_group` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_lun` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_pool` DROP INDEX `id` ; -ALTER TABLE `cloud`.`netapp_volume` DROP INDEX `id` ; ALTER TABLE `cloud`.`network_acl_item_cidrs` DROP INDEX `id` ; ALTER TABLE `cloud`.`network_offerings` DROP INDEX `id` ; ALTER TABLE `cloud`.`nic_secondary_ips` DROP INDEX `id` ; diff --git a/plugins/file-systems/netapp/pom.xml b/plugins/file-systems/netapp/pom.xml deleted file mode 100644 index 5103ceb145c..00000000000 --- a/plugins/file-systems/netapp/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - cloud-plugin-netapp - Apache CloudStack Plugin - NetApp File System - - org.apache.cloudstack - cloudstack-plugins - 4.12.0.0-SNAPSHOT - ../../pom.xml - - - - com.cloud.com.netapp - manageontap - 4.0 - - - diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/AssociateLunCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/AssociateLunCmd.java deleted file mode 100644 index dadfe44eb9d..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/AssociateLunCmd.java +++ /dev/null @@ -1,102 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.netapp.NetappManager; -import com.cloud.server.api.response.netapp.AssociateLunCmdResponse; - -@APICommand(name = "associateLun", description = "Associate a LUN with a guest IQN", responseObject = AssociateLunCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - } - - @Inject - NetappManager netappMgr; - - @Override - public void execute() { - - 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(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); - } - } - - @Override - public long getEntityOwnerId() { - // TODO Auto-generated method stub - return 0; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateLunCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateLunCmd.java deleted file mode 100644 index 67004792f63..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateLunCmd.java +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.CreateLunCmdResponse; - -@APICommand(name = "createLunOnFiler", description = "Create a LUN from a pool", responseObject = CreateLunCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - } - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - - 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(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java deleted file mode 100644 index b1e6a299fed..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java +++ /dev/null @@ -1,147 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.net.UnknownHostException; -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.CreateVolumeOnFilerCmdResponse; - -@APICommand(name = "createVolumeOnFiler", description = "Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class, - requestHasSensitiveInfo = true, responseHasSensitiveInfo = false) -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; - } - - @Inject - NetappManager netappMgr; - - @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"); - - 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(ApiErrorCode.INTERNAL_ERROR, e.toString()); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (UnknownHostException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java deleted file mode 100644 index d2eeb875a74..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java +++ /dev/null @@ -1,87 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.CreateVolumePoolCmdResponse; - -@APICommand(name = "createPool", description = "Create a pool", responseObject = CreateVolumePoolCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - } - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - - try { - CreateVolumePoolCmdResponse response = new CreateVolumePoolCmdResponse(); - netappMgr.createPool(getPoolName(), getAlgorithm()); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java deleted file mode 100644 index 6f51cc6e2a7..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java +++ /dev/null @@ -1,78 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.DeleteVolumePoolCmdResponse; - -@APICommand(name = "deletePool", description = "Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - netappMgr.deletePool(poolName); - DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse(); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (ResourceInUseException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyLunCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyLunCmd.java deleted file mode 100644 index cfdc1dacd88..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyLunCmd.java +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.DeleteLUNCmdResponse; - -@APICommand(name = "destroyLunOnFiler", description = "Destroy a LUN", responseObject = DeleteLUNCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - netappMgr.destroyLunOnFiler(path); - DeleteLUNCmdResponse response = new DeleteLUNCmdResponse(); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (ServerException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java deleted file mode 100644 index 500a84c50db..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.DeleteVolumeOnFilerCmdResponse; - -@APICommand(name = "destroyVolumeOnFiler", description = "Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName); - DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse(); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (ResourceInUseException e) { - throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString()); - } catch (ServerException e) { - throw new ServerApiException(ApiErrorCode.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 diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DissociateLunCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DissociateLunCmd.java deleted file mode 100644 index d5c53a18739..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/DissociateLunCmd.java +++ /dev/null @@ -1,82 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.rmi.ServerException; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; - -import 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.api.response.netapp.DissociateLunCmdResponse; - -@APICommand(name = "dissociateLun", description = "Dissociate a LUN", responseObject = DissociateLunCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - netappMgr.disassociateLun(guestIQN, path); - DissociateLunCmdResponse response = new DissociateLunCmdResponse(); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } catch (InvalidParameterValueException e) { - throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); - } catch (ServerException e) { - throw new ServerApiException(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListLunsCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListLunsCmd.java deleted file mode 100644 index c1e1fb87b76..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListLunsCmd.java +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.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.api.response.netapp.ListLunsCmdResponse; - -@APICommand(name = "listLunsOnFiler", description = "List LUN", responseObject = ListLunsCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - List lunList = netappMgr.listLunsOnFiler(poolName); - ListResponse listResponse = new ListResponse(); - List responses = new ArrayList(); - 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(ApiErrorCode.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; - } -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java deleted file mode 100644 index f6d17c06e60..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java +++ /dev/null @@ -1,86 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.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.api.response.netapp.ListVolumePoolsCmdResponse; - -@APICommand(name = "listPools", description = "List Pool", responseObject = ListVolumePoolsCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListVolumePoolsCmd extends BaseCmd { - public static final Logger s_logger = Logger.getLogger(ListVolumePoolsCmd.class.getName()); - private static final String s_name = "listpoolresponse"; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - List poolList = netappMgr.listPools(); - ListResponse listResponse = new ListResponse(); - List responses = new ArrayList(); - 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(ApiErrorCode.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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java deleted file mode 100644 index bf72b3afbec..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java +++ /dev/null @@ -1,96 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.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.api.response.netapp.ListVolumesOnFilerCmdResponse; - -@APICommand(name = "listVolumesOnFiler", description = "List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - try { - List volumes = netappMgr.listVolumesOnFiler(poolName); - ListResponse listResponse = new ListResponse(); - List responses = new ArrayList(); - 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(ApiErrorCode.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 diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java b/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java deleted file mode 100644 index a5849df3492..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.api.commands.netapp; - -import javax.inject.Inject; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.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.api.response.netapp.ModifyVolumePoolCmdResponse; - -@APICommand(name = "modifyPool", description = "Modify pool", responseObject = ModifyVolumePoolCmdResponse.class, - requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -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; - - @Inject - NetappManager netappMgr; - - @Override - public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { - 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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/LunVO.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/LunVO.java deleted file mode 100644 index 8c9a802f6c1..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/LunVO.java +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.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; - -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "netapp_lun") -public class LunVO implements InternalIdentity { - - @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; - } - - @Override - 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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappAllocator.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappAllocator.java deleted file mode 100644 index 316f0085add..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappAllocator.java +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp; - -public interface NetappAllocator { - - public NetappVolumeVO chooseVolumeFromPool(String poolName, long lunSizeGb); - - public NetappVolumeVO chooseLeastFullVolumeFromPool(String poolName, long lunSizeGb); -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappDefaultAllocatorImpl.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappDefaultAllocatorImpl.java deleted file mode 100644 index 01418252ebf..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappDefaultAllocatorImpl.java +++ /dev/null @@ -1,124 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp; - -import java.rmi.ServerException; -import java.util.HashMap; -import java.util.List; - -import org.apache.log4j.Logger; - -public class NetappDefaultAllocatorImpl implements NetappAllocator { - private static HashMap s_poolNameToLastVolumeIdAllocated = new HashMap(); - private final NetappManager _netappMgr; - public static final Logger s_logger = Logger.getLogger(NetappDefaultAllocatorImpl.class.getName()); - - public NetappDefaultAllocatorImpl(NetappManager netappMgr) { - _netappMgr = netappMgr; - } - - @Override - public synchronized NetappVolumeVO chooseLeastFullVolumeFromPool(String poolName, long lunSizeGb) { - List 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 - */ - @Override - public synchronized NetappVolumeVO chooseVolumeFromPool(String poolName, long lunSizeGb) { - int pos = 0; //0 by default - List volumesOnPoolAscending = _netappMgr.listVolumesAscending(poolName); - - if (volumesOnPoolAscending == null) { - //no pools exist in db - return null; - } - - //get the index of the record from the map - if (s_poolNameToLastVolumeIdAllocated.get(poolName) == null) { - pos = 0; - } else { - pos = s_poolNameToLastVolumeIdAllocated.get(poolName); - } - - //update for RR effect - s_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; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManager.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManager.java deleted file mode 100644 index 97c7dd530bd..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManager.java +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.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; -import com.cloud.utils.component.PluggableService; - -public interface NetappManager extends Manager, PluggableService { - 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 listLunsOnFiler(String poolName); - - void destroyLunOnFiler(String path) throws ServerException, InvalidParameterValueException; - - List listVolumesOnFiler(String poolName); - - List 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 listPools(); - - public String[] createLunOnFiler(String poolName, Long lunSize) throws InvalidParameterValueException, ServerException, ResourceAllocationException; - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManagerImpl.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManagerImpl.java deleted file mode 100644 index c226ffeb260..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappManagerImpl.java +++ /dev/null @@ -1,1013 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp; - -import java.io.IOException; -import java.net.UnknownHostException; -import java.rmi.ServerException; -import java.util.ArrayList; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; - -import javax.inject.Inject; -import javax.naming.ConfigurationException; - -import netapp.manage.NaAPIFailedException; -import netapp.manage.NaElement; -import netapp.manage.NaException; -import netapp.manage.NaServer; - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.api.commands.netapp.AssociateLunCmd; -import com.cloud.api.commands.netapp.CreateLunCmd; -import com.cloud.api.commands.netapp.CreateVolumeOnFilerCmd; -import com.cloud.api.commands.netapp.CreateVolumePoolCmd; -import com.cloud.api.commands.netapp.DeleteVolumePoolCmd; -import com.cloud.api.commands.netapp.DestroyLunCmd; -import com.cloud.api.commands.netapp.DestroyVolumeOnFilerCmd; -import com.cloud.api.commands.netapp.DissociateLunCmd; -import com.cloud.api.commands.netapp.ListLunsCmd; -import com.cloud.api.commands.netapp.ListVolumePoolsCmd; -import com.cloud.api.commands.netapp.ListVolumesOnFilerCmd; -import com.cloud.api.commands.netapp.ModifyVolumePoolCmd; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.ResourceAllocationException; -import com.cloud.exception.ResourceInUseException; -import com.cloud.netapp.dao.LunDao; -import com.cloud.netapp.dao.PoolDao; -import com.cloud.netapp.dao.VolumeDao; -import com.cloud.utils.component.ManagerBase; -import com.cloud.utils.db.DB; -import com.cloud.utils.db.TransactionLegacy; -import com.cloud.utils.exception.CloudRuntimeException; - -@Component -public class NetappManagerImpl extends ManagerBase implements NetappManager { - public enum Algorithm { - roundrobin, leastfull - } - - public static final Logger s_logger = Logger.getLogger(NetappManagerImpl.class.getName()); - @Inject - public VolumeDao _volumeDao; - @Inject - public PoolDao _poolDao; - @Inject - public LunDao _lunDao; - private NetappAllocator _netappAllocator = null; - - /** - * Default constructor - */ - public NetappManagerImpl() { - } - - @Override - public void createPool(String poolName, String algorithm) throws InvalidParameterValueException { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createPool "); - - PoolVO pool = null; - validAlgorithm(algorithm); - try { - pool = new PoolVO(poolName, algorithm); - _poolDao.persist(pool); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Response --> createPool:success"); - - } catch (CloudRuntimeException cre) { - pool = _poolDao.findPool(poolName); - if (pool != null) { - throw new InvalidParameterValueException("Duplicate Pool Name"); - } else { - throw cre; - } - } - } - - /** - * This method validates the algorithm used for allocation of the volume - * @param algorithm -- algorithm type - * @throws InvalidParameterValueException - */ - private void validAlgorithm(String algorithm) throws InvalidParameterValueException { - //TODO: use enum - if (!algorithm.equalsIgnoreCase("roundrobin") && !algorithm.equalsIgnoreCase("leastfull")) { - throw new InvalidParameterValueException("Unknown algorithm " + algorithm); - } - } - - /** - * Utility method to get the netapp server object - * @param serverIp -- ip address of netapp box - * @param userName -- username - * @param password -- password - * @return - * @throws UnknownHostException - */ - private NaServer getServer(String serverIp, String userName, String password) throws UnknownHostException { - //Initialize connection to server, and - //request version 1.3 of the API set - NaServer s = new NaServer(serverIp, 1, 3); - s.setStyle(NaServer.STYLE_LOGIN_PASSWORD); - s.setAdminUser(userName, password); - - return s; - } - - @Override - public List> getCommands() { - List> cmdList = new ArrayList>(); - cmdList.add(CreateLunCmd.class); - cmdList.add(ListLunsCmd.class); - cmdList.add(DissociateLunCmd.class); - cmdList.add(CreateVolumeOnFilerCmd.class); - cmdList.add(ModifyVolumePoolCmd.class); - cmdList.add(ListVolumesOnFilerCmd.class); - cmdList.add(ListVolumePoolsCmd.class); - cmdList.add(DestroyLunCmd.class); - cmdList.add(CreateVolumePoolCmd.class); - cmdList.add(DeleteVolumePoolCmd.class); - cmdList.add(AssociateLunCmd.class); - cmdList.add(DestroyVolumeOnFilerCmd.class); - return cmdList; - } - - @Override - public void modifyPool(String poolName, String algorithm) throws InvalidParameterValueException { - validAlgorithm(algorithm); - PoolVO pool = _poolDao.findPool(poolName); - - if (pool == null) { - throw new InvalidParameterValueException("Cannot find pool " + poolName); - } - - validAlgorithm(algorithm); - - pool.setAlgorithm(algorithm); - pool.setName(poolName); - - _poolDao.update(pool.getId(), pool); - } - - @Override - public void deletePool(String poolName) throws InvalidParameterValueException, ResourceInUseException { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> deletePool "); - - PoolVO pool = _poolDao.findPool(poolName); - if (pool == null) { - throw new InvalidParameterValueException("Cannot find pool " + poolName); - } - //check if pool is empty - int volCount = _volumeDao.listVolumes(poolName).size(); - - if (volCount == 0) { - _poolDao.remove(pool.getId()); - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> deletePool: Success "); - - } else { - throw new ResourceInUseException("Cannot delete non-empty pool"); - } - } - - @Override - public List listPools() { - return _poolDao.listAll(); - } - - /** - * This method destroys the volume on netapp filer - * @param ipAddress -- ip address of filer - * @param aggrName -- name of containing aggregate - * @param volName -- name of volume to destroy - * @throws ResourceInUseException - * @throws NaException - * @throws NaAPIFailedException - */ - @Override - @DB - public void destroyVolumeOnFiler(String ipAddress, String aggrName, String volName) throws ServerException, InvalidParameterValueException, ResourceInUseException { - NaElement xi0; - NaElement xi1; - NetappVolumeVO volume = null; - - volume = _volumeDao.findVolume(ipAddress, aggrName, volName); - - if (volume == null) { - s_logger.warn("The volume does not exist in our system"); - throw new InvalidParameterValueException("The given tuple:" + ipAddress + "," + aggrName + "," + volName + " doesn't exist in our system"); - } - - List lunsOnVol = _lunDao.listLunsByVolId(volume.getId()); - - if (lunsOnVol != null && lunsOnVol.size() > 0) { - s_logger.warn("There are luns on the volume"); - throw new ResourceInUseException("There are luns on the volume"); - } - - final TransactionLegacy txn = TransactionLegacy.currentTxn(); - txn.start(); - PoolVO pool = _poolDao.findById(volume.getPoolId()); - if (pool == null) { - throw new InvalidParameterValueException("Failed to find pool for given volume"); - //FIXME: choose a better exception. this is a db integrity exception - } - pool = _poolDao.acquireInLockTable(pool.getId()); - if (pool == null) { - throw new ConcurrentModificationException("Failed to acquire lock on pool " + volume.getPoolId()); - } - NaServer s = null; - try { - s = getServer(volume.getIpAddress(), volume.getUsername(), volume.getPassword()); - //bring the volume down - xi0 = new NaElement("volume-offline"); - xi0.addNewChild("name", volName); - s.invokeElem(xi0); - - //now destroy it - xi1 = new NaElement("volume-destroy"); - xi1.addNewChild("name", volName); - s.invokeElem(xi1); - - //now delete from our records - _volumeDao.remove(volume.getId()); - txn.commit(); - - } catch (UnknownHostException uhe) { - s_logger.warn("Unable to delete volume on filer ", uhe); - throw new ServerException("Unable to delete volume on filer", uhe); - } catch (NaAPIFailedException naf) { - s_logger.warn("Unable to delete volume on filer ", naf); - if (naf.getErrno() == 13040) { - s_logger.info("Deleting the volume: " + volName); - _volumeDao.remove(volume.getId()); - txn.commit(); - } - - throw new ServerException("Unable to delete volume on filer", naf); - } catch (NaException nae) { - txn.rollback(); - s_logger.warn("Unable to delete volume on filer ", nae); - throw new ServerException("Unable to delete volume on filer", nae); - } catch (IOException ioe) { - txn.rollback(); - s_logger.warn("Unable to delete volume on filer ", ioe); - throw new ServerException("Unable to delete volume on filer", ioe); - } finally { - if (pool != null) { - _poolDao.releaseFromLockTable(pool.getId()); - } - if (s != null) - s.close(); - } - - } - - /** - * This method creates a volume on netapp filer - * @param ipAddress -- ip address of the filer - * @param aggName -- name of aggregate - * @param poolName -- name of pool - * @param volName -- name of volume - * @param volSize -- size of volume to be created - * @param snapshotPolicy -- associated snapshot policy for volume - * @param snapshotReservation -- associated reservation for snapshots - * @param username -- username - * @param password -- password - * @throws UnknownHostException - * @throws InvalidParameterValueException - */ - @Override - @DB - public void createVolumeOnFiler(String ipAddress, String aggName, String poolName, String volName, String volSize, String snapshotPolicy, - Integer snapshotReservation, String username, String password) throws UnknownHostException, ServerException, InvalidParameterValueException { - - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createVolume " + "serverIp:" + ipAddress); - - boolean snapPolicy = false; - boolean snapshotRes = false; - boolean volumeCreated = false; - - NaServer s = getServer(ipAddress, username, password); - - NaElement xi = new NaElement("volume-create"); - xi.addNewChild("volume", volName); - xi.addNewChild("containing-aggr-name", aggName); - xi.addNewChild("size", volSize); - - NaElement xi1 = new NaElement("snapshot-set-reserve"); - if (snapshotReservation != null) { - snapshotRes = true; - xi1.addNewChild("percentage", snapshotReservation.toString()); - xi1.addNewChild("volume", volName); - } - - NaElement xi2 = new NaElement("snapshot-set-schedule"); - - if (snapshotPolicy != null) { - snapPolicy = true; - - String weeks = null; - String days = null; - String hours = null; - String whichHours = null; - String minutes = null; - String whichMinutes = null; - - StringTokenizer s1 = new StringTokenizer(snapshotPolicy, " "); - - //count=4: weeks days hours@csi mins@csi - //count=3: weeks days hours@csi - //count=2: weeks days - //count=1: weeks - - if (s1.hasMoreTokens()) { - weeks = s1.nextToken(); - } - if (weeks != null && s1.hasMoreTokens()) { - days = s1.nextToken(); - } - if (days != null && s1.hasMoreTokens()) { - String[] hoursArr = s1.nextToken().split("@"); - hours = hoursArr[0]; - whichHours = hoursArr[1]; - } - if (hours != null && s1.hasMoreTokens()) { - String[] minsArr = s1.nextToken().split("@"); - minutes = minsArr[0]; - whichMinutes = minsArr[1]; - } - - if (weeks != null) - xi2.addNewChild("weeks", weeks); - if (days != null) - xi2.addNewChild("days", days); - if (hours != null) - xi2.addNewChild("hours", hours); - if (minutes != null) - xi2.addNewChild("minutes", minutes); - xi2.addNewChild("volume", volName); - - if (whichHours != null) - xi2.addNewChild("which-hours", whichHours); - if (whichMinutes != null) - xi2.addNewChild("which-minutes", whichMinutes); - } - Long volumeId = null; - - final TransactionLegacy txn = TransactionLegacy.currentTxn(); - txn.start(); - NetappVolumeVO volume = null; - volume = _volumeDao.findVolume(ipAddress, aggName, volName); - - if (volume != null) { - throw new InvalidParameterValueException("The volume for the given ipAddress/aggregateName/volumeName tuple already exists"); - } - PoolVO pool = _poolDao.findPool(poolName); - if (pool == null) { - throw new InvalidParameterValueException("Cannot find pool " + poolName); - } - pool = _poolDao.acquireInLockTable(pool.getId()); - if (pool == null) { - s_logger.warn("Failed to acquire lock on pool " + poolName); - throw new ConcurrentModificationException("Failed to acquire lock on pool " + poolName); - } - volume = new NetappVolumeVO(ipAddress, aggName, pool.getId(), volName, volSize, "", 0, username, password, 0, pool.getName()); - volume = _volumeDao.persist(volume); - - volumeId = volume.getId(); - try { - s.invokeElem(xi); - volumeCreated = true; - - if (snapshotRes) { - s.invokeElem(xi1); - volume.setSnapshotReservation(snapshotReservation); - _volumeDao.update(volumeId, volume); - } - - if (snapPolicy) { - s.invokeElem(xi2); - volume.setSnapshotPolicy(snapshotPolicy); - _volumeDao.update(volumeId, volume); - } - txn.commit(); - } catch (NaException nae) { - //zapi call failed, log and throw e - s_logger.warn("Failed to create volume on the netapp filer:", nae); - txn.rollback(); - if (volumeCreated) { - try { - deleteRogueVolume(volName, s);//deletes created volume on filer - } catch (NaException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); - throw new ServerException("Unable to create volume via cloudtools." - + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); - } catch (IOException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); - throw new ServerException("Unable to create volume via cloudtools." - + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); - } - } - throw new ServerException("Unable to create volume", nae); - } catch (IOException ioe) { - s_logger.warn("Failed to create volume on the netapp filer:", ioe); - txn.rollback(); - if (volumeCreated) { - try { - deleteRogueVolume(volName, s);//deletes created volume on filer - } catch (NaException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); - throw new ServerException("Unable to create volume via cloudtools." - + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); - } catch (IOException e) { - s_logger.warn("Failed to cleanup created volume whilst rolling back on the netapp filer:", e); - throw new ServerException("Unable to create volume via cloudtools." - + "Failed to cleanup created volume on netapp filer whilst rolling back on the cloud db:", e); - } - } - throw new ServerException("Unable to create volume", ioe); - } finally { - if (s != null) - s.close(); - if (pool != null) - _poolDao.releaseFromLockTable(pool.getId()); - - } - } - - /** - * This method is primarily used to cleanup volume created on the netapp filer, when createVol api command fails at snapshot reservation. - * We roll back the db record, but the record on the netapp box still exists. We clean up that record using this helper method. - * @param volName - * @param s -- server reference - * @throws NaException - * @throws IOException - */ - private void deleteRogueVolume(String volName, NaServer s) throws NaException, IOException { - //bring the volume down - NaElement xi0 = new NaElement("volume-offline"); - xi0.addNewChild("name", volName); - s.invokeElem(xi0); - - //now destroy it - NaElement xi1 = new NaElement("volume-destroy"); - xi1.addNewChild("name", volName); - s.invokeElem(xi1); - } - - /** - * This method lists all the volumes by pool name - * @param poolName - * @return -- volumes in that pool - */ - @Override - public List listVolumesOnFiler(String poolName) { - - List vols = _volumeDao.listVolumesAscending(poolName); - - for (NetappVolumeVO vol : vols) { - try { - String snapScheduleOnFiler = returnSnapshotSchedule(vol); - vol.setSnapshotPolicy(snapScheduleOnFiler); - - } catch (ServerException e) { - s_logger.warn("Error trying to get snapshot schedule for volume" + vol.getVolumeName()); - } - } - return vols; - } - - /** - * Utility method to return snapshot schedule for a volume - * @param vol -- volume for the snapshot schedule creation - * @return -- the snapshot schedule - * @throws ServerException - */ - private String returnSnapshotSchedule(NetappVolumeVO vol) throws ServerException { - - NaElement xi = new NaElement("snapshot-get-schedule"); - xi.addNewChild("volume", vol.getVolumeName()); - NaServer s = null; - try { - s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - NaElement xo = s.invokeElem(xi); - String weeks = xo.getChildContent("weeks"); - String days = xo.getChildContent("days"); - String hours = xo.getChildContent("hours"); - String minutes = xo.getChildContent("minutes"); - String whichHours = xo.getChildContent("which-hours"); - String whichMinutes = xo.getChildContent("which-minutes"); - - StringBuilder sB = new StringBuilder(); - sB.append(weeks) - .append(" ") - .append(days) - .append(" ") - .append(hours) - .append("@") - .append(whichHours) - .append(" ") - .append(minutes) - .append("@") - .append(whichMinutes); - return sB.toString(); - } catch (NaException nae) { - s_logger.warn("Failed to get volume size ", nae); - throw new ServerException("Failed to get volume size", nae); - } catch (IOException ioe) { - s_logger.warn("Failed to get volume size ", ioe); - throw new ServerException("Failed to get volume size", ioe); - } finally { - if (s != null) - s.close(); - } - } - - /** - * This method returns the ascending order list of volumes based on their ids - * @param poolName -- name of pool - * @return -- ascending ordered list of volumes based on ids - */ - @Override - public List listVolumesAscending(String poolName) { - return _volumeDao.listVolumesAscending(poolName); - } - - /** - * This method returns the available size on the volume in terms of bytes - * @param volName -- name of volume - * @param userName -- username - * @param password -- password - * @param serverIp -- ip address of filer - * @throws UnknownHostException - * @return-- available size on the volume in terms of bytes; return -1 if volume is offline - * @throws ServerException - */ - @Override - public long returnAvailableVolumeSize(String volName, String userName, String password, String serverIp) throws ServerException { - long availableSize = 0; - - NaElement xi = new NaElement("volume-list-info"); - xi.addNewChild("volume", volName); - NaServer s = null; - String volumeState = null; - try { - s = getServer(serverIp, userName, password); - NaElement xo = s.invokeElem(xi); - List volList = xo.getChildByName("volumes").getChildren(); - Iterator volIter = volList.iterator(); - while (volIter.hasNext()) { - NaElement volInfo = (NaElement)volIter.next(); - availableSize = volInfo.getChildLongValue("size-available", -1); - volumeState = volInfo.getChildContent("state"); - } - - if (volumeState != null) { - return volumeState.equalsIgnoreCase("online") ? availableSize : -1; //return -1 if volume is offline - } else { - //catch all - //volume state unreported - return -1; // as good as volume offline - } - - } catch (NaException nae) { - s_logger.warn("Failed to get volume size ", nae); - throw new ServerException("Failed to get volume size", nae); - } catch (IOException ioe) { - s_logger.warn("Failed to get volume size ", ioe); - throw new ServerException("Failed to get volume size", ioe); - } finally { - if (s != null) - s.close(); - } - } - - /** - * This method creates a lun on the netapp filer - * @param poolName -- name of the pool - * @param lunSize -- size of the lun to be created - * @return -- lun path - * @throws IOException - * @throws ResourceAllocationException - * @throws NaException - */ - @Override - @DB - public String[] createLunOnFiler(String poolName, Long lunSize) throws ServerException, InvalidParameterValueException, ResourceAllocationException { - String[] result = new String[3]; - StringBuilder lunName = new StringBuilder("lun-"); - LunVO lun = null; - final TransactionLegacy txn = TransactionLegacy.currentTxn(); - txn.start(); - PoolVO pool = _poolDao.findPool(poolName); - - if (pool == null) { - throw new InvalidParameterValueException("Cannot find pool " + poolName); - } - - if (lunSize <= 0) { - throw new InvalidParameterValueException("Please specify a valid lun size in Gb"); - } - - String algorithm = pool.getAlgorithm(); - NetappVolumeVO selectedVol = null; - - //sanity check - int numVolsInPool = _volumeDao.listVolumes(poolName).size(); - - if (numVolsInPool == 0) { - throw new InvalidParameterValueException("No volumes exist in the given pool"); - } - pool = _poolDao.acquireInLockTable(pool.getId()); - if (pool == null) { - s_logger.warn("Failed to acquire lock on the pool " + poolName); - return result; - } - NaServer s = null; - - try { - if (algorithm == null || algorithm.equals(Algorithm.roundrobin.toString())) { - selectedVol = _netappAllocator.chooseVolumeFromPool(poolName, lunSize); - } else if (algorithm.equals(Algorithm.leastfull.toString())) { - - selectedVol = _netappAllocator.chooseLeastFullVolumeFromPool(poolName, lunSize); - } - - if (selectedVol == null) { - throw new ServerException("Could not find a suitable volume to create lun on"); - } - - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> createLun " + "serverIp:" + selectedVol.getIpAddress()); - - StringBuilder exportPath = new StringBuilder("/vol/"); - exportPath.append(selectedVol.getVolumeName()); - exportPath.append("/"); - - lun = new LunVO(exportPath.toString(), selectedVol.getId(), lunSize, "", ""); - lun = _lunDao.persist(lun); - - //Lun id created: 6 digits right justified eg. 000045 - String lunIdStr = String.valueOf(lun.getId()); - String zeroStr = "000000"; - int length = lunIdStr.length(); - int offset = 6 - length; - StringBuilder lunIdOnPath = new StringBuilder(); - lunIdOnPath.append(zeroStr.substring(0, offset)); - lunIdOnPath.append(lunIdStr); - exportPath.append("lun-").append(lunIdOnPath.toString()); - - lunName.append(lunIdOnPath.toString()); - - //update lun name - lun.setLunName(lunName.toString()); - _lunDao.update(lun.getId(), lun); - - NaElement xi; - NaElement xi1; - - long lSizeBytes = 1L * lunSize * 1024 * 1024 * 1024; //This prevents integer overflow - Long lunSizeBytes = new Long(lSizeBytes); - - s = getServer(selectedVol.getIpAddress(), selectedVol.getUsername(), selectedVol.getPassword()); - - //create lun - xi = new NaElement("lun-create-by-size"); - xi.addNewChild("ostype", "linux"); - xi.addNewChild("path", exportPath.toString()); - xi.addNewChild("size", (lunSizeBytes.toString())); - - s.invokeElem(xi); - - try { - //now create an igroup - xi1 = new NaElement("igroup-create"); - xi1.addNewChild("initiator-group-name", lunName.toString()); - xi1.addNewChild("initiator-group-type", "iscsi"); - xi1.addNewChild("os-type", "linux"); - s.invokeElem(xi1); - } catch (NaAPIFailedException e) { - if (e.getErrno() == 9004) { - //igroup already exists hence no error - s_logger.warn("Igroup already exists"); - } - } - - //get target iqn - NaElement xi4 = new NaElement("iscsi-node-get-name"); - NaElement xo = s.invokeElem(xi4); - String iqn = xo.getChildContent("node-name"); - - lun.setTargetIqn(iqn); - _lunDao.update(lun.getId(), lun); - - //create lun mapping - //now map the lun to the igroup - NaElement xi3 = new NaElement("lun-map"); - xi3.addNewChild("force", "true"); - xi3.addNewChild("initiator-group", lunName.toString()); - xi3.addNewChild("path", lun.getPath() + lun.getLunName()); - - xi3.addNewChild("lun-id", lunIdStr); - s.invokeElem(xi3); - - txn.commit(); - //set the result - result[0] = lunName.toString();//lunname - result[1] = iqn;//iqn - result[2] = selectedVol.getIpAddress(); - - return result; - - } catch (NaAPIFailedException naf) { - if (naf.getErrno() == 9023) { //lun is already mapped to this group - result[0] = lunName.toString();//lunname; - result[1] = lun.getTargetIqn();//iqn - result[2] = selectedVol.getIpAddress(); - return result; - } - if (naf.getErrno() == 9024) { //another lun mapped at this group - result[0] = lunName.toString();//lunname; - result[1] = lun.getTargetIqn();//iqn - result[2] = selectedVol.getIpAddress(); - return result; - } - } catch (NaException nae) { - txn.rollback(); - throw new ServerException("Unable to create LUN", nae); - } catch (IOException ioe) { - txn.rollback(); - throw new ServerException("Unable to create LUN", ioe); - } finally { - if (pool != null) { - _poolDao.releaseFromLockTable(pool.getId()); - } - if (s != null) { - s.close(); - } - } - - return result; - } - - /** - * This method destroys a lun on the netapp filer - * @param lunName -- name of the lun to be destroyed - */ - @Override - @DB - public void destroyLunOnFiler(String lunName) throws InvalidParameterValueException, ServerException { - - final TransactionLegacy txn = TransactionLegacy.currentTxn(); - txn.start(); - - LunVO lun = _lunDao.findByName(lunName); - - if (lun == null) - throw new InvalidParameterValueException("Cannot find lun"); - - NetappVolumeVO vol = _volumeDao.acquireInLockTable(lun.getVolumeId()); - if (vol == null) { - s_logger.warn("Failed to lock volume id= " + lun.getVolumeId()); - return; - } - NaServer s = null; - try { - s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> destroyLun " + ":serverIp:" + vol.getIpAddress()); - - try { - //Unmap lun - NaElement xi2 = new NaElement("lun-unmap"); - xi2.addNewChild("initiator-group", lunName); - xi2.addNewChild("path", lun.getPath() + lun.getLunName()); - s.invokeElem(xi2); - } catch (NaAPIFailedException naf) { - if (naf.getErrno() == 9016) - s_logger.warn("no map exists excpn 9016 caught in deletelun, continuing with delete"); - } - - //destroy lun - NaElement xi = new NaElement("lun-destroy"); - xi.addNewChild("force", "true"); - xi.addNewChild("path", lun.getPath() + lun.getLunName()); - s.invokeElem(xi); - - //destroy igroup - NaElement xi1 = new NaElement("igroup-destroy"); - //xi1.addNewChild("force","true"); - xi1.addNewChild("initiator-group-name", lunName); - s.invokeElem(xi1); - - _lunDao.remove(lun.getId()); - txn.commit(); - } catch (UnknownHostException uhe) { - txn.rollback(); - s_logger.warn("Failed to delete lun", uhe); - throw new ServerException("Failed to delete lun", uhe); - } catch (IOException ioe) { - txn.rollback(); - s_logger.warn("Failed to delete lun", ioe); - throw new ServerException("Failed to delete lun", ioe); - } catch (NaAPIFailedException naf) { - if (naf.getErrno() == 9017) {//no such group exists excpn - s_logger.warn("no such group exists excpn 9017 caught in deletelun, continuing with delete"); - _lunDao.remove(lun.getId()); - txn.commit(); - } else if (naf.getErrno() == 9029) {//LUN maps for this initiator group exist - s_logger.warn("LUN maps for this initiator group exist errno 9029 caught in deletelun, continuing with delete"); - _lunDao.remove(lun.getId()); - txn.commit(); - } else { - txn.rollback(); - s_logger.warn("Failed to delete lun", naf); - throw new ServerException("Failed to delete lun", naf); - } - - } catch (NaException nae) { - txn.rollback(); - s_logger.warn("Failed to delete lun", nae); - throw new ServerException("Failed to delete lun", nae); - } finally { - if (vol != null) { - _volumeDao.releaseFromLockTable(vol.getId()); - } - if (s != null) - s.close(); - } - - } - - /** - * This method lists the luns on the netapp filer - * @param volId -- id of the containing volume - * @return -- list of netapp luns - * @throws NaException - * @throws IOException - */ - @Override - public List listLunsOnFiler(String poolName) { - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> listLunsOnFiler "); - - List luns = new ArrayList(); - - List vols = _volumeDao.listVolumes(poolName); - - for (NetappVolumeVO vol : vols) { - luns.addAll(_lunDao.listLunsByVolId(vol.getId())); - } - - if (s_logger.isDebugEnabled()) - s_logger.debug("Response --> listLunsOnFiler:success"); - - return luns; - } - - /** - * This method disassociates a lun from the igroup on the filer - * @param iGroup -- igroup name - * @param lunName -- lun name - */ - @Override - public void disassociateLun(String iGroup, String lunName) throws ServerException, InvalidParameterValueException { - NaElement xi; - LunVO lun = _lunDao.findByName(lunName); - - if (lun == null) - throw new InvalidParameterValueException("Cannot find LUN " + lunName); - - NetappVolumeVO vol = _volumeDao.findById(lun.getVolumeId()); - NaServer s = null; - try { - s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> disassociateLun " + ":serverIp:" + vol.getIpAddress()); - - xi = new NaElement("igroup-remove"); - xi.addNewChild("force", "true"); - xi.addNewChild("initiator", iGroup); - xi.addNewChild("initiator-group-name", lunName); - s.invokeElem(xi); - - } catch (UnknownHostException uhe) { - throw new ServerException("Failed to disassociate lun", uhe); - } catch (IOException ioe) { - throw new ServerException("Failed to disassociate lun", ioe); - } catch (NaException nae) { - throw new ServerException("Failed to disassociate lun", nae); - } finally { - if (s != null) - s.close(); - } - - } - - /** - * This method associates a lun to a particular igroup - * @param iqn - * @param iGroup - * @param lunName - */ - @Override - public String[] associateLun(String guestIqn, String lunName) throws ServerException, InvalidParameterValueException - - { - NaElement xi2; - - //get lun id from path - String[] splitLunName = lunName.split("-"); - String[] returnVal = new String[3]; - if (splitLunName.length != 2) - throw new InvalidParameterValueException("The lun id is malformed"); - - String lunIdStr = splitLunName[1]; - - Long lId = new Long(lunIdStr); - - LunVO lun = _lunDao.findById(lId); - - if (lun == null) - throw new InvalidParameterValueException("Cannot find LUN " + lunName); - - NetappVolumeVO vol = _volumeDao.findById(lun.getVolumeId()); - - //assert(vol != null); - - returnVal[0] = lunIdStr; - returnVal[1] = lun.getTargetIqn(); - returnVal[2] = vol.getIpAddress(); - - NaServer s = null; - - try { - s = getServer(vol.getIpAddress(), vol.getUsername(), vol.getPassword()); - - if (s_logger.isDebugEnabled()) - s_logger.debug("Request --> associateLun " + ":serverIp:" + vol.getIpAddress()); - - //add iqn to the group - xi2 = new NaElement("igroup-add"); - xi2.addNewChild("force", "true"); - xi2.addNewChild("initiator", guestIqn); - xi2.addNewChild("initiator-group-name", lunName); - s.invokeElem(xi2); - - return returnVal; - } catch (UnknownHostException uhe) { - s_logger.warn("Unable to associate LUN ", uhe); - throw new ServerException("Unable to associate LUN", uhe); - } catch (NaAPIFailedException naf) { - if (naf.getErrno() == 9008) { //initiator group already contains node - return returnVal; - } - s_logger.warn("Unable to associate LUN ", naf); - throw new ServerException("Unable to associate LUN", naf); - } catch (NaException nae) { - s_logger.warn("Unable to associate LUN ", nae); - throw new ServerException("Unable to associate LUN", nae); - } catch (IOException ioe) { - s_logger.warn("Unable to associate LUN ", ioe); - throw new ServerException("Unable to associate LUN", ioe); - } finally { - if (s != null) - s.close(); - } - - } - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - - _netappAllocator = new NetappDefaultAllocatorImpl(this); - - return true; - } -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappVolumeVO.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappVolumeVO.java deleted file mode 100644 index cfaced96c5e..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/NetappVolumeVO.java +++ /dev/null @@ -1,186 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.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; - -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "netapp_volume") -public class NetappVolumeVO implements InternalIdentity { - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private Long id; - - @Column(name = "ip_address") - private String ipAddress; - - @Column(name = "aggregate_name") - private String aggregateName; - - @Column(name = "pool_id") - private Long poolId; - - @Column(name = "pool_name") - private String poolName; - - @Column(name = "volume_name") - private String volumeName; - - @Column(name = "username") - private String username; - - @Column(name = "password") - private String password; - - @Column(name = "snapshot_policy") - private String snapshotPolicy; - - @Column(name = "snapshot_reservation") - private Integer snapshotReservation; - - @Column(name = "volume_size") - private String volumeSize; - - @Column(name = "round_robin_marker") - private int roundRobinMarker; - - public NetappVolumeVO() { - - } - - public NetappVolumeVO(String ipAddress, String aggName, Long poolId, String volName, String volSize, String snapshotPolicy, int snapshotReservation, String username, - String password, int roundRobinMarker, String poolName) { - this.ipAddress = ipAddress; - this.aggregateName = aggName; - this.poolId = poolId; - this.username = username; - this.password = password; - this.volumeName = volName; - this.volumeSize = volSize; - this.snapshotPolicy = snapshotPolicy; - this.snapshotReservation = snapshotReservation; - this.roundRobinMarker = roundRobinMarker; - this.poolName = poolName; - } - - public String getPoolName() { - return poolName; - } - - public void setPoolName(String poolName) { - this.poolName = poolName; - } - - public int getRoundRobinMarker() { - return roundRobinMarker; - } - - public void setRoundRobinMarker(int roundRobinMarker) { - this.roundRobinMarker = roundRobinMarker; - } - - public String getVolumeName() { - return volumeName; - } - - public void setVolumeName(String volumeName) { - this.volumeName = volumeName; - } - - public String getSnapshotPolicy() { - return snapshotPolicy; - } - - public void setSnapshotPolicy(String snapshotPolicy) { - this.snapshotPolicy = snapshotPolicy; - } - - public Integer getSnapshotReservation() { - return snapshotReservation; - } - - public void setSnapshotReservation(Integer snapshotReservation) { - this.snapshotReservation = snapshotReservation; - } - - public String getVolumeSize() { - return volumeSize; - } - - public void setVolumeSize(String volumeSize) { - this.volumeSize = volumeSize; - } - - @Override - public long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public String getAggregateName() { - return aggregateName; - } - - public void setAggregateName(String aggregateName) { - this.aggregateName = aggregateName; - } - - public Long getPoolId() { - return poolId; - } - - public void setPoolId(Long poolId) { - this.poolId = poolId; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/PoolVO.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/PoolVO.java deleted file mode 100644 index a045fecb290..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/PoolVO.java +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.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; - -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name = "netapp_pool") -public class PoolVO implements InternalIdentity { - - @Override - public long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getAlgorithm() { - return algorithm; - } - - public void setAlgorithm(String algorithm) { - this.algorithm = algorithm; - } - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "id") - private Long id; - - @Column(name = "name") - private String name; - - @Column(name = "algorithm") - private String algorithm; - - public PoolVO() { - - } - - public PoolVO(String name, String algorithm) { - this.name = name; - this.algorithm = algorithm; - } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDao.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDao.java deleted file mode 100644 index 2bc95cf83f0..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDao.java +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - -import com.cloud.netapp.LunVO; -import com.cloud.utils.db.GenericDao; - -public interface LunDao extends GenericDao { - - List listLunsByVolId(Long volId); - - LunVO findByName(String name); -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDaoImpl.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDaoImpl.java deleted file mode 100644 index 58f2ea13edd..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/LunDaoImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.netapp.LunVO; -import com.cloud.utils.db.Filter; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -public class LunDaoImpl extends GenericDaoBase implements LunDao { - private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); - - protected final SearchBuilder LunSearch; - protected final SearchBuilder LunNameSearch; - - protected LunDaoImpl() { - - LunSearch = createSearchBuilder(); - LunSearch.and("volumeId", LunSearch.entity().getVolumeId(), SearchCriteria.Op.EQ); - LunSearch.done(); - - LunNameSearch = createSearchBuilder(); - LunNameSearch.and("name", LunNameSearch.entity().getLunName(), SearchCriteria.Op.EQ); - LunNameSearch.done(); - - } - - @Override - public List listLunsByVolId(Long volId) { - Filter searchFilter = new Filter(LunVO.class, "id", Boolean.TRUE, Long.valueOf(0), Long.valueOf(10000)); - - SearchCriteria sc = LunSearch.create(); - sc.setParameters("volumeId", volId); - List lunList = listBy(sc, searchFilter); - - return lunList; - } - - @Override - public LunVO findByName(String name) { - SearchCriteria sc = LunNameSearch.create(); - sc.setParameters("name", name); - return findOneBy(sc); - } -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDao.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDao.java deleted file mode 100644 index 3c0191b1e55..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDao.java +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - -import com.cloud.netapp.PoolVO; -import com.cloud.utils.db.GenericDao; - -public interface PoolDao extends GenericDao { - - PoolVO findPool(String poolName); - - List listPools(); -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDaoImpl.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDaoImpl.java deleted file mode 100644 index 03352d25785..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/PoolDaoImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.netapp.PoolVO; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component -public class PoolDaoImpl extends GenericDaoBase implements PoolDao { - private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); - - protected final SearchBuilder PoolSearch; - - protected PoolDaoImpl() { - - PoolSearch = createSearchBuilder(); - PoolSearch.and("name", PoolSearch.entity().getName(), SearchCriteria.Op.EQ); - PoolSearch.done(); - - } - - @Override - public PoolVO findPool(String poolName) { - SearchCriteria sc = PoolSearch.create(); - sc.setParameters("name", poolName); - List poolList = listBy(sc); - - return (poolList.size() > 0 ? poolList.get(0) : null); - } - - @Override - public List listPools() { - // TODO Auto-generated method stub - return null; - } - -// @Override -// public List listVolumes(String poolName) { -// SearchCriteria sc = NetappListVolumeSearch.create(); -// sc.setParameters("poolName", poolName); -// return listBy(sc); -// } - -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDao.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDao.java deleted file mode 100644 index 59b9190a5e1..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDao.java +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - -import com.cloud.netapp.NetappVolumeVO; -import com.cloud.utils.db.GenericDao; - -public interface VolumeDao extends GenericDao { - - NetappVolumeVO findVolume(String ipAddress, String aggregateName, String volumeName); - - List listVolumes(String poolName); - - NetappVolumeVO returnRoundRobinMarkerInPool(String poolName, int roundRobinMarker); - - List listVolumesAscending(String poolName); -} diff --git a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDaoImpl.java b/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDaoImpl.java deleted file mode 100644 index 70db5bc66a9..00000000000 --- a/plugins/file-systems/netapp/src/main/java/com/cloud/netapp/dao/VolumeDaoImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.netapp.dao; - -import java.util.List; - - -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - -import com.cloud.netapp.NetappVolumeVO; -import com.cloud.utils.db.Filter; -import com.cloud.utils.db.GenericDaoBase; -import com.cloud.utils.db.SearchBuilder; -import com.cloud.utils.db.SearchCriteria; - -@Component(value = "netappVolumeDaoImpl") -public class VolumeDaoImpl extends GenericDaoBase implements VolumeDao { - private static final Logger s_logger = Logger.getLogger(VolumeDaoImpl.class); - - protected final SearchBuilder NetappVolumeSearch; - protected final SearchBuilder NetappListVolumeSearch; - protected final SearchBuilder NetappRoundRobinMarkerSearch; - - @Override - public NetappVolumeVO findVolume(String ipAddress, String aggregateName, String volumeName) { - SearchCriteria sc = NetappVolumeSearch.create(); - sc.setParameters("ipAddress", ipAddress); - sc.setParameters("aggregateName", aggregateName); - sc.setParameters("volumeName", volumeName); - - List volList = listBy(sc); - - return (volList.size() == 0 ? null : volList.get(0)); - } - - protected VolumeDaoImpl() { - NetappVolumeSearch = createSearchBuilder(); - NetappVolumeSearch.and("ipAddress", NetappVolumeSearch.entity().getIpAddress(), SearchCriteria.Op.EQ); - NetappVolumeSearch.and("aggregateName", NetappVolumeSearch.entity().getAggregateName(), SearchCriteria.Op.EQ); - NetappVolumeSearch.and("volumeName", NetappVolumeSearch.entity().getVolumeName(), SearchCriteria.Op.EQ); - NetappVolumeSearch.done(); - - NetappListVolumeSearch = createSearchBuilder(); - NetappListVolumeSearch.and("poolName", NetappListVolumeSearch.entity().getPoolName(), SearchCriteria.Op.EQ); - NetappListVolumeSearch.done(); - - NetappRoundRobinMarkerSearch = createSearchBuilder(); - NetappRoundRobinMarkerSearch.and("roundRobinMarker", NetappRoundRobinMarkerSearch.entity().getRoundRobinMarker(), SearchCriteria.Op.EQ); - NetappRoundRobinMarkerSearch.and("poolName", NetappRoundRobinMarkerSearch.entity().getPoolName(), SearchCriteria.Op.EQ); - NetappRoundRobinMarkerSearch.done(); - } - - @Override - public List listVolumes(String poolName) { - SearchCriteria sc = NetappListVolumeSearch.create(); - sc.setParameters("poolName", poolName); - return listBy(sc); - } - - @Override - public NetappVolumeVO returnRoundRobinMarkerInPool(String poolName, int roundRobinMarker) { - SearchCriteria sc = NetappRoundRobinMarkerSearch.create(); - sc.setParameters("roundRobinMarker", roundRobinMarker); - sc.setParameters("poolName", poolName); - - List marker = listBy(sc); - - if (marker.size() > 0) - return marker.get(0); - else - return null; - } - - @Override - public List listVolumesAscending(String poolName) { - Filter searchFilter = new Filter(NetappVolumeVO.class, "id", Boolean.TRUE, Long.valueOf(0), Long.valueOf(10000)); - - SearchCriteria sc = NetappListVolumeSearch.create(); - sc.setParameters("poolName", poolName); - - return listBy(sc, searchFilter); - } - -} diff --git a/plugins/pom.xml b/plugins/pom.xml index 009577c0e0c..394a71bb85a 100755 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -138,22 +138,11 @@ cloud-api ${project.version} test-jar - test + test - - netapp - - - noredist - - - - file-systems/netapp - - f5 diff --git a/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java b/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java index 9246edd4adc..916c78f650e 100644 --- a/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java +++ b/server/src/main/java/com/cloud/api/doc/ApiXmlDocWriter.java @@ -91,7 +91,7 @@ public class ApiXmlDocWriter { public static void main(String[] args) { Set> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, new String[] {"org.apache.cloudstack.api", "com.cloud.api", "com.cloud.api.commands", "com.globo.globodns.cloudstack.api", "org.apache.cloudstack.network.opendaylight.api", - "com.cloud.api.commands.netapp", "org.apache.cloudstack.api.command.admin.zone", "org.apache.cloudstack.network.contrail.api.command"}); + "org.apache.cloudstack.api.command.admin.zone", "org.apache.cloudstack.network.contrail.api.command"}); for (Class cmdClass : cmdClasses) { if(cmdClass.getAnnotation(APICommand.class)==null){ diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/AssociateLunCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/AssociateLunCmdResponse.java deleted file mode 100644 index 254dc184c69..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/AssociateLunCmdResponse.java +++ /dev/null @@ -1,64 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; - -import com.cloud.serializer.Param; - -public class AssociateLunCmdResponse extends BaseResponse { - - @SerializedName(ApiConstants.ID) - @Param(description = "the LUN id") - private String lun; - - @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "the IP address of ") - private String ipAddress; - - @SerializedName(ApiConstants.TARGET_IQN) - @Param(description = "the target IQN") - private String targetIQN; - - public String getLun() { - return lun; - } - - public String getIpAddress() { - return ipAddress; - } - - public String getTargetIQN() { - return targetIQN; - } - - public void setLun(String lun) { - this.lun = lun; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public void setTargetIQN(String targetIQN) { - this.targetIQN = targetIQN; - } - -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/CreateLunCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/CreateLunCmdResponse.java deleted file mode 100644 index 06be87bd24c..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/CreateLunCmdResponse.java +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; - -import com.cloud.serializer.Param; - -public class CreateLunCmdResponse extends BaseResponse { - - @SerializedName(ApiConstants.PATH) - @Param(description = "pool path") - private String path; - - @SerializedName(ApiConstants.IQN) - @Param(description = "iqn") - private String iqn; - - @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "ip address") - private String ipAddress; - - public String getPath() { - return path; - } - - public String getIqn() { - return iqn; - } - - public String getIpAddress() { - return ipAddress; - } - - public void setPath(String path) { - this.path = path; - } - - public void setIqn(String iqn) { - this.iqn = iqn; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumeOnFilerCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumeOnFilerCmdResponse.java deleted file mode 100644 index f01eb438c35..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumeOnFilerCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class CreateVolumeOnFilerCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumePoolCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumePoolCmdResponse.java deleted file mode 100644 index cf2e5ea8b98..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/CreateVolumePoolCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class CreateVolumePoolCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteLUNCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/DeleteLUNCmdResponse.java deleted file mode 100644 index be9d03c1b60..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteLUNCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class DeleteLUNCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumeOnFilerCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumeOnFilerCmdResponse.java deleted file mode 100644 index 40083ec3a98..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumeOnFilerCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class DeleteVolumeOnFilerCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumePoolCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumePoolCmdResponse.java deleted file mode 100644 index d3a08751dcf..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/DeleteVolumePoolCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class DeleteVolumePoolCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/DissociateLunCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/DissociateLunCmdResponse.java deleted file mode 100644 index e88fae0642b..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/DissociateLunCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class DissociateLunCmdResponse extends BaseResponse { -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/ListLunsCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/ListLunsCmdResponse.java deleted file mode 100644 index 480d5cc47c3..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/ListLunsCmdResponse.java +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; - -import com.cloud.serializer.Param; - -public class ListLunsCmdResponse extends BaseResponse { - @SerializedName(ApiConstants.ID) - @Param(description = "lun id") - private Long id; - - @SerializedName(ApiConstants.IQN) - @Param(description = "lun iqn") - private String iqn; - - @SerializedName(ApiConstants.NAME) - @Param(description = "lun name") - private String name; - - @SerializedName(ApiConstants.VOLUME_ID) - @Param(description = "volume id") - private Long volumeId; - - public Long getId() { - return id; - } - - public String getIqn() { - return iqn; - } - - public String getName() { - return name; - } - - public Long getVolumeId() { - return volumeId; - } - - public void setId(Long id) { - this.id = id; - } - - public void setIqn(String iqn) { - this.iqn = iqn; - } - - public void setName(String name) { - this.name = name; - } - - public void setVolumeId(Long id) { - this.volumeId = id; - } -} \ No newline at end of file diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumePoolsCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumePoolsCmdResponse.java deleted file mode 100644 index 5167260cce5..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumePoolsCmdResponse.java +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; - -import com.cloud.serializer.Param; - -public class ListVolumePoolsCmdResponse extends BaseResponse { - @SerializedName(ApiConstants.ID) - @Param(description = "pool id") - private Long id; - @SerializedName(ApiConstants.NAME) - @Param(description = "pool name") - private String name; - - @SerializedName(ApiConstants.ALGORITHM) - @Param(description = "pool algorithm") - private String algorithm; - - public Long getId() { - return id; - } - - public String getName() { - return name; - } - - public String getAlgorithm() { - return algorithm; - } - - public void setId(Long id) { - this.id = id; - } - - public void setName(String name) { - this.name = name; - } - - public void setAlgorithm(String algorithm) { - this.algorithm = algorithm; - } -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumesOnFilerCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumesOnFilerCmdResponse.java deleted file mode 100644 index 1a1b6074b96..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/ListVolumesOnFilerCmdResponse.java +++ /dev/null @@ -1,123 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import com.google.gson.annotations.SerializedName; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; - -import com.cloud.serializer.Param; - -public class ListVolumesOnFilerCmdResponse extends BaseResponse { - @SerializedName(ApiConstants.ID) - @Param(description = "volume id") - private Long id; - - @SerializedName(ApiConstants.POOL_NAME) - @Param(description = "pool name") - private String poolName; - - @SerializedName(ApiConstants.IP_ADDRESS) - @Param(description = "ip address") - private String ipAddress; - - @SerializedName(ApiConstants.AGGREGATE_NAME) - @Param(description = "Aggregate name") - private String aggrName; - - @SerializedName(ApiConstants.VOLUME_NAME) - @Param(description = "Volume name") - private String volumeName; - - @SerializedName(ApiConstants.SNAPSHOT_POLICY) - @Param(description = "snapshot policy") - private String snapshotPolicy; - - @SerializedName(ApiConstants.SNAPSHOT_RESERVATION) - @Param(description = "snapshot reservation") - private Integer snapshotReservation; - - @SerializedName(ApiConstants.SIZE) - @Param(description = "volume size") - private String volumeSize; - - public Long getId() { - return id; - } - - public String getPoolName() { - return poolName; - } - - public String getIpAddress() { - return ipAddress; - } - - public String getAggrName() { - return aggrName; - } - - public String getVolumeName() { - return volumeName; - } - - public String getSnapshotPolicy() { - return snapshotPolicy; - } - - public Integer getSnapshotReservation() { - return snapshotReservation; - } - - public String getVolumeSize() { - return volumeSize; - } - - public void setId(Long id) { - this.id = id; - } - - public void setPoolName(String poolName) { - this.poolName = poolName; - } - - public void setIpAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - public void setAggrName(String aggrName) { - this.aggrName = aggrName; - } - - public void setVolumeName(String volumeName) { - this.volumeName = volumeName; - } - - public void setSnapshotPolicy(String snapshotPolicy) { - this.snapshotPolicy = snapshotPolicy; - } - - public void setSnapshotReservation(Integer snapshotReservation) { - this.snapshotReservation = snapshotReservation; - } - - public void setVolumeSize(String size) { - this.volumeSize = size; - } - -} diff --git a/server/src/main/java/com/cloud/server/api/response/netapp/ModifyVolumePoolCmdResponse.java b/server/src/main/java/com/cloud/server/api/response/netapp/ModifyVolumePoolCmdResponse.java deleted file mode 100644 index fa0c069c842..00000000000 --- a/server/src/main/java/com/cloud/server/api/response/netapp/ModifyVolumePoolCmdResponse.java +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.server.api.response.netapp; - -import org.apache.cloudstack.api.BaseResponse; - -public class ModifyVolumePoolCmdResponse extends BaseResponse { -} diff --git a/setup/db/create-schema-premium.sql b/setup/db/create-schema-premium.sql index 3c8671003d7..d8d60ff012e 100644 --- a/setup/db/create-schema-premium.sql +++ b/setup/db/create-schema-premium.sql @@ -285,42 +285,4 @@ ALTER TABLE `cloud_usage`.`usage_security_group` ADD INDEX `i_usage_security_gro USE `cloud`; -CREATE TABLE `cloud`.`netapp_volume` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `ip_address` varchar(255) NOT NULL COMMENT 'ip address/fqdn of the volume', - `pool_id` bigint unsigned NOT NULL COMMENT 'id for the pool', - `pool_name` varchar(255) NOT NULL COMMENT 'name for the pool', - `aggregate_name` varchar(255) NOT NULL COMMENT 'name for the aggregate', - `volume_name` varchar(255) NOT NULL COMMENT 'name for the volume', - `volume_size` varchar(255) NOT NULL COMMENT 'volume size', - `snapshot_policy` varchar(255) NOT NULL COMMENT 'snapshot policy', - `snapshot_reservation` int NOT NULL COMMENT 'snapshot reservation', - `username` varchar(255) NOT NULL COMMENT 'username', - `password` varchar(200) COMMENT 'password', - `round_robin_marker` int COMMENT 'This marks the volume to be picked up for lun creation, RR fashion', - PRIMARY KEY (`id`), - CONSTRAINT `fk_netapp_volume__pool_id` FOREIGN KEY `fk_netapp_volume__pool_id` (`pool_id`) REFERENCES `cloud`.`netapp_pool` (`id`) ON DELETE CASCADE, - INDEX `i_netapp_volume__pool_id`(`pool_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`netapp_pool` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `name` varchar(255) NOT NULL UNIQUE COMMENT 'name for the pool', - `algorithm` varchar(255) NOT NULL COMMENT 'algorithm', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `cloud`.`netapp_lun` ( - `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', - `lun_name` varchar(255) NOT NULL COMMENT 'lun name', - `target_iqn` varchar(255) NOT NULL COMMENT 'target iqn', - `path` varchar(255) NOT NULL COMMENT 'lun path', - `size` bigint NOT NULL COMMENT 'lun size', - `volume_id` bigint unsigned NOT NULL COMMENT 'parent volume id', - PRIMARY KEY (`id`), - CONSTRAINT `fk_netapp_lun__volume_id` FOREIGN KEY `fk_netapp_lun__volume_id` (`volume_id`) REFERENCES `cloud`.`netapp_volume` (`id`) ON DELETE CASCADE, - INDEX `i_netapp_lun__volume_id`(`volume_id`), - INDEX `i_netapp_lun__lun_name`(`lun_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - SET foreign_key_checks = 1; diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index 7665aec0eea..2c68091807b 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -195,9 +195,6 @@ DROP TABLE IF EXISTS `cloud`.`image_data_store`; DROP TABLE IF EXISTS `cloud`.`vm_compute_tags`; DROP TABLE IF EXISTS `cloud`.`vm_root_disk_tags`; DROP TABLE IF EXISTS `cloud`.`vm_network_map`; -DROP TABLE IF EXISTS `cloud`.`netapp_volume`; -DROP TABLE IF EXISTS `cloud`.`netapp_pool`; -DROP TABLE IF EXISTS `cloud`.`netapp_lun`; CREATE TABLE `cloud`.`version` ( `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id', diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 558c408e437..22145ae5d69 100755 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -19832,7 +19832,7 @@ select: function (args) { /* UI no longer gets providers from "listStorageProviders&type=image" because: - (1) Not all of returned values are handled by UI (e.g. Provider "NetApp" is not handled by UI). + (1) Not all of returned values are handled by UI. (2) Provider "SMB" which is handled by UI is not returned from "listStorageProviders&type=image" */ var items =[ { diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 44b2736a2ca..7373ea673ae 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -1908,7 +1908,7 @@ } else { /* UI no longer gets providers from "listStorageProviders&type=image" because: - (1) Not all of returned values are handled by UI (e.g. Provider "NetApp" is not handled by UI). + (1) Not all of returned values are handled by UI. (2) Provider "SMB" which is handled by UI is not returned from "listStorageProviders&type=image" */ storageproviders.push({ id: 'NFS', description: 'NFS'});