diff --git a/.gitignore b/.gitignore
index 9511e9ede2f..b2a905641ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,7 +62,6 @@ tools/cli/build/
awsapi/modules/*
!.gitignore
.classpath
-.project
.settings.xml
.settings/
db.properties.override
@@ -73,4 +72,5 @@ docs/tmp
docs/publish
docs/runbook/tmp
docs/runbook/publish
+.project
Gemfile.lock
diff --git a/INSTALL.md b/INSTALL.md
index 61ebadfdc3d..a2137fdf69d 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -51,18 +51,21 @@ Apache CloudStack uses some ports, make sure at least those used by the manageme
server are available and not blocked by any local firewall. Following ports are
used by Apache CloudStack and its entities:
- 8787: Apache CloudStack (Tomcat) debug socket
- 9090, 8250: Apache CloudStack Management Server, User/Client API
- 8096: User/Client to CloudStack Management Server (unauthenticated)
- 3306: MySQL Server
- 3922, 8250, 80/443, 111/2049, 53: Secondary Storage VM
- 3922, 8250, 53: Console Proxy VM
- 3922, 8250, 53: Virtual Router
+ 8080: API Server (authenticated), browser or CLI client to management server
+ 8096: API Server (unauthenticated), browser or CLI client to management server
+ 8787: Remote java debug debugging port, from IDE to management server
+ 9090: Management server to management server (cluster)
+ 7080: AWS API Server to which an AWS client can connect
+ 80/443: HTTP client to Secondary Storage VM (template download)
+ 111/2049: Secondary Storage to NFS server
+ 3922: Port used to ssh/scp into system vms (SSVM, CPVM, VR)
+ 8250: Agent (SSVM, CPVM, VR) to management server
22, 80, 443: XenServer, XAPI
22: KVM
443: vCenter
- DNS: 53
- NFS: 111/2049
+ 53: DNS
+ 111/2049: NFS
+ 3306: MySQL Server to which the management server connects
### Configuring MySQL Server
@@ -92,8 +95,7 @@ For example, for master:
Clean and build:
- $ mvn clean
- $ mvn install
+ $ mvn clean install -P systemvm,developer
In case you want support for VMWare, SRX and other non-Apache (referred to as nonoss)
compliant libs, you may download the following jar artifacts from respective vendors:
@@ -111,9 +113,9 @@ Install them to ~/.m2 so maven can get them as dependencies:
$ cd deps
$ ./install-non-oss.sh
-And build them with the nonoss flag:
+To build with nonoss components, use the build command with the nonoss flag:
- $ mvn install -Dnonoss
+ $ mvn clean install -P systemvm,developer -Dnonoss
Clear old database (if any) and deploy the database schema:
@@ -121,7 +123,7 @@ Clear old database (if any) and deploy the database schema:
Export the following variable if you need to run and debug the management server:
- $ export MAVEN_OPTS="-Xmx1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
+ $ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
Start the management server:
diff --git a/LICENSE b/LICENSE
index 714f6847ae8..5e29e2b12bc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -180,7 +180,6 @@ Copyright (c) 2013 The Apache Software Foundation
This distribution contains third party resources.
-
Within the . directory
licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
@@ -209,10 +208,9 @@ Within the . directory
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-
+
from Thomas Nagy http://code.google.com/p/waf/
- waf
-
+ waf
Within the awsapi directory
licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
@@ -242,10 +240,9 @@ Within the awsapi directory
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE POSSIBILITY OF SUCH DAMAGE.
-
+
from Thomas Nagy http://code.google.com/p/waf/
- waf
-
+ waf
Within the console-proxy/js directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -270,10 +267,9 @@ Within the console-proxy/js directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from John Resig
- jquery.js
-
+ jquery.js
Within the deps directory
licensed under the BSD (2-clause) for XenServerJava http://www.opensource.org/licenses/BSD-2-Clause (as follows)
@@ -304,28 +300,27 @@ Within the deps directory
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
from Citrix Systems, Inc http://www.citrix.com/
- XenServerJava http://community.citrix.com/cdn/xs/sdks/
-
+ XenServerJava from http://community.citrix.com/cdn/xs/sdks/
Within the patches/systemvm/debian/config/etc directory
placed in the public domain
+ by Adiscon GmbH http://www.adiscon.com/
+ rsyslog.conf
by Simon Kelley
- dnsmasq.conf
- vpcdnsmasq.conf
-
+ dnsmasq.conf
+ vpcdnsmasq.conf
Within the patches/systemvm/debian/config/etc/apache2 directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2012 The Apache Software Foundation
from The Apache Software Foundation http://www.apache.org/
- httpd.conf
- ports.conf
- sites-available/default
- sites-available/default-ssl
- vhostexample.conf
-
+ httpd.conf
+ ports.conf
+ sites-available/default
+ sites-available/default-ssl
+ vhostexample.conf
Within the patches/systemvm/debian/config/etc/ssh/ directory
licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows)
@@ -354,40 +349,95 @@ Within the patches/systemvm/debian/config/etc/ssh/ directory
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
from OpenSSH Project http://www.openssh.org/
- sshd_config
-
+ sshd_config
Within the patches/systemvm/debian/config/root/redundant_router directory
placed in the public domain
by The netfilter.org project http://www.netfilter.org/
- conntrackd.conf.templ
-
+ conntrackd.conf.templ
Within the scripts/storage/secondary directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2010-2011 OpenStack, LLC.
from OpenStack, LLC http://www.openstack.org
- swift
-
+ swift
Within the scripts/vm/hypervisor/xenserver directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2010-2011 OpenStack, LLC.
from OpenStack, LLC http://www.openstack.org
- swift
+ swift
+Within the tools/appliance/definitions/systemvmtemplate directory
+ licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
+
+ Copyright (c) 2010-2012 Patrick Debois
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ from Patrick Debois http://www.jedi.be/blog/
+ base.sh from https://github.com/jedi4ever/veewee
+ cleanup.sh from https://github.com/jedi4ever/veewee
+ definition.rb from https://github.com/jedi4ever/veewee
+ preseed.cfg from https://github.com/jedi4ever/veewee
+ zerodisk.sh from https://github.com/jedi4ever/veewee
+
+Within the tools/devcloud/src/deps/boxes/basebox-build directory
+ licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
+
+ Copyright (c) 2010-2012 Patrick Debois
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ from Patrick Debois http://www.jedi.be/blog/
+ definition.rb from https://github.com/jedi4ever/veewee
+ preseed.cfg from https://github.com/jedi4ever/veewee
Within the ui/lib directory
placed in the public domain
by Eric Meyer http://meyerweb.com/eric/
- reset.css
+ reset.css from http://meyerweb.com/eric/tools/css/reset/
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2006 Google Inc.
from Google Inc. http://google.com
- excanvas.js http://code.google.com/p/explorercanvas/
+ excanvas.js from http://code.google.com/p/explorercanvas/
licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows)
@@ -417,9 +467,34 @@ Within the ui/lib directory
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+
from George McGinley Smith
- jquery.easing.js
+ jquery.easing.js
+
+ licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
+
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ from The Dojo Foundation http://dojofoundation.org/
+ require.js from http://github.com/jrburke/requirejs
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -443,9 +518,9 @@ Within the ui/lib directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from John Resig
- jquery.js
+ jquery.js
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -469,9 +544,9 @@ Within the ui/lib directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Jorn Zaefferer
- jquery.validate.js
+ jquery.validate.js
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -495,9 +570,9 @@ Within the ui/lib directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Sebastian Tschan https://blueimp.net
- jquery.md5.js
+ jquery.md5.js
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -521,10 +596,9 @@ Within the ui/lib directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Klaus Hartl http://stilbuero.de
- jquery.cookies.js
-
+ jquery.cookies.js
Within the ui/lib/flot directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -549,18 +623,18 @@ Within the ui/lib/flot directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from IOLA http://www.iola.dk/
- jquery.flot.crosshair.js
- jquery.flot.fillbetween.js
- jquery.flot.image.js
- jquery.flot.js
- jquery.flot.navigate.js
- jquery.flot.resize.js
- jquery.flot.selection.js
- jquery.flot.stack.js
- jquery.flot.symbol.js
- jquery.flot.threshold.js
+ jquery.flot.crosshair.js
+ jquery.flot.fillbetween.js
+ jquery.flot.image.js
+ jquery.flot.js
+ jquery.flot.navigate.js
+ jquery.flot.resize.js
+ jquery.flot.selection.js
+ jquery.flot.stack.js
+ jquery.flot.symbol.js
+ jquery.flot.threshold.js
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -585,9 +659,9 @@ Within the ui/lib/flot directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Brian Medendorp
- jquery.pie.js
+ jquery.pie.js
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -610,10 +684,9 @@ Within the ui/lib/flot directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Ole Laursen
- jquery.colorhelpers.js
-
+ jquery.colorhelpers.js
Within the ui/lib/jquery-ui directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -637,12 +710,11 @@ Within the ui/lib/jquery-ui directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from jQuery UI Developers http://jqueryui.com/about
- css/jquery-ui.css
- index.html
- js/jquery-ui.js
-
+ css/jquery-ui.css
+ index.html
+ js/jquery-ui.js
Within the ui/lib/qunit directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
@@ -667,3581 +739,14 @@ Within the ui/lib/qunit directory
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
+
from Jorn Zaefferer
- qunit.css http://docs.jquery.com/QUnit
- qunit.js http://docs.jquery.com/QUnit
-
+ qunit.css from http://docs.jquery.com/QUnit
+ qunit.js from http://docs.jquery.com/QUnit
Within the utils/src/com/cloud/utils/db directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2004 Clinton Begin
from Clinton Begin http://code.google.com/p/mybatis/
- ScriptRunner.java http://code.google.com/p/mybatis/
-
-
-
-********************************************************************************
-
-Binary or packaged versions of this software (including versions built from source)
-contain third party resources (as listed below).
-
-Within the target/jar directory
- placed in the public domain
- by Distributed Computing Laboratory at Emory University http://creativecommons.org/licenses/publicdomain/
- cloud-backport-util-concurrent-3.0.jar
-
- licensed under the Apache License, Version 1.1 http://www.apache.org/licenses/LICENSE-1.1 (as follows)
-
- Copyright (c) 2012 The Apache Software Foundation
-
- /* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2000 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written
- * permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * nor may "Apache" appear in their name, without prior written
- * permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- */
-
- from The Apache Software Foundation http://www.apache.org/
- cloud-commons-discovery.jar http://commons.apache.org/discovery/
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2012 The Apache Software Foundation
- from The Apache Software Foundation http://www.apache.org/
- cloud-axis.jar http://axis.apache.org/axis/
- cloud-cglib.jar http://cglib.sourceforge.net/
- cloud-commons-codec-1.5.jar http://commons.apache.org/codec/
- cloud-commons-collections-3.2.1.jar http://commons.apache.org/collections/
- cloud-commons-configuration-1.8.jar http://commons.apache.org/configuration/
- cloud-commons-dbcp-1.4.jar http://commons.apache.org/dbcp/
- cloud-commons-httpclient-3.1.jar http://hc.apache.org/httpclient-3.x/
- cloud-commons-lang-2.6.jar http://commons.apache.org/lang/
- cloud-commons-logging-1.1.1.jar http://commons.apache.org/logging/
- cloud-commons-pool-1.5.6.jar http://commons.apache.org/pool/
- cloud-log4j-extras.jar http://logging.apache.org/log4j/companions/extras/
- cloud-log4j.jar http://logging.apache.org/log4j/
- cloud-ws-commons-util-1.0.2.jar http://ws.apache.org/commons/util/
- cloud-xmlrpc-client-3.1.3.jar http://ws.apache.org/xmlrpc/client.html
- cloud-xmlrpc-common-3.1.3.jar http://ws.apache.org/xmlrpc/xmlrpc-common/
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2007-2010, The JASYPT team (http://www.jasypt.org)
- from The JASYPT team http://www.jasypt.org
- cloud-jasypt-1.9.jar http://www.jasypt.org
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2003-2007 Luck Consulting Pty Ltd
- from Luck Consulting Pty Ltd http://gregluck.com/blog/about/
- cloud-ehcache.jar http://ehcache.org/
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2009 Google Inc.
- from Google Inc. http://google.com
- cloud-google-gson-1.7.1.jar http://code.google.com/p/google-gson/
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
-
- from Jetty Committers http://jetty.codehaus.org/jetty/
- jetty-6.1.26.jar http://repo1.maven.org/maven2/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26-sources.jar
- jetty-util-6.1.26.jar http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26-sources.jar
-
- licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
-
- Copyright (c) 2009, Caringo, Inc.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
- from Caringo, Inc. http://www.caringo.com/
- CAStorSDK.jar http://www.castor.org/download.html
-
- licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
-
- Copyright (c) 2002-2011 Atsuhiko Yamanaka, JCraft,Inc.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
- from JCraft http://www.jcraft.com/
- cloud-jsch-0.1.42.jar http://www.jcraft.com/jsch/
-
- licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
-
- Copyright (c) 2007-2008 Trilead AG (http://www.trilead.com)
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
- from Trilead AG http://www.trilead.com
- cloud-trilead-ssh2-build213.jar http://sourceforge.net/projects/orion-ssh2/
-
- licensed under the Bouncy Castle adaptation of MIT X11 License http://www.bouncycastle.org/licence.html (as follows)
-
-
- Please note: our license is an adaptation of the MIT X11 License and should be
- read as such.
-
- LICENSE Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle
- (http://www.bouncycastle.org)
-
- Permission is hereby granted, free of charge, to any person obtaining a copy of
- this software and associated documentation files (the "Software"), to deal in
- the Software without restriction, including without limitation the rights to
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
- the Software, and to permit persons to whom the Software is furnished to do so,
- subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in all
- copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- from The Legion Of The Bouncy Castle http://www.bouncycastle.org
- cloud-bcprov-jdk16-1.45.jar http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45-sources.jar
-
- licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows)
-
- Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
-
- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients'
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient's rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction's conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys' fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
- from Project GlassFish http://glassfish.java.net/
- cloud-ejb-api-3.0.jar http://repo1.maven.org/maven2/javax/ejb/ejb-api/3.0/ejb-api-3.0-sources.jar
- cloud-jstl-1.2.jar http://jstl.java.net/
-
- licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows)
-
- Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
-
- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients'
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient's rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction's conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys' fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
- from Oracle and/or its affiliates http://oracle.com
- cloud-email.jar http://kenai.com/projects/javamail
-
- licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows)
-
- Copyright (c) IBM Corp 2006
-
- Common Public License Version 1.0 (CPL)
-
- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
- LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
- CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
- 1. DEFINITIONS
-
- "Contribution means:
-
- a) in the case of the initial Contributor, the initial code and documentation
- distributed under this Agreement, and
-
- b) in the case of each subsequent Contributor:
-
- i) changes to the Program, and
-
- ii) additions to the Program;
-
- where such changes and/or additions to the Program originate from and are
- distributed by that particular Contributor. A Contribution 'originates' from a
- Contributor if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include additions to
- the Program which: (i) are separate modules of software distributed in
- conjunction with the Program under their own license agreement, and (ii) are not
- derivative works of the Program.
-
- "Contributor means any person or entity that distributes the Program.
-
- "Licensed Patents mean patent claims licensable by a Contributor which are
- "necessarily infringed by the use or sale of its Contribution alone or when
- "combined with the Program.
-
- "Program means the Contributions distributed in accordance with this Agreement.
-
- "Recipient means anyone who receives the Program under this Agreement, including
- "all Contributors.
-
- 2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free copyright license to
- reproduce, prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any, and such
- derivative works, in source code and object code form.
-
- b) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer the
- Contribution of such Contributor, if any, in source code and object code form.
- This patent license shall apply to the combination of the Contribution and the
- Program if, at the time the Contribution is added by the Contributor, such
- addition of the Contribution causes such combination to be covered by the
- Licensed Patents. The patent license shall not apply to any other combinations
- which include the Contribution. No hardware per se is licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the licenses to
- its Contributions set forth herein, no assurances are provided by any
- Contributor that the Program does not infringe the patent or other intellectual
- property rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement of
- intellectual property rights or otherwise. As a condition to exercising the
- rights and licenses granted hereunder, each Recipient hereby assumes sole
- responsibility to secure any other intellectual property rights needed, if any.
- For example, if a third party patent license is required to allow Recipient to
- distribute the Program, it is Recipient's responsibility to acquire that license
- before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has sufficient copyright
- rights in its Contribution, if any, to grant the copyright license set forth in
- this Agreement.
-
- 3. REQUIREMENTS
-
- A Contributor may choose to distribute the Program in object code form under its
- own license agreement, provided that:
-
- a) it complies with the terms and conditions of this Agreement; and
-
- b) its license agreement:
-
- i) effectively disclaims on behalf of all Contributors all warranties and
- conditions, express and implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of merchantability and
- fitness for a particular purpose;
-
- ii) effectively excludes on behalf of all Contributors all liability for
- damages, including direct, indirect, special, incidental and consequential
- damages, such as lost profits;
-
- iii) states that any provisions which differ from this Agreement are offered by
- that Contributor alone and not by any other party; and
-
- iv) states that source code for the Program is available from such Contributor,
- and informs licensees how to obtain it in a reasonable manner on or through a
- medium customarily used for software exchange.
-
- When the Program is made available in source code form:
-
- a) it must be made available under this Agreement; and
-
- b) a copy of this Agreement must be included with each copy of the Program.
-
- Contributors may not remove or alter any copyright notices contained within the
- Program.
-
- Each Contributor must identify itself as the originator of its Contribution, if
- any, in a manner that reasonably allows subsequent Recipients to identify the
- originator of the Contribution.
-
- 4. COMMERCIAL DISTRIBUTION
-
- Commercial distributors of software may accept certain responsibilities with
- respect to end users, business partners and the like. While this license is
- intended to facilitate the commercial use of the Program, the Contributor who
- includes the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors. Therefore, if
- a Contributor includes the Program in a commercial product offering, such
- Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
- every other Contributor ("Indemnified Contributor") against any losses, damages
- and costs (collectively "Losses") arising from claims, lawsuits and other legal
- actions brought by a third party against the Indemnified Contributor to the
- extent caused by the acts or omissions of such Commercial Contributor in
- connection with its distribution of the Program in a commercial product
- offering. The obligations in this section do not apply to any claims or Losses
- relating to any actual or alleged intellectual property infringement. In order
- to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
- Contributor in writing of such claim, and b) allow the Commercial Contributor to
- control, and cooperate with the Commercial Contributor in, the defense and any
- related settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense.
-
- For example, a Contributor might include the Program in a commercial product
- offering, Product X. That Contributor is then a Commercial Contributor. If that
- Commercial Contributor then makes performance claims, or offers warranties
- related to Product X, those performance claims and warranties are such
- Commercial Contributor's responsibility alone. Under this section, the
- Commercial Contributor would have to defend claims against the other
- Contributors related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the Commercial
- Contributor must pay those damages.
-
- 5. NO WARRANTY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
- IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
- Recipient is solely responsible for determining the appropriateness of using and
- distributing the Program and assumes all risks associated with its exercise of
- rights under this Agreement, including but not limited to the risks and costs of
- program errors, compliance with applicable laws, damage to or loss of data,
- programs or equipment, and unavailability or interruption of operations.
-
- 6. DISCLAIMER OF LIABILITY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
- CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
- PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
- GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
- 7. GENERAL
-
- If any provision of this Agreement is invalid or unenforceable under applicable
- law, it shall not affect the validity or enforceability of the remainder of the
- terms of this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable.
-
- If Recipient institutes patent litigation against a Contributor with respect to
- a patent applicable to software (including a cross-claim or counterclaim in a
- lawsuit), then any patent licenses granted by that Contributor to such Recipient
- under this Agreement shall terminate as of the date such litigation is filed. In
- addition, if Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
- itself (excluding combinations of the Program with other software or hardware)
- infringes such Recipient's patent(s), then such Recipient's rights granted under
- Section 2(b) shall terminate as of the date such litigation is filed.
-
- All Recipient's rights under this Agreement shall terminate if it fails to
- comply with any of the material terms or conditions of this Agreement and does
- not cure such failure in a reasonable period of time after becoming aware of
- such noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this Agreement
- and any licenses granted by Recipient relating to the Program shall continue and
- survive.
-
- Everyone is permitted to copy and distribute copies of this Agreement, but in
- order to avoid inconsistency the Agreement is copyrighted and may only be
- modified in the following manner. The Agreement Steward reserves the right to
- publish new versions (including revisions) of this Agreement from time to time.
- No one other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
- as the Agreement Steward to a suitable separate entity. Each new version of the
- Agreement will be given a distinguishing version number. The Program (including
- Contributions) may always be distributed subject to the version of the Agreement
- under which it was received. In addition, after a new version of the Agreement
- is published, Contributor may elect to distribute the Program (including its
- Contributions) under the new version. Except as expressly stated in Sections
- 2(a) and 2(b) above, Recipient receives no rights or licenses to the
- intellectual property of any Contributor under this Agreement, whether
- expressly, by implication, estoppel or otherwise. All rights in the Program not
- expressly granted under this Agreement are reserved.
-
- This Agreement is governed by the laws of the State of New York and the
- intellectual property laws of the United States of America. No party to this
- Agreement will bring a legal action under this Agreement more than one year
- after the cause of action arose. Each party waives its rights to a jury trial in
- any resulting litigation.
-
- from IBM Corp http://www.ibm.com/
- cloud-wsdl4j-1.6.2.jar http://sourceforge.net/projects/wsdl4j/
- cloud-wsdl4j.jar http://sourceforge.net/projects/wsdl4j/
-
- licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows)
-
-
- Common Public License Version 1.0 (CPL)
-
- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
- LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
- CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
- 1. DEFINITIONS
-
- "Contribution means:
-
- a) in the case of the initial Contributor, the initial code and documentation
- distributed under this Agreement, and
-
- b) in the case of each subsequent Contributor:
-
- i) changes to the Program, and
-
- ii) additions to the Program;
-
- where such changes and/or additions to the Program originate from and are
- distributed by that particular Contributor. A Contribution 'originates' from a
- Contributor if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include additions to
- the Program which: (i) are separate modules of software distributed in
- conjunction with the Program under their own license agreement, and (ii) are not
- derivative works of the Program.
-
- "Contributor means any person or entity that distributes the Program.
-
- "Licensed Patents mean patent claims licensable by a Contributor which are
- "necessarily infringed by the use or sale of its Contribution alone or when
- "combined with the Program.
-
- "Program means the Contributions distributed in accordance with this Agreement.
-
- "Recipient means anyone who receives the Program under this Agreement, including
- "all Contributors.
-
- 2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free copyright license to
- reproduce, prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any, and such
- derivative works, in source code and object code form.
-
- b) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer the
- Contribution of such Contributor, if any, in source code and object code form.
- This patent license shall apply to the combination of the Contribution and the
- Program if, at the time the Contribution is added by the Contributor, such
- addition of the Contribution causes such combination to be covered by the
- Licensed Patents. The patent license shall not apply to any other combinations
- which include the Contribution. No hardware per se is licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the licenses to
- its Contributions set forth herein, no assurances are provided by any
- Contributor that the Program does not infringe the patent or other intellectual
- property rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement of
- intellectual property rights or otherwise. As a condition to exercising the
- rights and licenses granted hereunder, each Recipient hereby assumes sole
- responsibility to secure any other intellectual property rights needed, if any.
- For example, if a third party patent license is required to allow Recipient to
- distribute the Program, it is Recipient's responsibility to acquire that license
- before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has sufficient copyright
- rights in its Contribution, if any, to grant the copyright license set forth in
- this Agreement.
-
- 3. REQUIREMENTS
-
- A Contributor may choose to distribute the Program in object code form under its
- own license agreement, provided that:
-
- a) it complies with the terms and conditions of this Agreement; and
-
- b) its license agreement:
-
- i) effectively disclaims on behalf of all Contributors all warranties and
- conditions, express and implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of merchantability and
- fitness for a particular purpose;
-
- ii) effectively excludes on behalf of all Contributors all liability for
- damages, including direct, indirect, special, incidental and consequential
- damages, such as lost profits;
-
- iii) states that any provisions which differ from this Agreement are offered by
- that Contributor alone and not by any other party; and
-
- iv) states that source code for the Program is available from such Contributor,
- and informs licensees how to obtain it in a reasonable manner on or through a
- medium customarily used for software exchange.
-
- When the Program is made available in source code form:
-
- a) it must be made available under this Agreement; and
-
- b) a copy of this Agreement must be included with each copy of the Program.
-
- Contributors may not remove or alter any copyright notices contained within the
- Program.
-
- Each Contributor must identify itself as the originator of its Contribution, if
- any, in a manner that reasonably allows subsequent Recipients to identify the
- originator of the Contribution.
-
- 4. COMMERCIAL DISTRIBUTION
-
- Commercial distributors of software may accept certain responsibilities with
- respect to end users, business partners and the like. While this license is
- intended to facilitate the commercial use of the Program, the Contributor who
- includes the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors. Therefore, if
- a Contributor includes the Program in a commercial product offering, such
- Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
- every other Contributor ("Indemnified Contributor") against any losses, damages
- and costs (collectively "Losses") arising from claims, lawsuits and other legal
- actions brought by a third party against the Indemnified Contributor to the
- extent caused by the acts or omissions of such Commercial Contributor in
- connection with its distribution of the Program in a commercial product
- offering. The obligations in this section do not apply to any claims or Losses
- relating to any actual or alleged intellectual property infringement. In order
- to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
- Contributor in writing of such claim, and b) allow the Commercial Contributor to
- control, and cooperate with the Commercial Contributor in, the defense and any
- related settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense.
-
- For example, a Contributor might include the Program in a commercial product
- offering, Product X. That Contributor is then a Commercial Contributor. If that
- Commercial Contributor then makes performance claims, or offers warranties
- related to Product X, those performance claims and warranties are such
- Commercial Contributor's responsibility alone. Under this section, the
- Commercial Contributor would have to defend claims against the other
- Contributors related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the Commercial
- Contributor must pay those damages.
-
- 5. NO WARRANTY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
- IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
- Recipient is solely responsible for determining the appropriateness of using and
- distributing the Program and assumes all risks associated with its exercise of
- rights under this Agreement, including but not limited to the risks and costs of
- program errors, compliance with applicable laws, damage to or loss of data,
- programs or equipment, and unavailability or interruption of operations.
-
- 6. DISCLAIMER OF LIABILITY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
- CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
- PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
- GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
- 7. GENERAL
-
- If any provision of this Agreement is invalid or unenforceable under applicable
- law, it shall not affect the validity or enforceability of the remainder of the
- terms of this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable.
-
- If Recipient institutes patent litigation against a Contributor with respect to
- a patent applicable to software (including a cross-claim or counterclaim in a
- lawsuit), then any patent licenses granted by that Contributor to such Recipient
- under this Agreement shall terminate as of the date such litigation is filed. In
- addition, if Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
- itself (excluding combinations of the Program with other software or hardware)
- infringes such Recipient's patent(s), then such Recipient's rights granted under
- Section 2(b) shall terminate as of the date such litigation is filed.
-
- All Recipient's rights under this Agreement shall terminate if it fails to
- comply with any of the material terms or conditions of this Agreement and does
- not cure such failure in a reasonable period of time after becoming aware of
- such noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this Agreement
- and any licenses granted by Recipient relating to the Program shall continue and
- survive.
-
- Everyone is permitted to copy and distribute copies of this Agreement, but in
- order to avoid inconsistency the Agreement is copyrighted and may only be
- modified in the following manner. The Agreement Steward reserves the right to
- publish new versions (including revisions) of this Agreement from time to time.
- No one other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
- as the Agreement Steward to a suitable separate entity. Each new version of the
- Agreement will be given a distinguishing version number. The Program (including
- Contributions) may always be distributed subject to the version of the Agreement
- under which it was received. In addition, after a new version of the Agreement
- is published, Contributor may elect to distribute the Program (including its
- Contributions) under the new version. Except as expressly stated in Sections
- 2(a) and 2(b) above, Recipient receives no rights or licenses to the
- intellectual property of any Contributor under this Agreement, whether
- expressly, by implication, estoppel or otherwise. All rights in the Program not
- expressly granted under this Agreement are reserved.
-
- This Agreement is governed by the laws of the State of New York and the
- intellectual property laws of the United States of America. No party to this
- Agreement will bring a legal action under this Agreement more than one year
- after the cause of action arose. Each party waives its rights to a jury trial in
- any resulting litigation.
-
- from JUnit Project http://www.junit.org/
- cloud-junit.jar http://kentbeck.github.com/junit/
-
- licensed under the Eclipse Distribution License Version 1.0 http://www.eclipse.org/org/documents/edl-v10.php (as follows)
-
- Copyright (c) 2012 The Eclipse Foundation.
-
- Eclipse Distribution License Version 1.0
-
- Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors.
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this list
- of conditions and the following disclaimer. Redistributions in binary form must
- reproduce the above copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution. Neither the name of the Eclipse Foundation, Inc. nor the names of
- its contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- from The Eclipse Foundation http://www.eclipse.org
- cloud-javax.persistence-2.0.0.jar http://wiki.eclipse.org/EclipseLink/Release/2.0.0
-
- licensed under the XStream BSD Style License https://fisheye.codehaus.org/browse/xstream/trunk/LICENSE.txt?hb=true (as follows)
-
-
- (BSD Style License)
-
- Copyright (c) 2003-2006, Joe Walnes Copyright (c) 2006-2011, XStream Committers
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this list
- of conditions and the following disclaimer. Redistributions in binary form must
- reproduce the above copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of XStream nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific prior
- written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- from XStream Committers http://xstream.codehaus.org/
- cloud-xstream-1.3.1.jar http://xstream.codehaus.org/repository.html
-
-
-Within the deps/awsapi-lib directory
- licensed under the ANTLR 2 License http://www.antlr2.org/license.html (as follows)
-
-
- ANTLR 2 License
-
- We reserve no legal rights to the ANTLR--it is fully in the public domain. An
- individual or company may do whatever they wish with source code distributed
- with ANTLR or the code generated by ANTLR, including the incorporation of ANTLR,
- or its output, into commerical software. We encourage users to develop software
- with ANTLR. However, we do ask that credit is given to us for developing ANTLR.
- By "credit", we mean that if you use ANTLR or incorporate any source code into
- one of your programs (commercial product, research project, or otherwise) that
- you acknowledge this fact somewhere in the documentation, research report,
- etc... If you like ANTLR and have developed a nice tool with the output, please
- mention that you developed it using ANTLR. In addition, we ask that the headers
- remain intact in our source code. As long as these guidelines are kept, we
- expect to continue enhancing this system and expect to make other tools
- available as they are completed.
-
- from ANTLR Translator Generator Project http://www.antlr2.org/
- antlr-2.7.6.jar http://repo1.maven.org/maven2/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2004-2008 The Apache Software Foundation
- from The Apache Software Foundation http://www.apache.org/
- XmlSchema-1.4.3.jar
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2004-2012 The Apache Software Foundation
- from The Apache Software Foundation http://www.apache.org/
- apache-log4j-extras-1.0.jar http://logging.apache.org/log4j/companions/extras/
- axiom-api-1.2.8.jar http://ws.apache.org/axiom/source-repository.html
- axiom-impl-1.2.8.jar http://ws.apache.org/axiom/source-repository.html
- axis2-1.5.1.jar http://axis.apache.org/axis/
- axis2-adb-1.5.1.jar http://axis.apache.org/axis/
- axis2-ant-plugin-1.5.1.jar http://axis.apache.org/axis/
- axis2-codegen-1.4.1.jar http://axis.apache.org/axis/
- axis2-jaxbri-1.5.1.jar http://axis.apache.org/axis/
- axis2-jaxws-1.5.1.jar http://axis.apache.org/axis/
- axis2-jibx-1.5.1.jar http://axis.apache.org/axis/
- axis2-json-1.5.1.jar http://axis.apache.org/axis/
- axis2-kernel-1.5.1.jar http://axis.apache.org/axis/
- axis2-transport-http-1.5.1.jar http://axis.apache.org/axis/
- axis2-transport-local-1.5.1.jar http://axis.apache.org/axis/
- axis2-webapp-1.5.1.war http://axis.apache.org/axis/
- commons-codec-1.4.jar http://commons.apache.org/codec/
- commons-collections-3.1.jar http://commons.apache.org/collections/
- commons-fileupload-1.2.jar http://commons.apache.org/fileupload/
- commons-httpclient-3.1.jar http://hc.apache.org/httpclient-3.x/
- commons-io-1.4.jar http://commons.apache.org/io/
- commons-logging-1.1.1.jar http://commons.apache.org/logging/
- httpcore-4.0.jar http://hc.apache.org/httpcomponents-core-ga/
- log4j-1.2.15.jar http://logging.apache.org/log4j/
- neethi-2.0.4.jar http://svn.apache.org/viewvc/webservices/commons/tags/neethi/2.0.4/
- rampart-lib http://axis.apache.org/axis2/java/rampart/download/1.5/download.cgi
- woden-api-1.0M8.jar http://svn.apache.org/viewvc/webservices/woden/tags/1.0M8_20080423/
- woden-impl-dom-1.0M8.jar http://svn.apache.org/viewvc/webservices/woden/tags/1.0M8_20080423/
- wss4j-1.5.8.jar http://ws.apache.org/wss4j/source-repository.html
- xercesImpl.jar http://xerces.apache.org/xerces2-j/source-repository.html
- xml-apis.jar http://repo1.maven.org/maven2/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04-sources.jar
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
- Copyright (c) 2009 Google Inc.
- from Google Inc. http://google.com
- cloud-gson.jar http://code.google.com/p/google-gson/
-
- licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
-
- from Json.simple Project http://code.google.com/p/json-simple/
- json_simple-1.1.jar http://code.google.com/p/json-simple/source/checkout
-
- licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows)
-
- Copyright (c) 2002-2011 Atsuhiko Yamanaka, JCraft,Inc.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
- from JCraft http://www.jcraft.com/
- jsch-0.1.42.jar http://www.jcraft.com/jsch/
-
- licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows)
-
- Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
-
- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients'
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient's rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction's conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys' fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
- from Oracle and/or its affiliates http://oracle.com
- jaxb-api-2.1.jar http://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar
- jaxb-impl-2.1.7.jar http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.1.7/jaxb-impl-2.1.7-sources.jar
- jaxb-xjc-2.1.7.jar http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.1.7/jaxb-xjc-2.1.7-sources.jar
-
- licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows)
-
- Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved.
-
- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients'
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient's rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction's conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys' fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
- from Project GlassFish http://glassfish.java.net/
- jta-1.1.jar http://repo1.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1-sources.jar
-
- licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows)
-
- Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
-
- COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
-
- 1. Definitions.
-
- 1.1. "Contributor" means each individual or entity that
- creates or contributes to the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the
- Original Software, prior Modifications used by a
- Contributor (if any), and the Modifications made by that
- particular Contributor.
-
- 1.3. "Covered Software" means (a) the Original Software, or
- (b) Modifications, or (c) the combination of files
- containing Original Software with files containing
- Modifications, in each case including portions thereof.
-
- 1.4. "Executable" means the Covered Software in any form
- other than Source Code.
-
- 1.5. "Initial Developer" means the individual or entity
- that first makes Original Software available under this
- License.
-
- 1.6. "Larger Work" means a work which combines Covered
- Software or portions thereof with code not governed by the
- terms of this License.
-
- 1.7. "License" means this document.
-
- 1.8. "Licensable" means having the right to grant, to the
- maximum extent possible, whether at the time of the initial
- grant or subsequently acquired, any and all of the rights
- conveyed herein.
-
- 1.9. "Modifications" means the Source Code and Executable
- form of any of the following:
-
- A. Any file that results from an addition to,
- deletion from or modification of the contents of a
- file containing Original Software or previous
- Modifications;
-
- B. Any new file that contains any part of the
- Original Software or previous Modification; or
-
- C. Any new file that is contributed or otherwise made
- available under the terms of this License.
-
- 1.10. "Original Software" means the Source Code and
- Executable form of computer software code that is
- originally released under this License.
-
- 1.11. "Patent Claims" means any patent claim(s), now owned
- or hereafter acquired, including without limitation,
- method, process, and apparatus claims, in any patent
- Licensable by grantor.
-
- 1.12. "Source Code" means (a) the common form of computer
- software code in which modifications are made and (b)
- associated documentation included in or with such code.
-
- 1.13. "You" (or "Your") means an individual or a legal
- entity exercising rights under, and complying with all of
- the terms of, this License. For legal entities, "You"
- includes any entity which controls, is controlled by, or is
- under common control with You. For purposes of this
- definition, "control" means (a) the power, direct or
- indirect, to cause the direction or management of such
- entity, whether by contract or otherwise, or (b) ownership
- of more than fifty percent (50%) of the outstanding shares
- or beneficial ownership of such entity.
-
- 2. License Grants.
-
- 2.1. The Initial Developer Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, the
- Initial Developer hereby grants You a world-wide,
- royalty-free, non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Initial Developer,
- to use, reproduce, modify, display, perform,
- sublicense and distribute the Original Software (or
- portions thereof), with or without Modifications,
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using or selling of Original Software, to make, have
- made, use, practice, sell, and offer for sale, and/or
- otherwise dispose of the Original Software (or
- portions thereof).
-
- (c) The licenses granted in Sections 2.1(a) and (b)
- are effective on the date Initial Developer first
- distributes or otherwise makes the Original Software
- available to a third party under the terms of this
- License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent
- license is granted: (1) for code that You delete from
- the Original Software, or (2) for infringements
- caused by: (i) the modification of the Original
- Software, or (ii) the combination of the Original
- Software with other software or devices.
-
- 2.2. Contributor Grant.
-
- Conditioned upon Your compliance with Section 3.1 below and
- subject to third party intellectual property claims, each
- Contributor hereby grants You a world-wide, royalty-free,
- non-exclusive license:
-
- (a) under intellectual property rights (other than
- patent or trademark) Licensable by Contributor to
- use, reproduce, modify, display, perform, sublicense
- and distribute the Modifications created by such
- Contributor (or portions thereof), either on an
- unmodified basis, with other Modifications, as
- Covered Software and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making,
- using, or selling of Modifications made by that
- Contributor either alone and/or in combination with
- its Contributor Version (or portions of such
- combination), to make, use, sell, offer for sale,
- have made, and/or otherwise dispose of: (1)
- Modifications made by that Contributor (or portions
- thereof); and (2) the combination of Modifications
- made by that Contributor with its Contributor Version
- (or portions of such combination).
-
- (c) The licenses granted in Sections 2.2(a) and
- 2.2(b) are effective on the date Contributor first
- distributes or otherwise makes the Modifications
- available to a third party.
-
- (d) Notwithstanding Section 2.2(b) above, no patent
- license is granted: (1) for any code that Contributor
- has deleted from the Contributor Version; (2) for
- infringements caused by: (i) third party
- modifications of Contributor Version, or (ii) the
- combination of Modifications made by that Contributor
- with other software (except as part of the
- Contributor Version) or other devices; or (3) under
- Patent Claims infringed by Covered Software in the
- absence of Modifications made by that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Availability of Source Code.
-
- Any Covered Software that You distribute or otherwise make
- available in Executable form must also be made available in
- Source Code form and that Source Code form must be
- distributed only under the terms of this License. You must
- include a copy of this License with every copy of the
- Source Code form of the Covered Software You distribute or
- otherwise make available. You must inform recipients of any
- such Covered Software in Executable form as to how they can
- obtain such Covered Software in Source Code form in a
- reasonable manner on or through a medium customarily used
- for software exchange.
-
- 3.2. Modifications.
-
- The Modifications that You create or to which You
- contribute are governed by the terms of this License. You
- represent that You believe Your Modifications are Your
- original creation(s) and/or You have sufficient rights to
- grant the rights conveyed by this License.
-
- 3.3. Required Notices.
-
- You must include a notice in each of Your Modifications
- that identifies You as the Contributor of the Modification.
- You may not remove or alter any copyright, patent or
- trademark notices contained within the Covered Software, or
- any notices of licensing or any descriptive text giving
- attribution to any Contributor or the Initial Developer.
-
- 3.4. Application of Additional Terms.
-
- You may not offer or impose any terms on any Covered
- Software in Source Code form that alters or restricts the
- applicable version of this License or the recipients'
- rights hereunder. You may choose to offer, and to charge a
- fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Software.
- However, you may do so only on Your own behalf, and not on
- behalf of the Initial Developer or any Contributor. You
- must make it absolutely clear that any such warranty,
- support, indemnity or liability obligation is offered by
- You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred
- by the Initial Developer or such Contributor as a result of
- warranty, support, indemnity or liability terms You offer.
-
- 3.5. Distribution of Executable Versions.
-
- You may distribute the Executable form of the Covered
- Software under the terms of this License or under the terms
- of a license of Your choice, which may contain terms
- different from this License, provided that You are in
- compliance with the terms of this License and that the
- license for the Executable form does not attempt to limit
- or alter the recipient's rights in the Source Code form
- from the rights set forth in this License. If You
- distribute the Covered Software in Executable form under a
- different license, You must make it absolutely clear that
- any terms which differ from this License are offered by You
- alone, not by the Initial Developer or Contributor. You
- hereby agree to indemnify the Initial Developer and every
- Contributor for any liability incurred by the Initial
- Developer or such Contributor as a result of any such terms
- You offer.
-
- 3.6. Larger Works.
-
- You may create a Larger Work by combining Covered Software
- with other code not governed by the terms of this License
- and distribute the Larger Work as a single product. In such
- a case, You must make sure the requirements of this License
- are fulfilled for the Covered Software.
-
- 4. Versions of the License.
-
- 4.1. New Versions.
-
- Sun Microsystems, Inc. is the initial license steward and
- may publish revised and/or new versions of this License
- from time to time. Each version will be given a
- distinguishing version number. Except as provided in
- Section 4.3, no one other than the license steward has the
- right to modify this License.
-
- 4.2. Effect of New Versions.
-
- You may always continue to use, distribute or otherwise
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. If the Initial Developer includes a
- notice in the Original Software prohibiting it from being
- distributed or otherwise made available under any
- subsequent version of the License, You must distribute and
- make the Covered Software available under the terms of the
- version of the License under which You originally received
- the Covered Software. Otherwise, You may also choose to
- use, distribute or otherwise make the Covered Software
- available under the terms of any subsequent version of the
- License published by the license steward.
-
- 4.3. Modified Versions.
-
- When You are an Initial Developer and You want to create a
- new license for Your Original Software, You may create and
- use a modified version of this License if You: (a) rename
- the license and remove any references to the name of the
- license steward (except to note that the license differs
- from this License); and (b) otherwise make it clear that
- the license contains terms which differ from this License.
-
- 5. DISCLAIMER OF WARRANTY.
-
- COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS"
- BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED
- SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR
- PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND
- PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY
- COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE
- INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF
- ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF
- WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS
- DISCLAIMER.
-
- 6. TERMINATION.
-
- 6.1. This License and the rights granted hereunder will
- terminate automatically if You fail to comply with terms
- herein and fail to cure such breach within 30 days of
- becoming aware of the breach. Provisions which, by their
- nature, must remain in effect beyond the termination of
- this License shall survive.
-
- 6.2. If You assert a patent infringement claim (excluding
- declaratory judgment actions) against Initial Developer or
- a Contributor (the Initial Developer or Contributor against
- whom You assert such claim is referred to as "Participant")
- alleging that the Participant Software (meaning the
- Contributor Version where the Participant is a Contributor
- or the Original Software where the Participant is the
- Initial Developer) directly or indirectly infringes any
- patent, then any and all rights granted directly or
- indirectly to You by such Participant, the Initial
- Developer (if the Initial Developer is not the Participant)
- and all Contributors under Sections 2.1 and/or 2.2 of this
- License shall, upon 60 days notice from Participant
- terminate prospectively and automatically at the expiration
- of such 60 day notice period, unless if within such 60 day
- period You withdraw Your claim with respect to the
- Participant Software against such Participant either
- unilaterally or pursuant to a written agreement with
- Participant.
-
- 6.3. In the event of termination under Sections 6.1 or 6.2
- above, all end user licenses that have been validly granted
- by You or any distributor hereunder prior to termination
- (excluding licenses granted to You by any distributor)
- shall survive termination.
-
- 7. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE
- INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF
- COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE
- LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT
- LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK
- STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL
- INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT
- APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO
- NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR
- CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT
- APPLY TO YOU.
-
- 8. U.S. GOVERNMENT END USERS.
-
- The Covered Software is a "commercial item," as that term is
- defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial
- computer software" (as that term is defined at 48 C.F.R. ¤
- 252.227-7014(a)(1)) and "commercial computer software
- documentation" as such terms are used in 48 C.F.R. 12.212 (Sept.
- 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
- through 227.7202-4 (June 1995), all U.S. Government End Users
- acquire Covered Software with only those rights set forth herein.
- This U.S. Government Rights clause is in lieu of, and supersedes,
- any other FAR, DFAR, or other clause or provision that addresses
- Government rights in computer software under this License.
-
- 9. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the
- extent necessary to make it enforceable. This License shall be
- governed by the law of the jurisdiction specified in a notice
- contained within the Original Software (except to the extent
- applicable law, if any, provides otherwise), excluding such
- jurisdiction's conflict-of-law provisions. Any litigation
- relating to this License shall be subject to the jurisdiction of
- the courts located in the jurisdiction and venue specified in a
- notice contained within the Original Software, with the losing
- party responsible for costs, including, without limitation, court
- costs and reasonable attorneys' fees and expenses. The
- application of the United Nations Convention on Contracts for the
- International Sale of Goods is expressly excluded. Any law or
- regulation which provides that the language of a contract shall
- be construed against the drafter shall not apply to this License.
- You agree that You alone are responsible for compliance with the
- United States export administration regulations (and the export
- control laws and regulation of any other countries) when You use,
- distribute or otherwise make available any Covered Software.
-
- 10. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or
- indirectly, out of its utilization of rights under this License
- and You agree to work with Initial Developer and Contributors to
- distribute such responsibility on an equitable basis. Nothing
- herein is intended or shall be deemed to constitute any admission
- of liability.
-
- from Oracle and/or its affiliates http://oracle.com
- mail-1.4.jar http://kenai.com/projects/javamail
-
- licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows)
-
-
- Common Public License Version 1.0 (CPL)
-
- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
- LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
- CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
- 1. DEFINITIONS
-
- "Contribution means:
-
- a) in the case of the initial Contributor, the initial code and documentation
- distributed under this Agreement, and
-
- b) in the case of each subsequent Contributor:
-
- i) changes to the Program, and
-
- ii) additions to the Program;
-
- where such changes and/or additions to the Program originate from and are
- distributed by that particular Contributor. A Contribution 'originates' from a
- Contributor if it was added to the Program by such Contributor itself or anyone
- acting on such Contributor's behalf. Contributions do not include additions to
- the Program which: (i) are separate modules of software distributed in
- conjunction with the Program under their own license agreement, and (ii) are not
- derivative works of the Program.
-
- "Contributor means any person or entity that distributes the Program.
-
- "Licensed Patents mean patent claims licensable by a Contributor which are
- "necessarily infringed by the use or sale of its Contribution alone or when
- "combined with the Program.
-
- "Program means the Contributions distributed in accordance with this Agreement.
-
- "Recipient means anyone who receives the Program under this Agreement, including
- "all Contributors.
-
- 2. GRANT OF RIGHTS
-
- a) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free copyright license to
- reproduce, prepare derivative works of, publicly display, publicly perform,
- distribute and sublicense the Contribution of such Contributor, if any, and such
- derivative works, in source code and object code form.
-
- b) Subject to the terms of this Agreement, each Contributor hereby grants
- Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
- Patents to make, use, sell, offer to sell, import and otherwise transfer the
- Contribution of such Contributor, if any, in source code and object code form.
- This patent license shall apply to the combination of the Contribution and the
- Program if, at the time the Contribution is added by the Contributor, such
- addition of the Contribution causes such combination to be covered by the
- Licensed Patents. The patent license shall not apply to any other combinations
- which include the Contribution. No hardware per se is licensed hereunder.
-
- c) Recipient understands that although each Contributor grants the licenses to
- its Contributions set forth herein, no assurances are provided by any
- Contributor that the Program does not infringe the patent or other intellectual
- property rights of any other entity. Each Contributor disclaims any liability to
- Recipient for claims brought by any other entity based on infringement of
- intellectual property rights or otherwise. As a condition to exercising the
- rights and licenses granted hereunder, each Recipient hereby assumes sole
- responsibility to secure any other intellectual property rights needed, if any.
- For example, if a third party patent license is required to allow Recipient to
- distribute the Program, it is Recipient's responsibility to acquire that license
- before distributing the Program.
-
- d) Each Contributor represents that to its knowledge it has sufficient copyright
- rights in its Contribution, if any, to grant the copyright license set forth in
- this Agreement.
-
- 3. REQUIREMENTS
-
- A Contributor may choose to distribute the Program in object code form under its
- own license agreement, provided that:
-
- a) it complies with the terms and conditions of this Agreement; and
-
- b) its license agreement:
-
- i) effectively disclaims on behalf of all Contributors all warranties and
- conditions, express and implied, including warranties or conditions of title and
- non-infringement, and implied warranties or conditions of merchantability and
- fitness for a particular purpose;
-
- ii) effectively excludes on behalf of all Contributors all liability for
- damages, including direct, indirect, special, incidental and consequential
- damages, such as lost profits;
-
- iii) states that any provisions which differ from this Agreement are offered by
- that Contributor alone and not by any other party; and
-
- iv) states that source code for the Program is available from such Contributor,
- and informs licensees how to obtain it in a reasonable manner on or through a
- medium customarily used for software exchange.
-
- When the Program is made available in source code form:
-
- a) it must be made available under this Agreement; and
-
- b) a copy of this Agreement must be included with each copy of the Program.
-
- Contributors may not remove or alter any copyright notices contained within the
- Program.
-
- Each Contributor must identify itself as the originator of its Contribution, if
- any, in a manner that reasonably allows subsequent Recipients to identify the
- originator of the Contribution.
-
- 4. COMMERCIAL DISTRIBUTION
-
- Commercial distributors of software may accept certain responsibilities with
- respect to end users, business partners and the like. While this license is
- intended to facilitate the commercial use of the Program, the Contributor who
- includes the Program in a commercial product offering should do so in a manner
- which does not create potential liability for other Contributors. Therefore, if
- a Contributor includes the Program in a commercial product offering, such
- Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
- every other Contributor ("Indemnified Contributor") against any losses, damages
- and costs (collectively "Losses") arising from claims, lawsuits and other legal
- actions brought by a third party against the Indemnified Contributor to the
- extent caused by the acts or omissions of such Commercial Contributor in
- connection with its distribution of the Program in a commercial product
- offering. The obligations in this section do not apply to any claims or Losses
- relating to any actual or alleged intellectual property infringement. In order
- to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
- Contributor in writing of such claim, and b) allow the Commercial Contributor to
- control, and cooperate with the Commercial Contributor in, the defense and any
- related settlement negotiations. The Indemnified Contributor may participate in
- any such claim at its own expense.
-
- For example, a Contributor might include the Program in a commercial product
- offering, Product X. That Contributor is then a Commercial Contributor. If that
- Commercial Contributor then makes performance claims, or offers warranties
- related to Product X, those performance claims and warranties are such
- Commercial Contributor's responsibility alone. Under this section, the
- Commercial Contributor would have to defend claims against the other
- Contributors related to those performance claims and warranties, and if a court
- requires any other Contributor to pay any damages as a result, the Commercial
- Contributor must pay those damages.
-
- 5. NO WARRANTY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
- IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
- Recipient is solely responsible for determining the appropriateness of using and
- distributing the Program and assumes all risks associated with its exercise of
- rights under this Agreement, including but not limited to the risks and costs of
- program errors, compliance with applicable laws, damage to or loss of data,
- programs or equipment, and unavailability or interruption of operations.
-
- 6. DISCLAIMER OF LIABILITY
-
- EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
- CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
- PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
- GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
- 7. GENERAL
-
- If any provision of this Agreement is invalid or unenforceable under applicable
- law, it shall not affect the validity or enforceability of the remainder of the
- terms of this Agreement, and without further action by the parties hereto, such
- provision shall be reformed to the minimum extent necessary to make such
- provision valid and enforceable.
-
- If Recipient institutes patent litigation against a Contributor with respect to
- a patent applicable to software (including a cross-claim or counterclaim in a
- lawsuit), then any patent licenses granted by that Contributor to such Recipient
- under this Agreement shall terminate as of the date such litigation is filed. In
- addition, if Recipient institutes patent litigation against any entity
- (including a cross-claim or counterclaim in a lawsuit) alleging that the Program
- itself (excluding combinations of the Program with other software or hardware)
- infringes such Recipient's patent(s), then such Recipient's rights granted under
- Section 2(b) shall terminate as of the date such litigation is filed.
-
- All Recipient's rights under this Agreement shall terminate if it fails to
- comply with any of the material terms or conditions of this Agreement and does
- not cure such failure in a reasonable period of time after becoming aware of
- such noncompliance. If all Recipient's rights under this Agreement terminate,
- Recipient agrees to cease use and distribution of the Program as soon as
- reasonably practicable. However, Recipient's obligations under this Agreement
- and any licenses granted by Recipient relating to the Program shall continue and
- survive.
-
- Everyone is permitted to copy and distribute copies of this Agreement, but in
- order to avoid inconsistency the Agreement is copyrighted and may only be
- modified in the following manner. The Agreement Steward reserves the right to
- publish new versions (including revisions) of this Agreement from time to time.
- No one other than the Agreement Steward has the right to modify this Agreement.
- IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
- as the Agreement Steward to a suitable separate entity. Each new version of the
- Agreement will be given a distinguishing version number. The Program (including
- Contributions) may always be distributed subject to the version of the Agreement
- under which it was received. In addition, after a new version of the Agreement
- is published, Contributor may elect to distribute the Program (including its
- Contributions) under the new version. Except as expressly stated in Sections
- 2(a) and 2(b) above, Recipient receives no rights or licenses to the
- intellectual property of any Contributor under this Agreement, whether
- expressly, by implication, estoppel or otherwise. All rights in the Program not
- expressly granted under this Agreement are reserved.
-
- This Agreement is governed by the laws of the State of New York and the
- intellectual property laws of the United States of America. No party to this
- Agreement will bring a legal action under this Agreement more than one year
- after the cause of action arose. Each party waives its rights to a jury trial in
- any resulting litigation.
-
- from JUnit Project http://www.junit.org/
- junit-4.8.1.jar http://kentbeck.github.com/junit/
-
- licensed under the Dom4J License http://dom4j.cvs.sourceforge.net/viewvc/dom4j/dom4j/LICENSE.txt (as follows)
-
-
- Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
-
- Redistribution and use of this software and associated documentation
- ("Software"), with or without modification, are permitted provided
- that the following conditions are met:
-
- 1. Redistributions of source code must retain copyright
- statements and notices. Redistributions must also contain a
- copy of this document.
-
- 2. Redistributions in binary form must reproduce the
- above copyright notice, this list of conditions and the
- following disclaimer in the documentation and/or other
- materials provided with the distribution.
-
- 3. The name "DOM4J" must not be used to endorse or promote
- products derived from this Software without prior written
- permission of MetaStuff, Ltd. For written permission,
- please contact dom4j-info@metastuff.com.
-
- 4. Products derived from this Software may not be called "DOM4J"
- nor may "DOM4J" appear in their names without prior written
- permission of MetaStuff, Ltd. DOM4J is a registered
- trademark of MetaStuff, Ltd.
-
- 5. Due credit should be given to the DOM4J Project -
- http://www.dom4j.org
-
- THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
- ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
- NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- OF THE POSSIBILITY OF SUCH DAMAGE.
-
- from DOM4J Project http://dom4j.sourceforge.net/
- dom4j-1.6.1.jar http://dom4j.sourceforge.net/source-repository.html
-
- licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
-
- Copyright (c) 2004-2011 QOS.ch
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
- from QOS.ch http://www.qos.ch/
- slf4j-api-1.5.11.jar https://github.com/qos-ch/slf4j
- slf4j-jdk14-1.5.11.jar https://github.com/qos-ch/slf4j
-
- licensed under the Mozilla Public License, Version 1.0 http://www.mozilla.org/MPL/1.1/ (as follows)
-
-
- MOZILLA PUBLIC LICENSE
- Version 1.1
-
- ---------------
-
- 1. Definitions.
-
- 1.0.1. "Commercial Use" means distribution or otherwise making the
- Covered Code available to a third party.
-
- 1.1. "Contributor" means each entity that creates or contributes to
- the creation of Modifications.
-
- 1.2. "Contributor Version" means the combination of the Original
- Code, prior Modifications used by a Contributor, and the Modifications
- made by that particular Contributor.
-
- 1.3. "Covered Code" means the Original Code or Modifications or the
- combination of the Original Code and Modifications, in each case
- including portions thereof.
-
- 1.4. "Electronic Distribution Mechanism" means a mechanism generally
- accepted in the software development community for the electronic
- transfer of data.
-
- 1.5. "Executable" means Covered Code in any form other than Source
- Code.
-
- 1.6. "Initial Developer" means the individual or entity identified
- as the Initial Developer in the Source Code notice required by Exhibit
- A.
-
- 1.7. "Larger Work" means a work which combines Covered Code or
- portions thereof with code not governed by the terms of this License.
-
- 1.8. "License" means this document.
-
- 1.8.1. "Licensable" means having the right to grant, to the maximum
- extent possible, whether at the time of the initial grant or
- subsequently acquired, any and all of the rights conveyed herein.
-
- 1.9. "Modifications" means any addition to or deletion from the
- substance or structure of either the Original Code or any previous
- Modifications. When Covered Code is released as a series of files, a
- Modification is:
- A. Any addition to or deletion from the contents of a file
- containing Original Code or previous Modifications.
-
- B. Any new file that contains any part of the Original Code or
- previous Modifications.
-
- 1.10. "Original Code" means Source Code of computer software code
- which is described in the Source Code notice required by Exhibit A as
- Original Code, and which, at the time of its release under this
- License is not already Covered Code governed by this License.
-
- 1.10.1. "Patent Claims" means any patent claim(s), now owned or
- hereafter acquired, including without limitation, method, process,
- and apparatus claims, in any patent Licensable by grantor.
-
- 1.11. "Source Code" means the preferred form of the Covered Code for
- making modifications to it, including all modules it contains, plus
- any associated interface definition files, scripts used to control
- compilation and installation of an Executable, or source code
- differential comparisons against either the Original Code or another
- well known, available Covered Code of the Contributor's choice. The
- Source Code can be in a compressed or archival form, provided the
- appropriate decompression or de-archiving software is widely available
- for no charge.
-
- 1.12. "You" (or "Your") means an individual or a legal entity
- exercising rights under, and complying with all of the terms of, this
- License or a future version of this License issued under Section 6.1.
- For legal entities, "You" includes any entity which controls, is
- controlled by, or is under common control with You. For purposes of
- this definition, "control" means (a) the power, direct or indirect,
- to cause the direction or management of such entity, whether by
- contract or otherwise, or (b) ownership of more than fifty percent
- (50%) of the outstanding shares or beneficial ownership of such
- entity.
-
- 2. Source Code License.
-
- 2.1. The Initial Developer Grant.
- The Initial Developer hereby grants You a world-wide, royalty-free,
- non-exclusive license, subject to third party intellectual property
- claims:
- (a) under intellectual property rights (other than patent or
- trademark) Licensable by Initial Developer to use, reproduce,
- modify, display, perform, sublicense and distribute the Original
- Code (or portions thereof) with or without Modifications, and/or
- as part of a Larger Work; and
-
- (b) under Patents Claims infringed by the making, using or
- selling of Original Code, to make, have made, use, practice,
- sell, and offer for sale, and/or otherwise dispose of the
- Original Code (or portions thereof).
-
- (c) the licenses granted in this Section 2.1(a) and (b) are
- effective on the date Initial Developer first distributes
- Original Code under the terms of this License.
-
- (d) Notwithstanding Section 2.1(b) above, no patent license is
- granted: 1) for code that You delete from the Original Code; 2)
- separate from the Original Code; or 3) for infringements caused
- by: i) the modification of the Original Code or ii) the
- combination of the Original Code with other software or devices.
-
- 2.2. Contributor Grant.
- Subject to third party intellectual property claims, each Contributor
- hereby grants You a world-wide, royalty-free, non-exclusive license
-
- (a) under intellectual property rights (other than patent or
- trademark) Licensable by Contributor, to use, reproduce, modify,
- display, perform, sublicense and distribute the Modifications
- created by such Contributor (or portions thereof) either on an
- unmodified basis, with other Modifications, as Covered Code
- and/or as part of a Larger Work; and
-
- (b) under Patent Claims infringed by the making, using, or
- selling of Modifications made by that Contributor either alone
- and/or in combination with its Contributor Version (or portions
- of such combination), to make, use, sell, offer for sale, have
- made, and/or otherwise dispose of: 1) Modifications made by that
- Contributor (or portions thereof); and 2) the combination of
- Modifications made by that Contributor with its Contributor
- Version (or portions of such combination).
-
- (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
- effective on the date Contributor first makes Commercial Use of
- the Covered Code.
-
- (d) Notwithstanding Section 2.2(b) above, no patent license is
- granted: 1) for any code that Contributor has deleted from the
- Contributor Version; 2) separate from the Contributor Version;
- 3) for infringements caused by: i) third party modifications of
- Contributor Version or ii) the combination of Modifications made
- by that Contributor with other software (except as part of the
- Contributor Version) or other devices; or 4) under Patent Claims
- infringed by Covered Code in the absence of Modifications made by
- that Contributor.
-
- 3. Distribution Obligations.
-
- 3.1. Application of License.
- The Modifications which You create or to which You contribute are
- governed by the terms of this License, including without limitation
- Section 2.2. The Source Code version of Covered Code may be
- distributed only under the terms of this License or a future version
- of this License released under Section 6.1, and You must include a
- copy of this License with every copy of the Source Code You
- distribute. You may not offer or impose any terms on any Source Code
- version that alters or restricts the applicable version of this
- License or the recipients' rights hereunder. However, You may include
- an additional document offering the additional rights described in
- Section 3.5.
-
- 3.2. Availability of Source Code.
- Any Modification which You create or to which You contribute must be
- made available in Source Code form under the terms of this License
- either on the same media as an Executable version or via an accepted
- Electronic Distribution Mechanism to anyone to whom you made an
- Executable version available; and if made available via Electronic
- Distribution Mechanism, must remain available for at least twelve (12)
- months after the date it initially became available, or at least six
- (6) months after a subsequent version of that particular Modification
- has been made available to such recipients. You are responsible for
- ensuring that the Source Code version remains available even if the
- Electronic Distribution Mechanism is maintained by a third party.
-
- 3.3. Description of Modifications.
- You must cause all Covered Code to which You contribute to contain a
- file documenting the changes You made to create that Covered Code and
- the date of any change. You must include a prominent statement that
- the Modification is derived, directly or indirectly, from Original
- Code provided by the Initial Developer and including the name of the
- Initial Developer in (a) the Source Code, and (b) in any notice in an
- Executable version or related documentation in which You describe the
- origin or ownership of the Covered Code.
-
- 3.4. Intellectual Property Matters
- (a) Third Party Claims.
- If Contributor has knowledge that a license under a third party's
- intellectual property rights is required to exercise the rights
- granted by such Contributor under Sections 2.1 or 2.2,
- Contributor must include a text file with the Source Code
- distribution titled "LEGAL" which describes the claim and the
- party making the claim in sufficient detail that a recipient will
- know whom to contact. If Contributor obtains such knowledge after
- the Modification is made available as described in Section 3.2,
- Contributor shall promptly modify the LEGAL file in all copies
- Contributor makes available thereafter and shall take other steps
- (such as notifying appropriate mailing lists or newsgroups)
- reasonably calculated to inform those who received the Covered
- Code that new knowledge has been obtained.
-
- (b) Contributor APIs.
- If Contributor's Modifications include an application programming
- interface and Contributor has knowledge of patent licenses which
- are reasonably necessary to implement that API, Contributor must
- also include this information in the LEGAL file.
-
- (c) Representations.
- Contributor represents that, except as disclosed pursuant to
- Section 3.4(a) above, Contributor believes that Contributor's
- Modifications are Contributor's original creation(s) and/or
- Contributor has sufficient rights to grant the rights conveyed by
- this License.
-
- 3.5. Required Notices.
- You must duplicate the notice in Exhibit A in each file of the Source
- Code. If it is not possible to put such notice in a particular Source
- Code file due to its structure, then You must include such notice in a
- location (such as a relevant directory) where a user would be likely
- to look for such a notice. If You created one or more Modification(s)
- You may add your name as a Contributor to the notice described in
- Exhibit A. You must also duplicate this License in any documentation
- for the Source Code where You describe recipients' rights or ownership
- rights relating to Covered Code. You may choose to offer, and to
- charge a fee for, warranty, support, indemnity or liability
- obligations to one or more recipients of Covered Code. However, You
- may do so only on Your own behalf, and not on behalf of the Initial
- Developer or any Contributor. You must make it absolutely clear than
- any such warranty, support, indemnity or liability obligation is
- offered by You alone, and You hereby agree to indemnify the Initial
- Developer and every Contributor for any liability incurred by the
- Initial Developer or such Contributor as a result of warranty,
- support, indemnity or liability terms You offer.
-
- 3.6. Distribution of Executable Versions.
- You may distribute Covered Code in Executable form only if the
- requirements of Section 3.1-3.5 have been met for that Covered Code,
- and if You include a notice stating that the Source Code version of
- the Covered Code is available under the terms of this License,
- including a description of how and where You have fulfilled the
- obligations of Section 3.2. The notice must be conspicuously included
- in any notice in an Executable version, related documentation or
- collateral in which You describe recipients' rights relating to the
- Covered Code. You may distribute the Executable version of Covered
- Code or ownership rights under a license of Your choice, which may
- contain terms different from this License, provided that You are in
- compliance with the terms of this License and that the license for the
- Executable version does not attempt to limit or alter the recipient's
- rights in the Source Code version from the rights set forth in this
- License. If You distribute the Executable version under a different
- license You must make it absolutely clear that any terms which differ
- from this License are offered by You alone, not by the Initial
- Developer or any Contributor. You hereby agree to indemnify the
- Initial Developer and every Contributor for any liability incurred by
- the Initial Developer or such Contributor as a result of any such
- terms You offer.
-
- 3.7. Larger Works.
- You may create a Larger Work by combining Covered Code with other code
- not governed by the terms of this License and distribute the Larger
- Work as a single product. In such a case, You must make sure the
- requirements of this License are fulfilled for the Covered Code.
-
- 4. Inability to Comply Due to Statute or Regulation.
-
- If it is impossible for You to comply with any of the terms of this
- License with respect to some or all of the Covered Code due to
- statute, judicial order, or regulation then You must: (a) comply with
- the terms of this License to the maximum extent possible; and (b)
- describe the limitations and the code they affect. Such description
- must be included in the LEGAL file described in Section 3.4 and must
- be included with all distributions of the Source Code. Except to the
- extent prohibited by statute or regulation, such description must be
- sufficiently detailed for a recipient of ordinary skill to be able to
- understand it.
-
- 5. Application of this License.
-
- This License applies to code to which the Initial Developer has
- attached the notice in Exhibit A and to related Covered Code.
-
- 6. Versions of the License.
-
- 6.1. New Versions.
- Netscape Communications Corporation ("Netscape") may publish revised
- and/or new versions of the License from time to time. Each version
- will be given a distinguishing version number.
-
- 6.2. Effect of New Versions.
- Once Covered Code has been published under a particular version of the
- License, You may always continue to use it under the terms of that
- version. You may also choose to use such Covered Code under the terms
- of any subsequent version of the License published by Netscape. No one
- other than Netscape has the right to modify the terms applicable to
- Covered Code created under this License.
-
- 6.3. Derivative Works.
- If You create or use a modified version of this License (which you may
- only do in order to apply it to code which is not already Covered Code
- governed by this License), You must (a) rename Your license so that
- the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
- "MPL", "NPL" or any confusingly similar phrase do not appear in your
- license (except to note that your license differs from this License)
- and (b) otherwise make it clear that Your version of the license
- contains terms which differ from the Mozilla Public License and
- Netscape Public License. (Filling in the name of the Initial
- Developer, Original Code or Contributor in the notice described in
- Exhibit A shall not of themselves be deemed to be modifications of
- this License.)
-
- 7. DISCLAIMER OF WARRANTY.
-
- COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
- WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
- DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
- THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
- IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
- YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
- COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
- OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
- ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
- 8. TERMINATION.
-
- 8.1. This License and the rights granted hereunder will terminate
- automatically if You fail to comply with terms herein and fail to cure
- such breach within 30 days of becoming aware of the breach. All
- sublicenses to the Covered Code which are properly granted shall
- survive any termination of this License. Provisions which, by their
- nature, must remain in effect beyond the termination of this License
- shall survive.
-
- 8.2. If You initiate litigation by asserting a patent infringement
- claim (excluding declatory judgment actions) against Initial Developer
- or a Contributor (the Initial Developer or Contributor against whom
- You file such action is referred to as "Participant") alleging that:
-
- (a) such Participant's Contributor Version directly or indirectly
- infringes any patent, then any and all rights granted by such
- Participant to You under Sections 2.1 and/or 2.2 of this License
- shall, upon 60 days notice from Participant terminate prospectively,
- unless if within 60 days after receipt of notice You either: (i)
- agree in writing to pay Participant a mutually agreeable reasonable
- royalty for Your past and future use of Modifications made by such
- Participant, or (ii) withdraw Your litigation claim with respect to
- the Contributor Version against such Participant. If within 60 days
- of notice, a reasonable royalty and payment arrangement are not
- mutually agreed upon in writing by the parties or the litigation claim
- is not withdrawn, the rights granted by Participant to You under
- Sections 2.1 and/or 2.2 automatically terminate at the expiration of
- the 60 day notice period specified above.
-
- (b) any software, hardware, or device, other than such Participant's
- Contributor Version, directly or indirectly infringes any patent, then
- any rights granted to You by such Participant under Sections 2.1(b)
- and 2.2(b) are revoked effective as of the date You first made, used,
- sold, distributed, or had made, Modifications made by that
- Participant.
-
- 8.3. If You assert a patent infringement claim against Participant
- alleging that such Participant's Contributor Version directly or
- indirectly infringes any patent where such claim is resolved (such as
- by license or settlement) prior to the initiation of patent
- infringement litigation, then the reasonable value of the licenses
- granted by such Participant under Sections 2.1 or 2.2 shall be taken
- into account in determining the amount or value of any payment or
- license.
-
- 8.4. In the event of termination under Sections 8.1 or 8.2 above,
- all end user license agreements (excluding distributors and resellers)
- which have been validly granted by You or any distributor hereunder
- prior to termination shall survive termination.
-
- 9. LIMITATION OF LIABILITY.
-
- UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
- (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
- DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
- OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
- ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
- CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
- WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
- COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
- INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
- LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
- RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
- PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
- EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
- THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
-
- 10. U.S. GOVERNMENT END USERS.
-
- The Covered Code is a "commercial item," as that term is defined in
- 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
- software" and "commercial computer software documentation," as such
- terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
- C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
- all U.S. Government End Users acquire Covered Code with only those
- rights set forth herein.
-
- 11. MISCELLANEOUS.
-
- This License represents the complete agreement concerning subject
- matter hereof. If any provision of this License is held to be
- unenforceable, such provision shall be reformed only to the extent
- necessary to make it enforceable. This License shall be governed by
- California law provisions (except to the extent applicable law, if
- any, provides otherwise), excluding its conflict-of-law provisions.
- With respect to disputes in which at least one party is a citizen of,
- or an entity chartered or registered to do business in the United
- States of America, any litigation relating to this License shall be
- subject to the jurisdiction of the Federal Courts of the Northern
- District of California, with venue lying in Santa Clara County,
- California, with the losing party responsible for costs, including
- without limitation, court costs and reasonable attorneys' fees and
- expenses. The application of the United Nations Convention on
- Contracts for the International Sale of Goods is expressly excluded.
- Any law or regulation which provides that the language of a contract
- shall be construed against the drafter shall not apply to this
- License.
-
- 12. RESPONSIBILITY FOR CLAIMS.
-
- As between Initial Developer and the Contributors, each party is
- responsible for claims and damages arising, directly or indirectly,
- out of its utilization of rights under this License and You agree to
- work with Initial Developer and Contributors to distribute such
- responsibility on an equitable basis. Nothing herein is intended or
- shall be deemed to constitute any admission of liability.
-
- 13. MULTIPLE-LICENSED CODE.
-
- Initial Developer may designate portions of the Covered Code as
- "Multiple-Licensed". "Multiple-Licensed" means that the Initial
- Developer permits you to utilize portions of the Covered Code under
- Your choice of the NPL or the alternative licenses, if any, specified
- by the Initial Developer in the file described in Exhibit A.
-
- EXHIBIT A -Mozilla Public License.
-
- ``The contents of this file are subject to the Mozilla Public License
- Version 1.1 (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.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS"
- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- License for the specific language governing rights and limitations
- under the License.
-
- The Original Code is Javassist.
-
- The Initial Developer of the Original Code is Shigeru Chiba.
- Portions created by Shigeru Chiba are Copyright (C)
- 1999-2008 Shigeru Chiba. All Rights Reserved.
-
- Contributor(s): .
-
- Alternatively, the contents of this file may be used under the terms
- of the GNU Lesser General Public License Version 2.1 or later license (the "[LGPL] License"), in which case the
- provisions of [LGPL] License are applicable instead of those
- above. If you wish to allow use of your version of this file only
- under the terms of the [LGPL] License and not to allow others to use
- your version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice and
- other provisions required by the [LGPL] License. If you do not delete
- the provisions above, a recipient may use your version of this file
- under either the MPL or the [LGPL] License."
-
- [NOTE: The text of this Exhibit A may differ slightly from the text of
- the notices in the Source Code files of the Original Code. You should
- use the text of this Exhibit A rather than the text found in the
- Original Code Source Code for Your Modifications.]
-
-
- from Shigeru Chiba http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/
- javassist-3.9.0.GA.jar http://sourceforge.net/projects/jboss/files/Javassist/
+ ScriptRunner.java from http://code.google.com/p/mybatis/
diff --git a/NOTICE b/NOTICE
index e310584e78a..d36048aabda 100644
--- a/NOTICE
+++ b/NOTICE
@@ -6,30 +6,7 @@
- Source code distribution if this software contains third party resources requiring
- the following notices:
-
-
- For
- jquery.md5.js
-
-
- jQuery MD5 Plugin 1.2.1
- https://github.com/blueimp/jQuery-MD5
-
- Copyright 2010, Sebastian Tschan
- https://blueimp.net
-
- Licensed under the MIT license:
- http://creativecommons.org/licenses/MIT/
-
- Based on
- A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
- Digest Algorithm, as defined in RFC 1321.
- Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
- Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
- Distributed under the BSD License
- See http://pajhome.org.uk/crypt/md5 for more info.
+ This distribution contains third party resources requiring the following notices:
For
@@ -66,6 +43,28 @@
Date: Thu May 12 15:04:36 2011 -0400
+ For
+ jquery.md5.js
+
+
+ jQuery MD5 Plugin 1.2.1
+ https://github.com/blueimp/jQuery-MD5
+
+ Copyright 2010, Sebastian Tschan
+ https://blueimp.net
+
+ Licensed under the MIT license:
+ http://creativecommons.org/licenses/MIT/
+
+ Based on
+ A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
+ Digest Algorithm, as defined in RFC 1321.
+ Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
+ Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
+ Distributed under the BSD License
+ See http://pajhome.org.uk/crypt/md5 for more info.
+
+
For
jquery.colorhelpers.js
@@ -77,619 +76,3 @@
Inspiration from jQuery color animation plugin by John Resig.
Released under the MIT license by Ole Laursen, October 2009.
-
-
-********************************************************************************
-
- Binary or packaged versions of this software (including versions built from source)
- contains third party resources requiring the following notices:
-
- For
- cloud-ejb-api-3.0.jar
- cloud-email.jar
- cloud-jstl-1.2.jar
- jaxb-api-2.1.jar
- jaxb-impl-2.1.7.jar
- jaxb-xjc-2.1.7.jar
- jta-1.1.jar
- mail-1.4.jar
-
-
- NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
- (CDDL)
-
- The code released under the CDDL shall be governed by the laws of the State of
- California (excluding conflict-of-law provisions). Any litigation relating to
- this License shall be subject to the jurisdiction of the Federal Courts of the
- Northern District of California and the state courts of the State of California,
- with venue lying in Santa Clara County, California.
-
-
- For
- cloud-javax.persistence-2.0.0.jar
-
-
- EclipseLink 2.0.0
-
- Dec 10th, 2009
-
- About
-
- The EclipseLink project's goal is to provide a complete persistence framework
- that is both comprehensive and universal. It will run in any Java environment
- and read and write objects to virtually any type of data source, including
- relational databases, and XML. EclipseLink will focus on providing leading edge
- support, including advanced feature extensions, for the dominant persistence
- standards for each target data source; Java Persistence API (JPA) for relational
- databases, Java API for XML Binding (JAXB) for XML, Service Data Objects (SDO),
- and Database Web services (DBWS).
-
- For tips on getting started with EclipseLink, please see the following
- resources:
-
- EclipseLink 2.0.0 Release Notes Documentation Examples and How To License
-
- The Eclipse Foundation makes available all content in this plug-in ("Content").
- Unless otherwise indicated below, the Content is provided to you under the terms
- and conditions of the Eclipse Public License Version 1.0 ("EPL") and Eclipse
- Distribution License Version 1.0 ("EDL"). A copy of the EPL is available at
- http://www.eclipse.org/legal/epl-v10.html and a copy of the EDL is available at
- http://www.eclipse.org/org/documents/edl-v10.php. For purposes of the EPL,
- "Program" will mean the Content.
-
- If you did not receive this Content directly from the Eclipse Foundation, the
- Content is being redistributed by another party ("Redistributor") and different
- terms and conditions may apply to your use of any object code in the Content.
- Check the Redistributor's license that was provided with the Content. If no such
- license exists, contact the Redistributor. Unless otherwise indicated below, the
- terms and conditions of the EPL and EDL still apply to any source code in the
- Content and such source code may be obtained at http://www.eclipse.org.
-
- Third Party Content
-
- The Content includes items that have been sourced from third parties as set out
- below. If you did not receive this Content directly from the Eclipse Foundation,
- the following is provided for informational purposes only, and you should look
- to the Redistributor's license for terms and conditions of use.
-
- Foundation Dependencies ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 1.0
- - EJB 3.0 Java Persistence API (JPA) 2.0 EARLY ACCESS EclipseLink MOXy Java
- Architecture for XML Binding (JAXB) Java Mail Java Activation Framework
- Streaming API for XML (StAX) EclipseLink SDO Service Data Objects (SDO)
- Utilities Java Connector Xerces WSDL4J 1.6.2 ASM v1.5.3
-
- The EclipseLink Project includes ASM for the purpose of byte code weaving. The
- AMS library is re-packaged within the source of the project
- (org.persistence.eclipse.internal.libraries.asm.*) to avoid version collisions
- with other usage of ASM. A custom patch has been added to the ASM 1.5.3 source
- to handle an issue with other usages. This fix has also been contributed back to
- the ASM project for inclusion in later projects.
-
- The source code is available within the project's subversion repository. The
- binaries are distributed within the eclipselink.jar and in the
- org.eclipse.persistence.asm_2.0.0.v*.jar bundle.
-
- http://asm.objectweb.org/license.html
-
- Copyright (c) 2000-2005 INRIA, France Telecom, All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this list
- of conditions and the following disclaimer. Redistributions in binary form must
- reproduce the above copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution. Neither the name of the copyright holders nor the names of its
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY
- THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT
- SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- OFTHE POSSIBILITY OF SUCH DAMAGE.
-
- ANTLR v3.0
-
- The ANTLR library (license) is included within EclipseLink Project to enable
- parsing of the Java Persistence Query language (JP QL). The ANTLR library is re-
- packaged within the project in the
- org.eclipse.persistence.internal.libraries.antlr.* packages.
-
- The source is available with the project's subversion repository. The binaries
- are distributed within the eclipselink.jar and in the
- org.eclipse.persistence.antlr_2.0.0.v*.jar bundle.
-
- Java Architecture for XML Binding (JAXB) v2.0.5
-
- The JAXB libraries distributed under CDDL v1.0 are included within the
- EclipseLink Project to enable the MOXY component's implementation of JAXB.
-
- JAXB Libraries:
-
- /jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar /jlib/moxy/jaxb-impl.jar
- /jlib/moxy/jaxb.xjc.jar Java Persistence (JPA) 1.0 - EJB 3.0
-
- The Java Persistence API, included with EJB 3.0, is available for download from
- the ejb-api directory in the glassfish CVS repository.It is distributed under
- CDDLv1.0 . The jar is being shipped as an OSGi bundle and is required for
- compilation of some container based fuctionality.
-
- Java Persistence (JPA) 2.0.
-
- EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation (JSR
- 317). The JPA 2.0 specification API is included in EclipseLink under the EPL and
- EDL licenses.
-
- Java Mail v1.4
-
- The Java Mail library (mail.jar) is distributed with the JAXB v2.0.5 under CDDL
- v1.0 and is included within the EclipseLink Project distribution to support Web
- Services attachment handling in the MOXy component. It is only required when
- using Java SE 5 (Java Mail is included in Java SE 6).
-
- Java Activation Framework v1.1
-
- The Java Activation Framework (activation.jar) is distributed with the JAXB
- v2.0.5 under CDDL v1.0 and is included within the EclipseLink Project
- distribution to support Web Services attachment handling in the MOXy component.
- It is only required when using Java SE 5 (The Java Activation Framework is
- included in Java SE 6).
-
- Streaming API for XML (StAX) v1.0
-
- The Streaming API for XML (StAX) library (jsr173_1.0_api.jar) is distributed
- with the JAXB v2.0.5 under CDDL v1.0 and is included within the EclipseLink
- Project distribution as an optional XML processing approach in the MOXy
- component.
-
- Service Data Objects (SDO) v2.1.1
-
- The Service Data Objects (SDO) API is distributed under a CDDLv1.0 and custom
- license. It provides the standard API implemented by the EclipseLink Project's
- SDO component.
-
- Java Connector v1.5
-
- The JCA 1.5 API is available for download from the connector-api directory in
- the glassfish CVS repository. It is distributed under CDDLv1.0 .
-
- This jar is being shipped and required by the Workbench only. When using
- EclipseLink in a container where JCA integration is required that container will
- provide the necessary API libraries.
-
- Xerces v2.9.0
-
- Xerces 2.9.0 is available from the Xerces home page. It is distributed under
- Apache 2.0.
-
- This jar is shipped for the Workbench's use only in the reading and writing of
- XML configuration files.
-
- WSDL4j v1.6.2
-
- WSDL4J 1.6.2 is available for download from the wsdl4j project. It distributed
- under CPLv1.0 .
-
- This jar is being shipped as a OSGi bundle and is only required for the DBWS
- Builder utility.
-
-
- For
- cloud-commons-logging-1.1.1.jar
- commons-logging-1.1.1.jar
-
-
- // ------------------------------------------------------------------
- // NOTICE file corresponding to the section 4d of The Apache License,
- // Version 2.0, in this case for Commons Logging
- // ------------------------------------------------------------------
-
- Commons Logging
- Copyright 2001-2007 The Apache Software Foundation
-
- This product includes/uses software(s) developed by 'an unknown organization'
- - Unnamed - avalon-framework:avalon-framework:jar:4.1.3
- - Unnamed - log4j:log4j:jar:1.2.12
- - Unnamed - logkit:logkit:jar:1.0.1
-
-
- For
- neethi-2.0.4.jar
-
-
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache AXIOM distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
- Portions Copyright 2006 International Business Machines Corp.
-
- Please read the different LICENSE files present in the licenses directory of
- this distribution.
-
-
- For
- cloud-jasypt-1.9.jar
-
-
- Copyright (c) 2007-2010, The JASYPT team (http://www.jasypt.org)
-
- Licensed 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.
-
-
- ---------------------------------
-
-
-
- This distribution includes cryptographic software. The country in
- which you currently reside may have restrictions on the import,
- possession, use, and/or re-export to another country, of
- encryption software. BEFORE using any encryption software, please
- check your country's laws, regulations and policies concerning the
- import, possession, or use, and re-export of encryption software, to
- see if this is permitted. See http://www.wassenaar.org/ for more
- information.
-
- The U.S. Government Department of Commerce, Bureau of Industry and
- Security (BIS), has classified this software as Export Commodity
- Control Number (ECCN) 5D002.C.1, which includes information security
- software using or performing cryptographic functions with asymmetric
- algorithms. The form and manner of this distribution makes it
- eligible for export under the License Exception ENC Technology
- Software Unrestricted (TSU) exception (see the BIS Export
- Administration Regulations, Section 740.13) for both object code and
- source code.
-
- The following provides more details on the cryptographic software
- used (note that this software is not included in the distribution):
-
- * The PBE Encryption facilities require the Java Cryptography
- extensions: http://java.sun.com/javase/technologies/security/.
-
- ---------------------------------
-
- Distributions of this software may include software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- ---------------------------------
-
-
- ICU License - ICU 1.8.1 and later
-
- COPYRIGHT AND PERMISSION NOTICE
-
- Copyright (c) 1995-2006 International Business Machines
- Corporation and others
-
- All rights reserved.
-
- Permission is hereby granted, free of charge, to any
- person obtaining a copy of this software and associated
- documentation files (the "Software"), to deal in the
- Software without restriction, including without limitation
- the rights to use, copy, modify, merge, publish,
- distribute, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so,
- provided that the above copyright notice(s) and this
- permission notice appear in all copies of the Software and
- that both the above copyright notice(s) and this
- permission notice appear in supporting documentation.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
- EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
- THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
- INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE
- USE OR PERFORMANCE OF THIS SOFTWARE.
-
- Except as contained in this notice, the name of a copyright
- holder shall not be used in advertising or otherwise to
- promote the sale, use or other dealings in this Software
- without prior written authorization of the copyright holder.
-
-
- For
- XmlSchema-1.4.3.jar
-
-
- Portions Copyright 2006 International Business Machines Corp.
-
-
- For
- cloud-trilead-ssh2-build213.jar
-
-
- Trilead SSH-2 for Java includes code that was written by Dr. Christian Plattner
- during his PhD at ETH Zurich. The license states the following:
-
- Copyright (c) 2005 - 2006 Swiss Federal Institute of Technology (ETH Zurich),
- Department of Computer Science (http://www.inf.ethz.ch),
- Christian Plattner. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- a.) Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- b.) Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- c.) Neither the name of ETH Zurich nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- The Java implementations of the AES, Blowfish and 3DES ciphers have been
- taken (and slightly modified) from the cryptography package released by
- "The Legion Of The Bouncy Castle".
-
- Their license states the following:
-
- Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle
- (http://www.bouncycastle.org)
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-
-
- For
- axis2-1.5.1.jar
- axis2-adb-1.5.1.jar
- axis2-ant-plugin-1.5.1.jar
- axis2-codegen-1.4.1.jar
- axis2-jaxbri-1.5.1.jar
- axis2-jaxws-1.5.1.jar
- axis2-jibx-1.5.1.jar
- axis2-json-1.5.1.jar
- axis2-kernel-1.5.1.jar
- axis2-transport-http-1.5.1.jar
- axis2-transport-local-1.5.1.jar
- axis2-webapp-1.5.1.war
- cloud-axis.jar
-
-
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Axis2 distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
- Portions Copyright 2006 International Business Machines Corp.
- Portions Copyright 2005-2007 WSO2, Inc.
-
- This product also includes schemas and specification developed by:
- - the W3C consortium (http://www.w3c.org)
-
- This product also includes WS-* schemas developed by International
- Business Machines Corporation, Microsoft Corporation, BEA Systems,
- TIBCO Software, SAP AG, Sonic Software, and VeriSign
-
- This product also includes a WSDL developed by salesforce.com
- - Copyright 1999-2006 salesforce.com, inc.
-
- Portions of the included xmlbeans library were originally based on the following:
- - software copyright (c) 2000-2003, BEA Systems, .
-
- Please read the different LICENSE files present in the lib directory of
- this distribution.
-
-
- For
- xml-apis.jar
-
-
- =========================================================================
- == NOTICE file corresponding to section 4(d) of the Apache License, ==
- == Version 2.0, in this case for the Apache xml-commons xml-apis ==
- == distribution. ==
- =========================================================================
-
- Apache XML Commons XML APIs
- Copyright 2006 The Apache Software Foundation.
-
- This product includes software developed at
- The Apache Software Foundation (http://www.apache.org/).
-
- Portions of this software were originally based on the following:
- - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- - software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org
-
-
- For
- cloud-commons-codec-1.5.jar
- commons-codec-1.4.jar
-
-
- Apache Commons Codec
- Copyright 2002-2011 The Apache Software Foundation
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- --------------------------------------------------------------------------------
- src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java contains
- test data from http://aspell.sourceforge.net/test/batch0.tab.
-
- Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org). Verbatim copying
- and distribution of this entire article is permitted in any medium,
- provided this notice is preserved.
- --------------------------------------------------------------------------------
-
-
- For
- rampart-lib
-
-
- Apache Rampart
- Copyright 2010 The Apache Software Foundation
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- Please read the different LICENSE files present in the lib directory of
- this distribution.
-
-
- For
- xercesImpl.jar
-
-
- =========================================================================
- == NOTICE file corresponding to section 4(d) of the Apache License, ==
- == Version 2.0, in this case for the Apache Xerces Java distribution. ==
- =========================================================================
-
- Apache Xerces Java
- Copyright 1999-2012 The Apache Software Foundation
-
- This product includes software developed at
- The Apache Software Foundation (http://www.apache.org/).
-
- Portions of this software were originally based on the following:
- - software copyright (c) 1999, IBM Corporation., http://www.ibm.com.
- - software copyright (c) 1999, Sun Microsystems., http://www.sun.com.
- - voluntary contributions made by Paul Eng on behalf of the
- Apache Software Foundation that were originally developed at iClick, Inc.,
- software copyright (c) 1999.
-
-
- For
- woden-api-1.0M8.jar
- woden-impl-dom-1.0M8.jar
-
-
- =========================================================================
- == NOTICE file corresponding to the section 4 d of ==
- == the Apache License, Version 2.0, ==
- == in this case for the Apache Woden distribution. ==
- =========================================================================
-
- This product includes software developed by
- The Apache Software Foundation (http://www.apache.org/).
-
- This product also includes software developed by :
-
- - IBM Corporation (http://www.ibm.com),
- WSDL4J was the initial code contribution for the Apache Woden
- project and some of the WSDL4J design and code has been reused.
- - The W3C Consortium (http://www.w3c.org),
- Common W3C XML Schema and DTD files are packaged with Apache Woden.
-
- Please read the different LICENSE files present in the root directory of
- this distribution.
-
-
- For
- axiom-api-1.2.8.jar
- axiom-impl-1.2.8.jar
-
-
- Axiom includes software from other projects, as follows:
-
- This software includes the Woodstox High-performance XML processor
- http://woodstox.codehaus.org/
- licensed under the Apache License, Version 2.0
-
- This software includes the Jaxen XPath library
- http://jaxen.codehaus.org/
- licensed under the following BSD 3 Clause license:
-
- ================================================================================
- Copyright 2003-2006 The Werken Company. All Rights Reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are
- met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of the Jaxen Project nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- ================================================================================
-
-
- For
- wss4j-1.5.8.jar
-
-
- Apache WebServices - WSS4J
- Copyright 2004-2011 The Apache Software Foundation
-
- This product includes software developed at
- The Apache Software Foundation (http://www.apache.org/).
-
- This product includes software Copyright University of Southampton IT
- Innovation Centre, 2006 (http://www.it-innovation.soton.ac.uk).
diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties
index 27572b53653..74cfd1c21d6 100644
--- a/agent/conf/agent.properties
+++ b/agent/conf/agent.properties
@@ -69,3 +69,14 @@ domr.scripts.dir=scripts/network/domr/kvm
# set the vm migrate speed, by default, it will try to guess the speed of the guest network
# In MegaBytes per second
#vm.migrate.speed=0
+
+# set the type of bridge used on the hypervisor, this defines what commands the resource
+# will use to setup networking. Currently supported NATIVE, OPENVSWITCH
+#network.bridge.type=native
+
+# set the driver used to plug and unplug nics from the bridges
+# a sensible default will be selected based on the network.bridge.type but can
+# be overridden here.
+# native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
+# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver
+#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
\ No newline at end of file
diff --git a/agent/pom.xml b/agent/pom.xml
index 810f33fc572..a3d071b1c6a 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -23,7 +23,7 @@
org.apache.cloudstack
cloudstack
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java
index e3d1063e6b8..e736978a7a8 100644
--- a/agent/src/com/cloud/agent/AgentShell.java
+++ b/agent/src/com/cloud/agent/AgentShell.java
@@ -48,15 +48,13 @@ import com.cloud.agent.dao.StorageComponent;
import com.cloud.agent.dao.impl.PropertiesStorage;
import com.cloud.host.Host;
import com.cloud.resource.ServerResource;
+import com.cloud.utils.LogUtils;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.ProcessUtil;
import com.cloud.utils.PropertiesUtil;
import com.cloud.utils.backoff.BackoffAlgorithm;
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
-import com.cloud.utils.net.MacAddress;
import com.cloud.utils.script.Script;
public class AgentShell implements IAgentShell {
@@ -146,6 +144,7 @@ public class AgentShell implements IAgentShell {
return _guid;
}
+ @Override
public Map getCmdLineProperties() {
return _cmdLineProperties;
}
@@ -378,8 +377,6 @@ public class AgentShell implements IAgentShell {
public void init(String[] args) throws ConfigurationException {
- final ComponentLocator locator = ComponentLocator.getLocator("agent");
-
final Class> c = this.getClass();
_version = c.getPackage().getImplementationVersion();
if (_version == null) {
@@ -396,12 +393,9 @@ public class AgentShell implements IAgentShell {
s_logger.debug("Found property: " + property);
}
- _storage = locator.getManager(StorageComponent.class);
- if (_storage == null) {
- s_logger.info("Defaulting to using properties file for storage");
- _storage = new PropertiesStorage();
- _storage.configure("Storage", new HashMap());
- }
+ s_logger.info("Defaulting to using properties file for storage");
+ _storage = new PropertiesStorage();
+ _storage.configure("Storage", new HashMap());
// merge with properties from command line to let resource access
// command line parameters
@@ -410,22 +404,9 @@ public class AgentShell implements IAgentShell {
_properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
}
- final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
- final Enumeration en = adapters.enumeration();
- while (en.hasMoreElements()) {
- _backoff = (BackoffAlgorithm) en.nextElement();
- break;
- }
- if (en.hasMoreElements()) {
- s_logger.info("More than one backoff algorithm specified. Using the first one ");
- }
-
- if (_backoff == null) {
- s_logger.info("Defaulting to the constant time backoff algorithm");
- _backoff = new ConstantTimeBackoff();
- _backoff.configure("ConstantTimeBackoff",
- new HashMap());
- }
+ s_logger.info("Defaulting to the constant time backoff algorithm");
+ _backoff = new ConstantTimeBackoff();
+ _backoff.configure("ConstantTimeBackoff", new HashMap());
}
private void launchAgent() throws ConfigurationException {
@@ -469,6 +450,7 @@ public class AgentShell implements IAgentShell {
openPortWithIptables(port);
_consoleProxyMain = new Thread(new Runnable() {
+ @Override
public void run() {
try {
Class> consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy");
@@ -522,7 +504,7 @@ public class AgentShell implements IAgentShell {
} catch (final SecurityException e) {
throw new ConfigurationException(
"Security excetion when loading resource: " + name
- + " due to: " + e.toString());
+ + " due to: " + e.toString());
} catch (final NoSuchMethodException e) {
throw new ConfigurationException(
"Method not found excetion when loading resource: "
@@ -534,7 +516,7 @@ public class AgentShell implements IAgentShell {
} catch (final InstantiationException e) {
throw new ConfigurationException(
"Instantiation excetion when loading resource: " + name
- + " due to: " + e.toString());
+ + " due to: " + e.toString());
} catch (final IllegalAccessException e) {
throw new ConfigurationException(
"Illegal access exception when loading resource: "
@@ -630,6 +612,8 @@ public class AgentShell implements IAgentShell {
public static void main(String[] args) {
try {
+ LogUtils.initLog4j("log4j-cloud.xml");
+
AgentShell shell = new AgentShell();
shell.init(args);
shell.start();
diff --git a/agent/src/com/cloud/agent/VmmAgentShell.java b/agent/src/com/cloud/agent/VmmAgentShell.java
index ef2ef0f3279..190d1168284 100644
--- a/agent/src/com/cloud/agent/VmmAgentShell.java
+++ b/agent/src/com/cloud/agent/VmmAgentShell.java
@@ -23,7 +23,6 @@ import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -41,19 +40,15 @@ import com.cloud.agent.dao.impl.PropertiesStorage;
import com.cloud.agent.transport.Request;
import com.cloud.resource.ServerResource;
import com.cloud.utils.NumbersUtil;
-import com.cloud.utils.ProcessUtil;
import com.cloud.utils.PropertiesUtil;
import com.cloud.utils.backoff.BackoffAlgorithm;
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
-import com.cloud.utils.component.Adapters;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.net.MacAddress;
import com.cloud.utils.nio.HandlerFactory;
import com.cloud.utils.nio.Link;
import com.cloud.utils.nio.NioServer;
import com.cloud.utils.nio.Task;
-import com.cloud.utils.nio.Task.Type;
/**
* Implementation of agent shell to run the agents on System Center Virtual Machine manager
@@ -61,7 +56,7 @@ import com.cloud.utils.nio.Task.Type;
public class VmmAgentShell implements IAgentShell, HandlerFactory {
- private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName());
+ private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName());
private final Properties _properties = new Properties();
private final Map _cmdLineProperties = new HashMap();
private StorageComponent _storage;
@@ -76,112 +71,112 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
private int _proxyPort;
private int _workers;
private String _guid;
- static private NioServer _connection;
- static private int _listenerPort=9000;
+ static private NioServer _connection;
+ static private int _listenerPort=9000;
private int _nextAgentId = 1;
private volatile boolean _exit = false;
private int _pingRetries;
- private Thread _consoleProxyMain = null;
+ private final Thread _consoleProxyMain = null;
private final List _agents = new ArrayList();
public VmmAgentShell() {
}
-
+
@Override
public Properties getProperties() {
- return _properties;
+ return _properties;
}
-
+
@Override
public BackoffAlgorithm getBackoffAlgorithm() {
- return _backoff;
+ return _backoff;
}
-
+
@Override
public int getPingRetries() {
- return _pingRetries;
+ return _pingRetries;
}
-
+
@Override
public String getZone() {
- return _zone;
+ return _zone;
}
-
+
@Override
public String getPod() {
- return _pod;
+ return _pod;
}
-
+
@Override
public String getHost() {
- return _host;
+ return _host;
}
-
+
@Override
public String getPrivateIp() {
- return _privateIp;
+ return _privateIp;
}
-
+
@Override
public int getPort() {
- return _port;
+ return _port;
}
-
+
@Override
public int getProxyPort() {
- return _proxyPort;
+ return _proxyPort;
}
-
+
@Override
public int getWorkers() {
- return _workers;
+ return _workers;
}
-
+
@Override
public String getGuid() {
- return _guid;
+ return _guid;
}
- @Override
- public void upgradeAgent(String url) {
- // TODO Auto-generated method stub
-
- }
+ @Override
+ public void upgradeAgent(String url) {
+ // TODO Auto-generated method stub
- @Override
+ }
+
+ @Override
public String getVersion() {
- return _version;
+ return _version;
}
- @Override
- public Map getCmdLineProperties() {
- // TODO Auto-generated method stub
- return _cmdLineProperties;
- }
-
- public String getProperty(String prefix, String name) {
- if(prefix != null)
- return _properties.getProperty(prefix + "." + name);
-
- return _properties.getProperty(name);
+ @Override
+ public Map getCmdLineProperties() {
+ // TODO Auto-generated method stub
+ return _cmdLineProperties;
}
-
- @Override
- public String getPersistentProperty(String prefix, String name) {
- if(prefix != null)
- return _storage.get(prefix + "." + name);
- return _storage.get(name);
- }
- @Override
- public void setPersistentProperty(String prefix, String name, String value) {
- if(prefix != null)
- _storage.persist(prefix + "." + name, value);
- else
- _storage.persist(name, value);
- }
+ public String getProperty(String prefix, String name) {
+ if(prefix != null)
+ return _properties.getProperty(prefix + "." + name);
- private void loadProperties() throws ConfigurationException {
+ return _properties.getProperty(name);
+ }
+
+ @Override
+ public String getPersistentProperty(String prefix, String name) {
+ if(prefix != null)
+ return _storage.get(prefix + "." + name);
+ return _storage.get(name);
+ }
+
+ @Override
+ public void setPersistentProperty(String prefix, String name, String value) {
+ if(prefix != null)
+ _storage.persist(prefix + "." + name, value);
+ else
+ _storage.persist(name, value);
+ }
+
+ private void loadProperties() throws ConfigurationException {
final File file = PropertiesUtil.findConfigFile("agent.properties");
if (file == null) {
throw new ConfigurationException("Unable to find agent.properties.");
@@ -197,7 +192,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex);
}
}
-
+
protected boolean parseCommand(final String[] args) throws ConfigurationException {
String host = null;
String workers = null;
@@ -211,7 +206,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
System.out.println("Invalid Parameter: " + args[i]);
continue;
}
-
+
// save command line properties
_cmdLineProperties.put(tokens[0], tokens[1]);
@@ -222,14 +217,14 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
} else if (tokens[0].equalsIgnoreCase("host")) {
host = tokens[1];
} else if(tokens[0].equalsIgnoreCase("zone")) {
- zone = tokens[1];
+ zone = tokens[1];
} else if(tokens[0].equalsIgnoreCase("pod")) {
- pod = tokens[1];
+ pod = tokens[1];
} else if(tokens[0].equalsIgnoreCase("guid")) {
- guid = tokens[1];
- } else if(tokens[0].equalsIgnoreCase("eth1ip")) {
- _privateIp = tokens[1];
- }
+ guid = tokens[1];
+ } else if(tokens[0].equalsIgnoreCase("eth1ip")) {
+ _privateIp = tokens[1];
+ }
}
if (port == null) {
@@ -237,7 +232,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
}
_port = NumbersUtil.parseInt(port, 8250);
-
+
_proxyPort = NumbersUtil.parseInt(getProperty(null, "consoleproxy.httpListenPort"), 443);
if (workers == null) {
@@ -254,42 +249,42 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
host = "localhost";
}
_host = host;
-
+
if(zone != null)
- _zone = zone;
+ _zone = zone;
else
- _zone = getProperty(null, "zone");
+ _zone = getProperty(null, "zone");
if (_zone == null || (_zone.startsWith("@") && _zone.endsWith("@"))) {
- _zone = "default";
+ _zone = "default";
}
if(pod != null)
- _pod = pod;
+ _pod = pod;
else
- _pod = getProperty(null, "pod");
+ _pod = getProperty(null, "pod");
if (_pod == null || (_pod.startsWith("@") && _pod.endsWith("@"))) {
- _pod = "default";
+ _pod = "default";
}
if (_host == null || (_host.startsWith("@") && _host.endsWith("@"))) {
throw new ConfigurationException("Host is not configured correctly: " + _host);
}
-
+
final String retries = getProperty(null, "ping.retries");
_pingRetries = NumbersUtil.parseInt(retries, 5);
String value = getProperty(null, "developer");
boolean developer = Boolean.parseBoolean(value);
-
+
if(guid != null)
- _guid = guid;
+ _guid = guid;
else
- _guid = getProperty(null, "guid");
+ _guid = getProperty(null, "guid");
if (_guid == null) {
- if (!developer) {
- throw new ConfigurationException("Unable to find the guid");
- }
- _guid = MacAddress.getMacAddress().toString(":");
+ if (!developer) {
+ throw new ConfigurationException("Unable to find the guid");
+ }
+ _guid = MacAddress.getMacAddress().toString(":");
}
return true;
@@ -303,63 +298,46 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
}
s_logger.trace("Launching agent based on type=" + typeInfo);
}
-
+
private void launchAgent() throws ConfigurationException {
String resourceClassNames = getProperty(null, "resource");
s_logger.trace("resource=" + resourceClassNames);
if(resourceClassNames != null) {
- launchAgentFromClassInfo(resourceClassNames);
- return;
+ launchAgentFromClassInfo(resourceClassNames);
+ return;
}
-
+
launchAgentFromTypeInfo();
}
-
+
private void init(String[] args) throws ConfigurationException{
-
- final ComponentLocator locator = ComponentLocator.getLocator("agent");
-
+
final Class> c = this.getClass();
_version = c.getPackage().getImplementationVersion();
if (_version == null) {
throw new CloudRuntimeException("Unable to find the implementation version of this agent");
}
s_logger.info("Implementation Version is " + _version);
-
+
parseCommand(args);
-
- _storage = locator.getManager(StorageComponent.class);
- if (_storage == null) {
- s_logger.info("Defaulting to using properties file for storage");
- _storage = new PropertiesStorage();
- _storage.configure("Storage", new HashMap());
- }
+
+ s_logger.info("Defaulting to using properties file for storage");
+ _storage = new PropertiesStorage();
+ _storage.configure("Storage", new HashMap());
// merge with properties from command line to let resource access command line parameters
for(Map.Entry cmdLineProp : getCmdLineProperties().entrySet()) {
- _properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
- }
-
- final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class);
- final Enumeration en = adapters.enumeration();
- while (en.hasMoreElements()) {
- _backoff = (BackoffAlgorithm)en.nextElement();
- break;
- }
- if (en.hasMoreElements()) {
- s_logger.info("More than one backoff algorithm specified. Using the first one ");
+ _properties.put(cmdLineProp.getKey(), cmdLineProp.getValue());
}
- if (_backoff == null) {
- s_logger.info("Defaulting to the constant time backoff algorithm");
- _backoff = new ConstantTimeBackoff();
- _backoff.configure("ConstantTimeBackoff", new HashMap());
- }
+ s_logger.info("Defaulting to the constant time backoff algorithm");
+ _backoff = new ConstantTimeBackoff();
+ _backoff.configure("ConstantTimeBackoff", new HashMap());
}
private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException {
- String[] names = resourceClassNames.split("\\|");
- for(String name: names) {
+ String[] names = resourceClassNames.split("\\|");
+ for(String name: names) {
Class> impl;
try {
impl = Class.forName(name);
@@ -368,41 +346,41 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
ServerResource resource = (ServerResource)constructor.newInstance();
launchAgent(getNextAgentId(), resource);
} catch (final ClassNotFoundException e) {
- throw new ConfigurationException("Resource class not found: " + name);
+ throw new ConfigurationException("Resource class not found: " + name);
} catch (final SecurityException e) {
- throw new ConfigurationException("Security excetion when loading resource: " + name);
+ throw new ConfigurationException("Security excetion when loading resource: " + name);
} catch (final NoSuchMethodException e) {
- throw new ConfigurationException("Method not found excetion when loading resource: " + name);
+ throw new ConfigurationException("Method not found excetion when loading resource: " + name);
} catch (final IllegalArgumentException e) {
- throw new ConfigurationException("Illegal argument excetion when loading resource: " + name);
+ throw new ConfigurationException("Illegal argument excetion when loading resource: " + name);
} catch (final InstantiationException e) {
- throw new ConfigurationException("Instantiation excetion when loading resource: " + name);
+ throw new ConfigurationException("Instantiation excetion when loading resource: " + name);
} catch (final IllegalAccessException e) {
- throw new ConfigurationException("Illegal access exception when loading resource: " + name);
+ throw new ConfigurationException("Illegal access exception when loading resource: " + name);
} catch (final InvocationTargetException e) {
- throw new ConfigurationException("Invocation target exception when loading resource: " + name);
+ throw new ConfigurationException("Invocation target exception when loading resource: " + name);
}
- }
+ }
}
private void launchAgent(int localAgentId, ServerResource resource) throws ConfigurationException {
- // we don't track agent after it is launched for now
- Agent agent = new Agent(this, localAgentId, resource);
- _agents.add(agent);
- agent.start();
+ // we don't track agent after it is launched for now
+ Agent agent = new Agent(this, localAgentId, resource);
+ _agents.add(agent);
+ agent.start();
}
public synchronized int getNextAgentId() {
- return _nextAgentId++;
+ return _nextAgentId++;
}
-
- private void run(String[] args) {
-
- try {
+
+ private void run(String[] args) {
+
+ try {
System.setProperty("java.net.preferIPv4Stack","true");
- loadProperties();
- init(args);
-
+ loadProperties();
+ init(args);
+
String instance = getProperty(null, "instance");
if (instance == null) {
instance = "";
@@ -413,22 +391,22 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
// TODO need to do this check. For Agentshell running on windows needs different approach
//final String run = "agent." + instance + "pid";
//s_logger.debug("Checking to see if " + run + "exists.");
- //ProcessUtil.pidCheck(run);
-
-
+ //ProcessUtil.pidCheck(run);
+
+
// TODO: For Hyper-V agent.properties need to be revamped to support multiple agents
// corresponding to multiple clusters but running on a SCVMM host
-
+
// read the persistent storage and launch the agents
- //launchAgent();
+ //launchAgent();
// FIXME get rid of this approach of agent listening for boot strap commands from the management server
- // now listen for bootstrap request from the management server and launch agents
- _connection = new NioServer("VmmAgentShell", _listenerPort, 1, this);
- _connection.start();
- s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server");
- while(_connection.isRunning());
+ // now listen for bootstrap request from the management server and launch agents
+ _connection = new NioServer("VmmAgentShell", _listenerPort, 1, this);
+ _connection.start();
+ s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server");
+ while(_connection.isRunning());
} catch(final ConfigurationException e) {
s_logger.error("Unable to start agent: " + e.getMessage());
System.out.println("Unable to start agent: " + e.getMessage());
@@ -438,89 +416,89 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory {
System.out.println("Unable to start agent: " + e.getMessage());
System.exit(ExitStatus.Error.value());
}
- }
+ }
- @Override
- public Task create(com.cloud.utils.nio.Task.Type type, Link link,
- byte[] data) {
- return new AgentBootStrapHandler(type, link, data);
- }
+ @Override
+ public Task create(com.cloud.utils.nio.Task.Type type, Link link,
+ byte[] data) {
+ return new AgentBootStrapHandler(type, link, data);
+ }
- public void stop() {
- _exit = true;
- if(_consoleProxyMain != null) {
- _consoleProxyMain.interrupt();
- }
- }
-
- public static void main(String[] args) {
-
- VmmAgentShell shell = new VmmAgentShell();
- Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell));
- shell.run(args);
- }
+ public void stop() {
+ _exit = true;
+ if(_consoleProxyMain != null) {
+ _consoleProxyMain.interrupt();
+ }
+ }
- // class to handle the bootstrap command from the management server
- private class AgentBootStrapHandler extends Task {
+ public static void main(String[] args) {
- public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
- super(type, link, data);
- }
+ VmmAgentShell shell = new VmmAgentShell();
+ Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell));
+ shell.run(args);
+ }
- @Override
- protected void doTask(Task task) throws Exception {
- final Type type = task.getType();
- s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler");
- if (type == Task.Type.DATA)
- {
- final byte[] data = task.getData();
- final Request request = Request.parse(data);
- final Command cmd = request.getCommand();
-
- if (cmd instanceof StartupVMMAgentCommand) {
+ // class to handle the bootstrap command from the management server
+ private class AgentBootStrapHandler extends Task {
- StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
+ public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) {
+ super(type, link, data);
+ }
- _zone = Long.toString(vmmCmd.getDataCenter());
- _cmdLineProperties.put("zone", _zone);
+ @Override
+ protected void doTask(Task task) throws Exception {
+ final Type type = task.getType();
+ s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler");
+ if (type == Task.Type.DATA)
+ {
+ final byte[] data = task.getData();
+ final Request request = Request.parse(data);
+ final Command cmd = request.getCommand();
- _pod = Long.toString(vmmCmd.getPod());
- _cmdLineProperties.put("pod", _pod);
+ if (cmd instanceof StartupVMMAgentCommand) {
- _cluster = vmmCmd.getClusterName();
- _cmdLineProperties.put("cluster", _cluster);
+ StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd;
- _guid = vmmCmd.getGuid();
- _cmdLineProperties.put("guid", _guid);
+ _zone = Long.toString(vmmCmd.getDataCenter());
+ _cmdLineProperties.put("zone", _zone);
- _host = vmmCmd.getManagementServerIP();
- _port = NumbersUtil.parseInt(vmmCmd.getport(), 8250);
+ _pod = Long.toString(vmmCmd.getPod());
+ _cmdLineProperties.put("pod", _pod);
- s_logger.info("Recieved boot strap command from management server with parameters " +
- " Zone:"+ _zone + " "+
- " Cluster:"+ _cluster + " "+
- " pod:"+_pod + " "+
- " host:"+ _host +" "+
- " port:"+_port);
+ _cluster = vmmCmd.getClusterName();
+ _cmdLineProperties.put("cluster", _cluster);
- launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource");
-
- // TODO: persist the info in agent.properties for agent restarts
- }
- }
- }
- }
+ _guid = vmmCmd.getGuid();
+ _cmdLineProperties.put("guid", _guid);
+
+ _host = vmmCmd.getManagementServerIP();
+ _port = NumbersUtil.parseInt(vmmCmd.getport(), 8250);
+
+ s_logger.info("Recieved boot strap command from management server with parameters " +
+ " Zone:"+ _zone + " "+
+ " Cluster:"+ _cluster + " "+
+ " pod:"+_pod + " "+
+ " host:"+ _host +" "+
+ " port:"+_port);
+
+ launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource");
+
+ // TODO: persist the info in agent.properties for agent restarts
+ }
+ }
+ }
+ }
private static class ShutdownThread extends Thread {
- VmmAgentShell _shell;
+ VmmAgentShell _shell;
public ShutdownThread(VmmAgentShell shell) {
this._shell = shell;
}
-
+
@Override
public void run() {
_shell.stop();
}
}
-
+
}
\ No newline at end of file
diff --git a/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java b/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java
deleted file mode 100755
index 058aefa9252..00000000000
--- a/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java
+++ /dev/null
@@ -1,76 +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.agent.configuration;
-
-import java.util.List;
-import java.util.Map;
-
-import com.cloud.utils.component.Adapter;
-import com.cloud.utils.component.ComponentLibraryBase;
-import com.cloud.utils.component.ComponentLocator.ComponentInfo;
-import com.cloud.utils.component.Manager;
-import com.cloud.utils.component.PluggableService;
-import com.cloud.utils.db.GenericDao;
-
-public class AgentComponentLibraryBase extends ComponentLibraryBase {
- @Override
- public Map>> getDaos() {
- return null;
- }
-
- @Override
- public Map> getManagers() {
- if (_managers.size() == 0) {
- populateManagers();
- }
- return _managers;
- }
-
- @Override
- public Map>> getAdapters() {
- if (_adapters.size() == 0) {
- populateAdapters();
- }
- return _adapters;
- }
-
- @Override
- public Map, Class>> getFactories() {
- return null;
- }
-
- protected void populateManagers() {
- // addManager("StackMaidManager", StackMaidManagerImpl.class);
- }
-
- protected void populateAdapters() {
-
- }
-
- protected void populateServices() {
-
- }
-
- @Override
- public Map> getPluggableServices() {
- if (_pluggableServices.size() == 0) {
- populateServices();
- }
- return _pluggableServices;
- }
-
-}
diff --git a/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java b/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java
index b94ae83fdc2..2bf26f48642 100755
--- a/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java
+++ b/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java
@@ -127,4 +127,34 @@ public class PropertiesStorage implements StorageComponent {
return true;
}
+ @Override
+ public void setName(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setConfigParams(Map params) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map getConfigParams() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRunLevel() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void setRunLevel(int level) {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java b/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
index 11ea824902b..73a994e8bd9 100644
--- a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
+++ b/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java
@@ -139,4 +139,34 @@ public class FakeDhcpSnooper implements DhcpSnooper {
return null;
}
+ @Override
+ public void setName(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setConfigParams(Map params) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map getConfigParams() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRunLevel() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void setRunLevel(int level) {
+ // TODO Auto-generated method stub
+
+ }
+
}
diff --git a/agent/src/com/cloud/agent/resource/DummyResource.java b/agent/src/com/cloud/agent/resource/DummyResource.java
index 573f639b06d..37a8b3d67e7 100755
--- a/agent/src/com/cloud/agent/resource/DummyResource.java
+++ b/agent/src/com/cloud/agent/resource/DummyResource.java
@@ -224,4 +224,34 @@ public class DummyResource implements ServerResource {
public void setAgentControl(IAgentControl agentControl) {
_agentControl = agentControl;
}
+
+ @Override
+ public void setName(String name) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void setConfigParams(Map params) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Map getConfigParams() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getRunLevel() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public void setRunLevel(int level) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
index 48f507900d6..8a3a271c4f4 100644
--- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
+++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java
@@ -77,7 +77,7 @@ import com.google.gson.Gson;
* server.
*
*/
-public class ConsoleProxyResource extends ServerResourceBase implements
+public abstract class ConsoleProxyResource extends ServerResourceBase implements
ServerResource {
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
diff --git a/agent/test/com/cloud/agent/TestAgentShell.java b/agent/test/com/cloud/agent/TestAgentShell.java
index d7210acbef3..b0f748067d0 100644
--- a/agent/test/com/cloud/agent/TestAgentShell.java
+++ b/agent/test/com/cloud/agent/TestAgentShell.java
@@ -19,24 +19,23 @@ package com.cloud.agent;
import java.io.File;
import java.io.IOException;
+import junit.framework.TestCase;
+
import org.apache.log4j.Logger;
-import com.cloud.agent.AgentShell;
-import com.cloud.utils.testcase.Log4jEnabledTestCase;
-
-public class TestAgentShell extends Log4jEnabledTestCase {
+public class TestAgentShell extends TestCase {
protected final static Logger s_logger = Logger.getLogger(TestAgentShell.class);
-
+
public void testWget() {
File file = null;
try {
file = File.createTempFile("wget", ".html");
- AgentShell.wget("http://www.google.com/", file);
-
+ AgentShell.wget("http://www.apache.org/", file);
+
if (s_logger.isDebugEnabled()) {
s_logger.debug("file saved to " + file.getAbsolutePath());
}
-
+
} catch (final IOException e) {
s_logger.warn("Exception while downloading agent update package, ", e);
}
diff --git a/api/pom.xml b/api/pom.xml
index 7461c67aaa2..8ca258f12e3 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -23,7 +23,7 @@
org.apache.cloudstack
cloudstack
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
new file mode 100644
index 00000000000..f9fb1642b3f
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
@@ -0,0 +1,62 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVMSnapshotAnswer extends Answer {
+
+ private List volumeTOs;
+ private VMSnapshotTO vmSnapshotTo;
+
+
+ public List getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+ public VMSnapshotTO getVmSnapshotTo() {
+ return vmSnapshotTo;
+ }
+
+ public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
+ this.vmSnapshotTo = vmSnapshotTo;
+ }
+
+ public CreateVMSnapshotAnswer() {
+
+ }
+
+ public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
+ String result) {
+ super(cmd, success, result);
+ }
+
+ public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
+ VMSnapshotTO vmSnapshotTo, List volumeTOs) {
+ super(cmd, true, "");
+ this.vmSnapshotTo = vmSnapshotTo;
+ this.volumeTOs = volumeTOs;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
new file mode 100644
index 00000000000..478987d993b
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -0,0 +1,42 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+ public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType, VirtualMachine.State vmState) {
+ super(vmName, snapshot, volumeTOs, guestOSType);
+ this.vmState = vmState;
+ }
+
+ private VirtualMachine.State vmState;
+
+
+ public VirtualMachine.State getVmState() {
+ return vmState;
+ }
+
+ public void setVmState(VirtualMachine.State vmState) {
+ this.vmState = vmState;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
index a19d34436f7..fbf6121f543 100644
--- a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java
@@ -18,6 +18,7 @@ package com.cloud.agent.api;
import com.cloud.storage.StoragePool;
+
/**
* This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
new file mode 100644
index 00000000000..ed3bc62ccba
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
@@ -0,0 +1,54 @@
+// 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.agent.api;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVolumeFromVMSnapshotAnswer extends Answer {
+ private String path;
+ private VolumeTO volumeTo;
+
+ public VolumeTO getVolumeTo() {
+ return volumeTo;
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
+ super(cmd, true, "");
+ this.volumeTo = volumeTo;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ protected CreateVolumeFromVMSnapshotAnswer() {
+
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, String path) {
+ super(cmd, true, "");
+ this.path = path;
+ }
+
+ public CreateVolumeFromVMSnapshotAnswer(
+ CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
+ super(cmd, result, string);
+ }
+}
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
new file mode 100644
index 00000000000..634e15c9f04
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.vm.DiskProfile;
+
+public class CreateVolumeFromVMSnapshotCommand extends Command {
+
+ protected String path;
+ protected String name;
+ protected Boolean fullClone;
+ protected String storagePoolUuid;
+ private StorageFilerTO pool;
+ private DiskProfile diskProfile;
+ private Long volumeId;
+
+ public DiskProfile getDskch() {
+ return diskProfile;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+ protected CreateVolumeFromVMSnapshotCommand() {
+
+ }
+
+ public CreateVolumeFromVMSnapshotCommand(String path, String name,
+ Boolean fullClone, String storagePoolUuid) {
+ this.path = path;
+ this.name = name;
+ this.fullClone = fullClone;
+ this.storagePoolUuid = storagePoolUuid;
+ }
+
+ public CreateVolumeFromVMSnapshotCommand(String path, String name,
+ Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
+ DiskProfile diskProfile, Long volumeId) {
+ this.path = path;
+ this.name = name;
+ this.fullClone = fullClone;
+ this.storagePoolUuid = storagePoolUuid;
+ this.pool = pool;
+ this.diskProfile = diskProfile;
+ this.volumeId = volumeId;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Boolean getFullClone() {
+ return fullClone;
+ }
+
+ public String getStoragePoolUuid() {
+ return storagePoolUuid;
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
new file mode 100644
index 00000000000..8f4ecad3d80
--- /dev/null
+++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
@@ -0,0 +1,49 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class DeleteVMSnapshotAnswer extends Answer {
+ private List volumeTOs;
+
+ public DeleteVMSnapshotAnswer() {
+ }
+
+ public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
+ String message) {
+ super(cmd, result, message);
+ }
+
+ public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
+ List volumeTOs) {
+ super(cmd, true, "");
+ this.volumeTOs = volumeTOs;
+ }
+
+ public List getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+
+}
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
new file mode 100644
index 00000000000..c213448bf9c
--- /dev/null
+++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
@@ -0,0 +1,28 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+
+public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
+ public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) {
+ super( vmName, snapshot, volumeTOs, guestOSType);
+ }
+}
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
new file mode 100644
index 00000000000..848ffc0ebf8
--- /dev/null
+++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
@@ -0,0 +1,63 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class RevertToVMSnapshotAnswer extends Answer {
+
+ private List volumeTOs;
+ private VirtualMachine.State vmState;
+
+ public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
+ String message) {
+ super(cmd, result, message);
+ }
+
+ public RevertToVMSnapshotAnswer() {
+ super();
+ }
+
+ public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
+ List volumeTOs,
+ VirtualMachine.State vmState) {
+ super(cmd, true, "");
+ this.volumeTOs = volumeTOs;
+ this.vmState = vmState;
+ }
+
+ public VirtualMachine.State getVmState() {
+ return vmState;
+ }
+
+ public List getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+ public void setVmState(VirtualMachine.State vmState) {
+ this.vmState = vmState;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
new file mode 100644
index 00000000000..429a186e0dc
--- /dev/null
+++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -0,0 +1,29 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+ public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) {
+ super(vmName, snapshot, volumeTOs, guestOSType);
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
new file mode 100755
index 00000000000..e938de73f0b
--- /dev/null
+++ b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java
@@ -0,0 +1,32 @@
+// 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.agent.api;
+
+/*
+ * This is used to schedule an explicit host scan in MS peers. Currently used during
+ * add host operation so that correct MS can take host ownership. On receiving the
+ * command the scan is scheduled immediately.
+ */
+public class ScheduleHostScanTaskCommand extends Command {
+ public ScheduleHostScanTaskCommand() {
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false; // standalone command and can be executed independent of other commands
+ }
+}
diff --git a/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
new file mode 100644
index 00000000000..2120f2f73b1
--- /dev/null
+++ b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
@@ -0,0 +1,74 @@
+// 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.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class VMSnapshotBaseCommand extends Command{
+ protected List volumeTOs;
+ protected VMSnapshotTO target;
+ protected String vmName;
+ protected String guestOSType;
+
+
+ public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) {
+ this.vmName = vmName;
+ this.target = snapshot;
+ this.volumeTOs = volumeTOs;
+ this.guestOSType = guestOSType;
+ }
+
+ public List getVolumeTOs() {
+ return volumeTOs;
+ }
+
+ public void setVolumeTOs(List volumeTOs) {
+ this.volumeTOs = volumeTOs;
+ }
+
+ public VMSnapshotTO getTarget() {
+ return target;
+ }
+
+ public void setTarget(VMSnapshotTO target) {
+ this.target = target;
+ }
+
+ public String getVmName() {
+ return vmName;
+ }
+
+ public void setVmName(String vmName) {
+ this.vmName = vmName;
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+ public String getGuestOSType() {
+ return guestOSType;
+ }
+
+ public void setGuestOSType(String guestOSType) {
+ this.guestOSType = guestOSType;
+ }
+}
diff --git a/api/src/com/cloud/agent/api/VMSnapshotTO.java b/api/src/com/cloud/agent/api/VMSnapshotTO.java
new file mode 100644
index 00000000000..c7b42d25bc9
--- /dev/null
+++ b/api/src/com/cloud/agent/api/VMSnapshotTO.java
@@ -0,0 +1,90 @@
+// 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.agent.api;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+
+public class VMSnapshotTO {
+ private Long id;
+ private String snapshotName;
+ private VMSnapshot.Type type;
+ private Long createTime;
+ private Boolean current;
+ private String description;
+ private VMSnapshotTO parent;
+
+ public Long getId() {
+ return id;
+ }
+ public void setId(Long id) {
+ this.id = id;
+ }
+ public VMSnapshotTO(Long id, String snapshotName,
+ VMSnapshot.Type type, Long createTime,
+ String description, Boolean current, VMSnapshotTO parent) {
+ super();
+ this.id = id;
+ this.snapshotName = snapshotName;
+ this.type = type;
+ this.createTime = createTime;
+ this.current = current;
+ this.description = description;
+ this.parent = parent;
+ }
+ public VMSnapshotTO() {
+
+ }
+ public String getDescription() {
+ return description;
+ }
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ public Boolean getCurrent() {
+ return current;
+ }
+ public void setCurrent(Boolean current) {
+ this.current = current;
+ }
+ public Long getCreateTime() {
+ return createTime;
+ }
+ public void setCreateTime(Long createTime) {
+ this.createTime = createTime;
+ }
+
+ public VMSnapshot.Type getType() {
+ return type;
+ }
+ public void setType(VMSnapshot.Type type) {
+ this.type = type;
+ }
+
+ public String getSnapshotName() {
+ return snapshotName;
+ }
+ public void setSnapshotName(String snapshotName) {
+ this.snapshotName = snapshotName;
+ }
+ public VMSnapshotTO getParent() {
+ return parent;
+ }
+ public void setParent(VMSnapshotTO parent) {
+ this.parent = parent;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java b/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
index c5af38eb724..3befc2f6bd1 100644
--- a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
+++ b/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java
@@ -17,8 +17,8 @@
package com.cloud.agent.api.proxy;
import com.cloud.agent.api.Command;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
import com.cloud.agent.api.LogLevel;
+import com.cloud.agent.api.LogLevel.Log4jLevel;
public class StartConsoleProxyAgentHttpHandlerCommand extends Command {
@LogLevel(Log4jLevel.Off)
diff --git a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
index 5c2cd582d4c..f0ce70e9a80 100644
--- a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
+++ b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java
@@ -28,7 +28,9 @@ public class DhcpEntryCommand extends NetworkElementCommand {
String defaultRouter;
String staticRoutes;
String defaultDns;
-
+ String vmIp6Address;
+ String ip6Gateway;
+ String duid;
protected DhcpEntryCommand() {
@@ -39,14 +41,15 @@ public class DhcpEntryCommand extends NetworkElementCommand {
return true;
}
- public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName) {
+ public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) {
this.vmMac = vmMac;
this.vmIpAddress = vmIpAddress;
this.vmName = vmName;
+ this.vmIp6Address = vmIp6Address;
}
- public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String dns, String gateway) {
- this(vmMac, vmIpAddress, vmName);
+ public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
+ this(vmMac, vmIpAddress, vmName, vmIp6Address);
this.dns = dns;
this.gateway = gateway;
}
@@ -102,4 +105,28 @@ public class DhcpEntryCommand extends NetworkElementCommand {
public void setDefaultDns(String defaultDns) {
this.defaultDns = defaultDns;
}
+
+ public String getIp6Gateway() {
+ return ip6Gateway;
+ }
+
+ public void setIp6Gateway(String ip6Gateway) {
+ this.ip6Gateway = ip6Gateway;
+ }
+
+ public String getDuid() {
+ return duid;
+ }
+
+ public void setDuid(String duid) {
+ this.duid = duid;
+ }
+
+ public String getVmIp6Address() {
+ return vmIp6Address;
+ }
+
+ public void setVmIp6Address(String ip6Address) {
+ this.vmIp6Address = ip6Address;
+ }
}
diff --git a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
index c80179a0560..d928e0c5b2b 100755
--- a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
+++ b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java
@@ -16,7 +16,6 @@
// under the License.
package com.cloud.agent.api.storage;
-import com.cloud.agent.api.Command;
public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand {
diff --git a/api/src/com/cloud/agent/api/storage/DownloadCommand.java b/api/src/com/cloud/agent/api/storage/DownloadCommand.java
index efb5ecb5256..c6ffe45a9ef 100644
--- a/api/src/com/cloud/agent/api/storage/DownloadCommand.java
+++ b/api/src/com/cloud/agent/api/storage/DownloadCommand.java
@@ -18,11 +18,12 @@ package com.cloud.agent.api.storage;
import java.net.URI;
-import com.cloud.storage.Volume;
-import com.cloud.storage.Storage.ImageFormat;
-import com.cloud.template.VirtualMachineTemplate;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+
public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity {
public static class PasswordAuth {
diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
index 06e95fe4265..a4e2e255001 100644
--- a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
+++ b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java
@@ -19,7 +19,6 @@ package com.cloud.agent.api.storage;
import java.util.Map;
import com.cloud.agent.api.Answer;
-
import com.cloud.storage.template.TemplateInfo;
public class ListTemplateAnswer extends Answer {
diff --git a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
index a2776c2af46..63c5b621c6e 100755
--- a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
+++ b/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java
@@ -16,9 +16,6 @@
// under the License.
package com.cloud.agent.api.storage;
-import com.cloud.agent.api.LogLevel;
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.SwiftTO;
public class ListVolumeCommand extends StorageCommand {
diff --git a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
index b450041597f..8d955bb1c63 100644
--- a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
+++ b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
@@ -16,8 +16,8 @@
// under the License.
package com.cloud.agent.api.storage;
-import com.cloud.storage.Storage.ImageFormat;
import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.StoragePool;
/**
diff --git a/core/src/com/cloud/resource/DiskPreparer.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
similarity index 58%
rename from core/src/com/cloud/resource/DiskPreparer.java
rename to api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
index 77b8f7c1b7f..3434b985aaa 100644
--- a/core/src/com/cloud/resource/DiskPreparer.java
+++ b/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java
@@ -14,29 +14,27 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.resource;
+package com.cloud.agent.api.storage;
-import com.cloud.storage.VolumeVO;
-import com.cloud.template.VirtualMachineTemplate.BootloaderType;
-import com.cloud.utils.component.Adapter;
+import com.cloud.agent.api.Answer;
-/**
- * DiskMounter mounts and unmounts disk for VMs
- * to consume.
- *
- */
-public interface DiskPreparer extends Adapter {
- /**
- * Mounts a volumeVO and returns a path.
- *
- * @param vol
- * @return
- */
- public String mount(String vmName, VolumeVO vol, BootloaderType type);
-
- /**
- * Unmounts
- */
- public boolean unmount(String path);
+public class ResizeVolumeAnswer extends Answer {
+ private long newSize;
+ protected ResizeVolumeAnswer() {
+
+ }
+
+ public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) {
+ super(cmd, result, details);
+ this.newSize = newSize;
+ }
+
+ public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) {
+ super(cmd, result, details);
+ }
+
+ public long getNewSize() {
+ return newSize;
+ }
}
diff --git a/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
new file mode 100644
index 00000000000..82d3ae7b4bb
--- /dev/null
+++ b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java
@@ -0,0 +1,85 @@
+// 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.agent.api.storage;
+
+import com.cloud.agent.api.Command;
+import com.cloud.agent.api.to.StorageFilerTO;
+
+public class ResizeVolumeCommand extends Command {
+ private String path;
+ private StorageFilerTO pool;
+ private String vmInstance;
+ private Long newSize;
+ private Long currentSize;
+ private boolean shrinkOk;
+
+ protected ResizeVolumeCommand() {
+
+ }
+
+ public ResizeVolumeCommand(String path,
+ StorageFilerTO pool,
+ Long currentSize,
+ Long newSize,
+ boolean shrinkOk,
+ String vmInstance)
+ {
+ this.path = path;
+ this.pool = pool;
+ this.vmInstance = vmInstance;
+ this.currentSize = currentSize;
+ this.newSize = newSize;
+ this.shrinkOk = shrinkOk;
+ }
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getPoolUuid() {
+ return pool.getUuid();
+ }
+
+ public StorageFilerTO getPool() {
+ return pool;
+ }
+
+ public long getNewSize() {
+ return newSize;
+ }
+
+ public long getCurrentSize() {
+ return currentSize;
+ }
+
+ public boolean getShrinkOk() {
+ return shrinkOk;
+ }
+
+ public String getInstanceName() {
+ return vmInstance;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean executeInSequence() {
+ return false;
+ }
+
+}
diff --git a/api/src/com/cloud/agent/api/storage/UploadCommand.java b/api/src/com/cloud/agent/api/storage/UploadCommand.java
index 2a7c60a51ff..473bd5b75ac 100644
--- a/api/src/com/cloud/agent/api/storage/UploadCommand.java
+++ b/api/src/com/cloud/agent/api/storage/UploadCommand.java
@@ -16,11 +16,12 @@
// under the License.
package com.cloud.agent.api.storage;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth;
import com.cloud.agent.api.to.TemplateTO;
import com.cloud.storage.Upload.Type;
import com.cloud.template.VirtualMachineTemplate;
-import org.apache.cloudstack.api.InternalIdentity;
public class UploadCommand extends AbstractUploadCommand implements InternalIdentity {
diff --git a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
index 95ac57c3867..7f779365c9e 100644
--- a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
+++ b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java
@@ -19,10 +19,11 @@ package com.cloud.agent.api.to;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.State;
import com.cloud.utils.net.NetUtils;
-import org.apache.cloudstack.api.InternalIdentity;
/**
* FirewallRuleTO transfers a port range for an ip to be opened.
@@ -50,7 +51,7 @@ public class FirewallRuleTO implements InternalIdentity {
FirewallRule.Purpose purpose;
private Integer icmpType;
private Integer icmpCode;
-
+ private FirewallRule.TrafficType trafficType;
protected FirewallRuleTO() {
}
@@ -85,6 +86,7 @@ public class FirewallRuleTO implements InternalIdentity {
this.sourceCidrList = sourceCidr;
this.icmpType = icmpType;
this.icmpCode = icmpCode;
+ this.trafficType = null;
}
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp) {
this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
@@ -94,6 +96,23 @@ public class FirewallRuleTO implements InternalIdentity {
this(rule.getId(),null, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
}
+ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose) {
+ this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
+ }
+
+ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType) {
+ this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
+ this.trafficType = trafficType;
+ }
+
+ public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, boolean revokeState, boolean alreadyAdded) {
+ this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode());
+ }
+
+ public FirewallRule.TrafficType getTrafficType(){
+ return trafficType;
+ }
+
public long getId() {
return id;
}
diff --git a/api/src/com/cloud/agent/api/to/NetworkACLTO.java b/api/src/com/cloud/agent/api/to/NetworkACLTO.java
index 9b1a6296b08..8818e13de4a 100644
--- a/api/src/com/cloud/agent/api/to/NetworkACLTO.java
+++ b/api/src/com/cloud/agent/api/to/NetworkACLTO.java
@@ -20,10 +20,11 @@ package com.cloud.agent.api.to;
import java.util.ArrayList;
import java.util.List;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
-import org.apache.cloudstack.api.InternalIdentity;
public class NetworkACLTO implements InternalIdentity {
diff --git a/api/src/com/cloud/agent/api/to/S3TO.java b/api/src/com/cloud/agent/api/to/S3TO.java
index 879df229c31..d556cb6d05d 100644
--- a/api/src/com/cloud/agent/api/to/S3TO.java
+++ b/api/src/com/cloud/agent/api/to/S3TO.java
@@ -16,10 +16,10 @@
// under the License.
package com.cloud.agent.api.to;
-import com.cloud.utils.S3Utils;
-
import java.util.Date;
+import com.cloud.utils.S3Utils;
+
public final class S3TO implements S3Utils.ClientOptions {
private Long id;
diff --git a/api/src/com/cloud/agent/api/to/TemplateTO.java b/api/src/com/cloud/agent/api/to/TemplateTO.java
index d77b80551f4..45fa57bf35e 100644
--- a/api/src/com/cloud/agent/api/to/TemplateTO.java
+++ b/api/src/com/cloud/agent/api/to/TemplateTO.java
@@ -16,9 +16,10 @@
// under the License.
package com.cloud.agent.api.to;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.template.VirtualMachineTemplate;
-import org.apache.cloudstack.api.InternalIdentity;
public class TemplateTO implements InternalIdentity {
private long id;
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index 8f3f0eb39d6..bdd636e727b 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -28,7 +28,8 @@ public class VirtualMachineTO {
private BootloaderType bootloader;
Type type;
int cpus;
- Integer speed;
+ Integer minSpeed;
+ Integer maxSpeed;
long minRam;
long maxRam;
String hostName;
@@ -47,12 +48,13 @@ public class VirtualMachineTO {
VolumeTO[] disks;
NicTO[] nics;
- public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
+ public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
this.id = id;
this.name = instanceName;
this.type = type;
this.cpus = cpus;
- this.speed = speed;
+ this.minSpeed = minSpeed;
+ this.maxSpeed = maxSpeed;
this.minRam = minRam;
this.maxRam = maxRam;
this.bootloader = bootloader;
@@ -101,10 +103,13 @@ public class VirtualMachineTO {
this.cpus = cpus;
}
- public Integer getSpeed() {
- return speed;
+ public Integer getMinSpeed() {
+ return minSpeed;
}
+ public Integer getMaxSpeed() {
+ return maxSpeed;
+ }
public boolean getLimitCpuUse() {
return limitCpuUse;
}
diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/com/cloud/agent/api/to/VolumeTO.java
index ff739c58f80..4cbe82b357b 100644
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@ -16,10 +16,11 @@
// under the License.
package com.cloud.agent.api.to;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
-import org.apache.cloudstack.api.InternalIdentity;
public class VolumeTO implements InternalIdentity {
protected VolumeTO() {
@@ -123,6 +124,10 @@ public class VolumeTO implements InternalIdentity {
public String getOsType() {
return guestOsType;
}
+
+ public void setPath(String path){
+ this.path = path;
+ }
@Override
public String toString() {
diff --git a/api/src/com/cloud/alert/Alert.java b/api/src/com/cloud/alert/Alert.java
index defd15490e5..050f97f2ef3 100644
--- a/api/src/com/cloud/alert/Alert.java
+++ b/api/src/com/cloud/alert/Alert.java
@@ -16,11 +16,11 @@
// under the License.
package com.cloud.alert;
+import java.util.Date;
+
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.Date;
-
public interface Alert extends Identity, InternalIdentity {
short getType();
String getSubject();
diff --git a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
index 263f023b3e5..2b63c64425d 100644
--- a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
+++ b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java
@@ -16,14 +16,17 @@
// under the License.
package com.cloud.api.commands;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -145,17 +148,17 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
} catch (InsufficientCapacityException ex){
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
if (result != null) {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network");
}
}
@@ -167,7 +170,7 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network");
}
}
diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
index 80269075744..829283e8b9f 100644
--- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
+++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java
@@ -16,11 +16,14 @@
// under the License.
package com.cloud.api.commands;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -84,7 +87,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy console proxy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy");
}
}
}
diff --git a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
index 709da6af30c..3efd4c5abba 100644
--- a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
+++ b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java
@@ -19,12 +19,12 @@ package com.cloud.api.commands;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
+
import com.cloud.storage.snapshot.SnapshotSchedule;
//@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class)
diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index 48a060719c6..e63fcece525 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -20,24 +20,27 @@ import java.util.List;
import javax.naming.NamingException;
+import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
+import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
-import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.offering.*;
+import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
+import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
+import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
-import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
-import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
-import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
-import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
-import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
-import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
-import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
-import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
+import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
@@ -261,6 +264,8 @@ public interface ConfigurationService {
boolean removeLDAP(LDAPRemoveCmd cmd);
+ LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd);
+
/**
* @param offering
* @return
diff --git a/api/src/com/cloud/configuration/Resource.java b/api/src/com/cloud/configuration/Resource.java
index 7f551d6b52c..7614c8a4b43 100644
--- a/api/src/com/cloud/configuration/Resource.java
+++ b/api/src/com/cloud/configuration/Resource.java
@@ -28,7 +28,9 @@ public interface Resource {
template("template", 4, ResourceOwnerType.Account, ResourceOwnerType.Domain),
project("project", 5, ResourceOwnerType.Account, ResourceOwnerType.Domain),
network("network", 6, ResourceOwnerType.Account, ResourceOwnerType.Domain),
- vpc("vpc", 7, ResourceOwnerType.Account, ResourceOwnerType.Domain);
+ vpc("vpc", 7, ResourceOwnerType.Account, ResourceOwnerType.Domain),
+ cpu("cpu", 8, ResourceOwnerType.Account, ResourceOwnerType.Domain),
+ memory("memory", 9, ResourceOwnerType.Account, ResourceOwnerType.Domain);
private String name;
private ResourceOwnerType[] supportedOwners;
diff --git a/api/src/com/cloud/dao/EntityManager.java b/api/src/com/cloud/dao/EntityManager.java
index 4e4b9c293b5..8e6a438d011 100644
--- a/api/src/com/cloud/dao/EntityManager.java
+++ b/api/src/com/cloud/dao/EntityManager.java
@@ -38,6 +38,16 @@ public interface EntityManager {
*/
public T findById(Class entityType, K id);
+ /**
+ * Finds an entity by its id including removed.
+ * @param class of the entity you're trying to find.
+ * @param class of the id that the entity uses.
+ * @param entityType Type of the entity.
+ * @param id id value
+ * @return T if found; null if not.
+ */
+ public T findByIdIncludingRemoved(Class entityType, K id);
+
/**
* Finds a unique entity by uuid string
* @param entity class
@@ -47,6 +57,15 @@ public interface EntityManager {
*/
public T findByUuid(Class entityType, String uuid);
+ /**
+ * Finds a unique entity by uuid string
+ * @param entity class
+ * @param entityType type of entity you're looking for.
+ * @param uuid the unique id
+ * @return T if found, null if not.
+ */
+ public T findByUuidIncludingRemoved(Class entityType, String uuid);
+
/**
* Finds an entity by external id which is always String
* @param entity class
diff --git a/api/src/com/cloud/dc/DataCenter.java b/api/src/com/cloud/dc/DataCenter.java
index 946e9ccb5bd..5f32988da50 100644
--- a/api/src/com/cloud/dc/DataCenter.java
+++ b/api/src/com/cloud/dc/DataCenter.java
@@ -18,11 +18,12 @@ package com.cloud.dc;
import java.util.Map;
-import com.cloud.org.Grouping;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.org.Grouping;
+
/**
*
*/
@@ -36,6 +37,10 @@ public interface DataCenter extends InfrastructureEntity, Grouping, Identity, In
String getDns2();
+ String getIp6Dns1();
+
+ String getIp6Dns2();
+
String getGuestNetworkCidr();
String getName();
diff --git a/api/src/com/cloud/dc/Pod.java b/api/src/com/cloud/dc/Pod.java
index 9da5b7e7836..1cbab36f3bd 100644
--- a/api/src/com/cloud/dc/Pod.java
+++ b/api/src/com/cloud/dc/Pod.java
@@ -16,11 +16,12 @@
// under the License.
package com.cloud.dc;
-import com.cloud.org.Grouping;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.org.Grouping;
+
/**
* Represents one pod in the cloud stack.
*
diff --git a/api/src/com/cloud/dc/Vlan.java b/api/src/com/cloud/dc/Vlan.java
index 0f629ef3cbf..790195f9f3c 100644
--- a/api/src/com/cloud/dc/Vlan.java
+++ b/api/src/com/cloud/dc/Vlan.java
@@ -44,4 +44,9 @@ public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity {
public Long getPhysicalNetworkId();
+ public String getIp6Gateway();
+
+ public String getIp6Cidr();
+
+ public String getIp6Range();
}
diff --git a/api/src/com/cloud/domain/Domain.java b/api/src/com/cloud/domain/Domain.java
index cfed519ada9..f8277c2cd28 100644
--- a/api/src/com/cloud/domain/Domain.java
+++ b/api/src/com/cloud/domain/Domain.java
@@ -18,10 +18,11 @@ package com.cloud.domain;
import java.util.Date;
-import com.cloud.user.OwnedBy;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.user.OwnedBy;
+
/**
* Domain defines the Domain object.
*/
@@ -58,4 +59,8 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
void setState(State state);
String getNetworkDomain();
+
+ public String getUuid();
+
+ int getRegionId();
}
diff --git a/api/src/com/cloud/event/EventCategory.java b/api/src/com/cloud/event/EventCategory.java
new file mode 100644
index 00000000000..cee6529b550
--- /dev/null
+++ b/api/src/com/cloud/event/EventCategory.java
@@ -0,0 +1,55 @@
+/*
+ * 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.event;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class EventCategory {
+ private static List eventCategories = new ArrayList();
+ private String eventCategoryName;
+
+ public EventCategory(String categoryName) {
+ this.eventCategoryName = categoryName;
+ eventCategories.add(this);
+ }
+
+ public String getName() {
+ return eventCategoryName;
+ }
+
+ public static List listAllEventCategories() {
+ return eventCategories;
+ }
+
+ public static EventCategory getEventCategory(String categoryName) {
+ for (EventCategory category : eventCategories) {
+ if (category.getName().equalsIgnoreCase(categoryName)) {
+ return category;
+ }
+ }
+ return null;
+ }
+
+ public static final EventCategory ACTION_EVENT = new EventCategory("ActionEvent");
+ public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent");
+ public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent");
+ public static final EventCategory RESOURCE_STATE_CHANGE_EVENT = new EventCategory("ResourceStateEvent");
+}
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 8c622252d17..0087edca743 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -16,7 +16,41 @@
// under the License.
package com.cloud.event;
+import com.cloud.configuration.Configuration;
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
+import com.cloud.dc.StorageNetworkIpRange;
+import com.cloud.dc.Vlan;
+import com.cloud.domain.Domain;
+import com.cloud.host.Host;
+import com.cloud.network.*;
+import com.cloud.network.as.*;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.StaticNat;
+import com.cloud.network.security.SecurityGroup;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.offering.DiskOffering;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.offering.ServiceOffering;
+import com.cloud.projects.Project;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import com.cloud.vm.VirtualMachine;
+
+import java.util.HashMap;
+import java.util.Map;
+
public class EventTypes {
+
+ //map of Event and corresponding entity for which Event is applicable
+ private static Map entityEventDetails = null;
+
// VM Events
public static final String EVENT_VM_CREATE = "VM.CREATE";
public static final String EVENT_VM_DESTROY = "VM.DESTROY";
@@ -26,6 +60,7 @@ public class EventTypes {
public static final String EVENT_VM_UPDATE = "VM.UPDATE";
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
+ public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY";
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
public static final String EVENT_VM_MOVE = "VM.MOVE";
public static final String EVENT_VM_RESTORE = "VM.RESTORE";
@@ -63,6 +98,11 @@ public class EventTypes {
public static final String EVENT_FIREWALL_OPEN = "FIREWALL.OPEN";
public static final String EVENT_FIREWALL_CLOSE = "FIREWALL.CLOSE";
+ //NIC Events
+ public static final String EVENT_NIC_CREATE = "NIC.CREATE";
+ public static final String EVENT_NIC_DELETE = "NIC.DELETE";
+ public static final String EVENT_NIC_UPDATE = "NIC.UPDATE";
+
// Load Balancers
public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE";
public static final String EVENT_REMOVE_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.FROM.RULE";
@@ -108,6 +148,7 @@ public class EventTypes {
public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT";
public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD";
public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE";
+ public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE";
// Domains
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
@@ -290,6 +331,11 @@ public class EventTypes {
// tag related events
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
+
+ // vm snapshot events
+ public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE";
+ public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE";
+ public static final String EVENT_VM_SNAPSHOT_REVERT = "VMSNAPSHOT.REVERTTO";
// external network device events
public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD";
@@ -312,4 +358,323 @@ public class EventTypes {
public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE";
public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE";
public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE";
+
+
+ public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD";
+ public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE";
+ public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD";
+ public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE";
+
+ static {
+
+ // TODO: need a way to force author adding event types to declare the entity details as well, with out braking
+ // current ActionEvent annotation semantics
+
+ entityEventDetails = new HashMap();
+
+ entityEventDetails.put(EVENT_VM_CREATE, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_DESTROY, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_START, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_STOP, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName());
+ entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName());
+
+ entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_START, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_STOP, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_REBOOT, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class.getName());
+ entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class.getName());
+
+ entityEventDetails.put(EVENT_PROXY_CREATE, "ConsoleProxy");
+ entityEventDetails.put(EVENT_PROXY_DESTROY, "ConsoleProxy");
+ entityEventDetails.put(EVENT_PROXY_START, "ConsoleProxy");
+ entityEventDetails.put(EVENT_PROXY_STOP, "ConsoleProxy");
+ entityEventDetails.put(EVENT_PROXY_REBOOT, "ConsoleProxy");
+ entityEventDetails.put(EVENT_ROUTER_HA, "ConsoleProxy");
+ entityEventDetails.put(EVENT_PROXY_HA, "ConsoleProxy");
+
+ entityEventDetails.put(EVENT_VNC_CONNECT, "VNC");
+ entityEventDetails.put(EVENT_VNC_DISCONNECT, "VNC");
+
+ // Network Events
+ entityEventDetails.put(EVENT_NETWORK_CREATE, Network.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_DELETE, Network.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_UPDATE, Network.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_RESTART, Network.class.getName());
+ entityEventDetails.put(EVENT_NET_IP_ASSIGN, PublicIpAddress.class.getName());
+ entityEventDetails.put(EVENT_NET_IP_RELEASE, PublicIpAddress.class.getName());
+ entityEventDetails.put(EVENT_NET_RULE_ADD, Network.class.getName());
+ entityEventDetails.put(EVENT_NET_RULE_DELETE, Network.class.getName());
+ entityEventDetails.put(EVENT_NET_RULE_MODIFY, Network.class.getName());
+ entityEventDetails.put(EVENT_FIREWALL_OPEN, Network.class.getName());
+ entityEventDetails.put(EVENT_FIREWALL_CLOSE, Network.class.getName());
+
+ // Load Balancers
+ entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class.getName());
+ entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class.getName());
+
+ // Account events
+ entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
+ entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName());
+ entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName());
+ entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName());
+
+ // UserVO Events
+ entityEventDetails.put(EVENT_USER_LOGIN, User.class.getName());
+ entityEventDetails.put(EVENT_USER_LOGOUT, User.class.getName());
+ entityEventDetails.put(EVENT_USER_CREATE, User.class.getName());
+ entityEventDetails.put(EVENT_USER_DELETE, User.class.getName());
+ entityEventDetails.put(EVENT_USER_DISABLE, User.class.getName());
+ entityEventDetails.put(EVENT_USER_UPDATE, User.class.getName());
+ entityEventDetails.put(EVENT_USER_ENABLE, User.class.getName());
+ entityEventDetails.put(EVENT_USER_LOCK, User.class.getName());
+
+ // Template Events
+ entityEventDetails.put(EVENT_TEMPLATE_CREATE, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_DELETE, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_UPDATE, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_START, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_SUCCESS, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_FAILED, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_COPY, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_EXTRACT, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_UPLOAD, VirtualMachineTemplate.class.getName());
+ entityEventDetails.put(EVENT_TEMPLATE_CLEANUP, VirtualMachineTemplate.class.getName());
+
+ // Volume Events
+ entityEventDetails.put(EVENT_VOLUME_CREATE, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_DELETE, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_ATTACH, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_DETACH, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_EXTRACT, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_UPLOAD, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_MIGRATE, Volume.class.getName());
+ entityEventDetails.put(EVENT_VOLUME_RESIZE, Volume.class.getName());
+
+ // Domains
+ entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class.getName());
+ entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class.getName());
+ entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class.getName());
+
+ // Snapshots
+ entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class.getName());
+ entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class.getName());
+ entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, Snapshot.class.getName());
+ entityEventDetails.put(EVENT_SNAPSHOT_POLICY_UPDATE, Snapshot.class.getName());
+ entityEventDetails.put(EVENT_SNAPSHOT_POLICY_DELETE, Snapshot.class.getName());
+
+ // ISO
+ entityEventDetails.put(EVENT_ISO_CREATE, "Iso");
+ entityEventDetails.put(EVENT_ISO_DELETE, "Iso");
+ entityEventDetails.put(EVENT_ISO_COPY, "Iso");
+ entityEventDetails.put(EVENT_ISO_ATTACH, "Iso");
+ entityEventDetails.put(EVENT_ISO_DETACH, "Iso");
+ entityEventDetails.put(EVENT_ISO_EXTRACT, "Iso");
+ entityEventDetails.put(EVENT_ISO_UPLOAD, "Iso");
+
+ // SSVM
+ entityEventDetails.put(EVENT_SSVM_CREATE, "SecondaryStorageVm");
+ entityEventDetails.put(EVENT_SSVM_DESTROY, "SecondaryStorageVm");
+ entityEventDetails.put(EVENT_SSVM_START, "SecondaryStorageVm");
+ entityEventDetails.put(EVENT_SSVM_STOP, "SecondaryStorageVm");
+ entityEventDetails.put(EVENT_SSVM_REBOOT, "SecondaryStorageVm");
+ entityEventDetails.put(EVENT_SSVM_HA, "SecondaryStorageVm");
+
+ // Service Offerings
+ entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class.getName());
+ entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class.getName());
+ entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class.getName());
+
+ // Disk Offerings
+ entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class.getName());
+ entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class.getName());
+ entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class.getName());
+
+ // Network offerings
+ entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class.getName());
+ entityEventDetails.put(EVENT_NETWORK_OFFERING_DELETE, NetworkOffering.class.getName());
+
+ // Pods
+ entityEventDetails.put(EVENT_POD_CREATE, Pod.class.getName());
+ entityEventDetails.put(EVENT_POD_EDIT, Pod.class.getName());
+ entityEventDetails.put(EVENT_POD_DELETE, Pod.class.getName());
+
+ // Zones
+ entityEventDetails.put(EVENT_ZONE_CREATE, DataCenter.class.getName());
+ entityEventDetails.put(EVENT_ZONE_EDIT, DataCenter.class.getName());
+ entityEventDetails.put(EVENT_ZONE_DELETE, DataCenter.class.getName());
+
+ // VLANs/IP ranges
+ entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName());
+ entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE,Vlan.class.getName());
+
+ entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
+ entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
+ entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class.getName());
+
+ // Configuration Table
+ entityEventDetails.put(EVENT_CONFIGURATION_VALUE_EDIT, Configuration.class.getName());
+
+ // Security Groups
+ entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_INGRESS, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_EGRESS, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_CREATE, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_DELETE, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_ASSIGN, SecurityGroup.class.getName());
+ entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class.getName());
+
+ // Host
+ entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName());
+
+ // Maintenance
+ entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName());
+ entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName());
+ entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName());
+ entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName());
+
+ // VPN
+ entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_DESTROY, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_VPN_USER_ADD, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class.getName());
+ entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class.getName());
+
+ // Custom certificates
+ entityEventDetails.put(EVENT_UPLOAD_CUSTOM_CERTIFICATE, "Certificate");
+
+ // OneToOnenat
+ entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class.getName());
+ entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class.getName());
+
+ entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN,Vlan.class.getName());
+ entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE,Vlan.class.getName());
+
+ // Projects
+ entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_UPDATE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_DELETE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_ACTIVATE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_SUSPEND, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_ACCOUNT_ADD, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_INVITATION_UPDATE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_INVITATION_REMOVE, Project.class.getName());
+ entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class.getName());
+
+ // Network as a Service
+ entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE,Network.class.getName());
+
+ // Physical Network Events
+ entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_PHYSICAL_NETWORK_DELETE, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_PHYSICAL_NETWORK_UPDATE, PhysicalNetwork.class.getName());
+
+ // Physical Network Service Provider Events
+ entityEventDetails.put(EVENT_SERVICE_PROVIDER_CREATE, PhysicalNetworkServiceProvider.class.getName());
+ entityEventDetails.put(EVENT_SERVICE_PROVIDER_DELETE, PhysicalNetworkServiceProvider.class.getName());
+ entityEventDetails.put(EVENT_SERVICE_PROVIDER_UPDATE, PhysicalNetworkServiceProvider.class.getName());
+
+ // Physical Network TrafficType Events
+ entityEventDetails.put(EVENT_TRAFFIC_TYPE_CREATE, PhysicalNetworkTrafficType.class.getName());
+ entityEventDetails.put(EVENT_TRAFFIC_TYPE_DELETE, PhysicalNetworkTrafficType.class.getName());
+ entityEventDetails.put(EVENT_TRAFFIC_TYPE_UPDATE, PhysicalNetworkTrafficType.class.getName());
+
+ // external network device events
+ entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_ADD, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_DELETE, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
+
+ // external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
+ entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD, "Nexus1000v");
+ entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE, "Nexus1000v");
+ entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_CONFIGURE, "Nexus1000v");
+ entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, "Nexus1000v");
+ entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, "Nexus1000v");
+
+
+ entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class.getName());
+ entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
+
+ // VPC
+ entityEventDetails.put(EVENT_VPC_CREATE, Vpc.class.getName());
+ entityEventDetails.put(EVENT_VPC_UPDATE, Vpc.class.getName());
+ entityEventDetails.put(EVENT_VPC_DELETE, Vpc.class.getName());
+ entityEventDetails.put(EVENT_VPC_RESTART, Vpc.class.getName());
+
+ // VPC offerings
+ entityEventDetails.put(EVENT_VPC_OFFERING_CREATE, Vpc.class.getName());
+ entityEventDetails.put(EVENT_VPC_OFFERING_UPDATE, Vpc.class.getName());
+ entityEventDetails.put(EVENT_VPC_OFFERING_DELETE, Vpc.class.getName());
+
+ // Private gateway
+ entityEventDetails.put(EVENT_PRIVATE_GATEWAY_CREATE, PrivateGateway.class.getName());
+ entityEventDetails.put(EVENT_PRIVATE_GATEWAY_DELETE, PrivateGateway.class.getName());
+
+ // Static routes
+ entityEventDetails.put(EVENT_STATIC_ROUTE_CREATE, StaticRoute.class.getName());
+ entityEventDetails.put(EVENT_STATIC_ROUTE_DELETE, StaticRoute.class.getName());
+
+ // tag related events
+ entityEventDetails.put(EVENT_TAGS_CREATE, "Tag");
+ entityEventDetails.put(EVENT_TAGS_DELETE, "tag");
+
+ // external network device events
+ entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController");
+ entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_DELETE, "NvpController");
+ entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController");
+
+ // AutoScale
+ entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class.getName());
+ entityEventDetails.put(EVENT_COUNTER_DELETE, AutoScaleCounter.class.getName());
+ entityEventDetails.put(EVENT_CONDITION_CREATE, Condition.class.getName());
+ entityEventDetails.put(EVENT_CONDITION_DELETE, Condition.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEPOLICY_CREATE, AutoScalePolicy.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEPOLICY_UPDATE, AutoScalePolicy.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEPOLICY_DELETE, AutoScalePolicy.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_CREATE, AutoScaleVmProfile.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_DELETE, AutoScaleVmProfile.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_UPDATE, AutoScaleVmProfile.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_CREATE, AutoScaleVmGroup.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DELETE, AutoScaleVmGroup.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
+ entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
+ }
+
+ public static String getEntityForEvent (String eventName) {
+ String entityClassName = entityEventDetails.get(eventName);
+ if (entityClassName == null || entityClassName.isEmpty()) {
+ return null;
+ }
+ int index = entityClassName.lastIndexOf(".");
+ String entityName = entityClassName;
+ if (index != -1) {
+ entityName = entityClassName.substring(index+1);
+ }
+ return entityName;
+ }
}
diff --git a/api/src/com/cloud/exception/CloudException.java b/api/src/com/cloud/exception/CloudException.java
index 036cb1b8adc..0b71ce89a92 100644
--- a/api/src/com/cloud/exception/CloudException.java
+++ b/api/src/com/cloud/exception/CloudException.java
@@ -17,6 +17,7 @@
package com.cloud.exception;
import java.util.ArrayList;
+
import com.cloud.utils.exception.CSExceptionErrorCode;
/**
@@ -54,7 +55,6 @@ public class CloudException extends Exception {
return;
}
-
public ArrayList getIdProxyList() {
return idList;
}
diff --git a/api/src/com/cloud/exception/PermissionDeniedException.java b/api/src/com/cloud/exception/PermissionDeniedException.java
index 638b762d4c4..b95d49b662a 100644
--- a/api/src/com/cloud/exception/PermissionDeniedException.java
+++ b/api/src/com/cloud/exception/PermissionDeniedException.java
@@ -19,6 +19,7 @@ package com.cloud.exception;
import java.util.List;
import org.apache.cloudstack.acl.ControlledEntity;
+
import com.cloud.user.Account;
import com.cloud.utils.SerialVersionUID;
import com.cloud.utils.exception.CloudRuntimeException;
diff --git a/api/src/com/cloud/exception/RequestLimitException.java b/api/src/com/cloud/exception/RequestLimitException.java
new file mode 100644
index 00000000000..ebaac802649
--- /dev/null
+++ b/api/src/com/cloud/exception/RequestLimitException.java
@@ -0,0 +1,42 @@
+// 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.exception;
+
+import com.cloud.utils.SerialVersionUID;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+/**
+ * Exception thrown if number of requests is over api rate limit set.
+ *
+ */
+public class RequestLimitException extends CloudRuntimeException {
+
+ private static final long serialVersionUID = SerialVersionUID.AccountLimitException;
+
+ protected RequestLimitException() {
+ super();
+ }
+
+ public RequestLimitException(String msg) {
+ super(msg);
+ }
+
+ public RequestLimitException(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+}
diff --git a/api/src/com/cloud/host/Host.java b/api/src/com/cloud/host/Host.java
index bd26f81c8c2..17b0ba86f7f 100755
--- a/api/src/com/cloud/host/Host.java
+++ b/api/src/com/cloud/host/Host.java
@@ -18,11 +18,12 @@ package com.cloud.host;
import java.util.Date;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.resource.ResourceState;
import com.cloud.utils.fsm.StateObject;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
/**
@@ -39,6 +40,8 @@ public interface Host extends StateObject, Identity, InternalIdentity {
ExternalLoadBalancer(false),
ExternalVirtualSwitchSupervisor(false),
PxeServer(false),
+ BaremetalPxe(false),
+ BaremetalDhcp(false),
TrafficMonitor(false),
ExternalDhcp(false),
diff --git a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
index efb8a6a208b..aff81b0018d 100644
--- a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
+++ b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
@@ -16,10 +16,11 @@
// under the License.
package com.cloud.hypervisor;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+
/**
* HypervisorCapability represents one particular hypervisor version's capabilities.
@@ -45,4 +46,10 @@ public interface HypervisorCapabilities extends Identity, InternalIdentity{
* @return the max. data volumes per VM supported by hypervisor
*/
Integer getMaxDataVolumesLimit();
+
+ /**
+ * @return the max. hosts per cluster supported by hypervisor
+ */
+ Integer getMaxHostsPerCluster();
+
}
diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java
index 0ac7f500e2c..47df4d6523b 100644
--- a/api/src/com/cloud/network/IpAddress.java
+++ b/api/src/com/cloud/network/IpAddress.java
@@ -19,10 +19,11 @@ package com.cloud.network;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
-import com.cloud.utils.net.Ip;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.utils.net.Ip;
+
/**
*
* - Allocated = null
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 09d3a6a82bf..fa36d27806b 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -16,24 +16,36 @@
// under the License.
package com.cloud.network;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
-import com.cloud.utils.fsm.FiniteState;
-import com.cloud.utils.fsm.StateMachine;
+import com.cloud.network.Networks.BroadcastDomainType;
+import com.cloud.network.Networks.Mode;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
-import java.util.Set;
/**
* owned by an account.
*/
-public interface Network extends ControlledEntity, InternalIdentity, Identity {
+public interface Network extends ControlledEntity, StateObject, InternalIdentity, Identity {
public enum GuestType {
Shared,
@@ -48,7 +60,7 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification);
public static final Service Gateway = new Service("Gateway");
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols,
- Capability.MultipleIps, Capability.TrafficStatistics);
+ Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation,
Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps,
Capability.SupportedStickinessMethods, Capability.ElasticLb);
@@ -123,10 +135,12 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
public static final Provider None = new Provider("None", false);
- public static final Provider NiciraNvp = new Provider("NiciraNvp", true);
+ // NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
+ public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", true);
+ public static final Provider VPCNetscaler = new Provider("VPCNetscaler", true);
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
-
+
private String name;
private boolean isExternal;
@@ -174,6 +188,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
public static final Capability ElasticLb = new Capability("ElasticLb");
public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters");
public static final Capability InlineMode = new Capability("InlineMode");
+ public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection");
+ public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols");
private String name;
@@ -203,7 +219,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
OperationFailed;
}
- enum State implements FiniteState {
+ public enum State {
+
Allocated("Indicates the network configuration is in allocated but not setup"),
Setup("Indicates the network configuration is setup"),
Implementing("Indicates the network configuration is being implemented"),
@@ -211,39 +228,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
Shutdown("Indicates the network configuration is being destroyed"),
Destroy("Indicates that the network is destroyed");
+ protected static final StateMachine2 s_fsm = new StateMachine2();
- @Override
- public StateMachine getStateMachine() {
- return s_fsm;
- }
-
- @Override
- public State getNextState(Event event) {
- return s_fsm.getNextState(this, event);
- }
-
- @Override
- public List getFromStates(Event event) {
- return s_fsm.getFromStates(this, event);
- }
-
- @Override
- public Set getPossibleEvents() {
- return s_fsm.getPossibleEvents(this);
- }
-
- String _description;
-
- @Override
- public String getDescription() {
- return _description;
- }
-
- private State(String description) {
- _description = description;
- }
-
- private static StateMachine s_fsm = new StateMachine();
static {
s_fsm.addTransition(State.Allocated, Event.ImplementNetwork, State.Implementing);
s_fsm.addTransition(State.Implementing, Event.OperationSucceeded, State.Implemented);
@@ -252,8 +238,43 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented);
}
+
+ public static StateMachine2 getStateMachine() {
+ return s_fsm;
+ }
+
+ String _description;
+ private State(String description) {
+ _description = description;
+ }
}
+ public class IpAddresses {
+ private String ip4Address;
+ private String ip6Address;
+
+ public IpAddresses(String ip4Address, String ip6Address) {
+ this.setIp4Address(ip4Address);
+ this.setIp6Address(ip6Address);
+ }
+
+ public String getIp4Address() {
+ return ip4Address;
+ }
+
+ public void setIp4Address(String ip4Address) {
+ this.ip4Address = ip4Address;
+ }
+
+ public String getIp6Address() {
+ return ip6Address;
+ }
+
+ public void setIp6Address(String ip6Address) {
+ this.ip6Address = ip6Address;
+ }
+ }
+
String getName();
Mode getMode();
@@ -264,8 +285,21 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
String getGateway();
+ // "cidr" is the Cloudstack managed address space, all CloudStack managed vms get IP address from "cidr",
+ // In general "cidr" also serves as the network CIDR
+ // But in case IP reservation is configured for a Guest network, "networkcidr" is the Effective network CIDR for that network,
+ // "cidr" will still continue to be the effective address space for CloudStack managed vms in that Guest network
String getCidr();
+ // "networkcidr" is the network CIDR of the guest network which uses IP reservation.
+ // It is the summation of "cidr" and the reservedIPrange(the address space used for non CloudStack purposes).
+ // For networks not configured with IP reservation, "networkcidr" is always null
+ String getNetworkCidr();
+
+ String getIp6Gateway();
+
+ String getIp6Cidr();
+
long getDataCenterId();
long getNetworkOfferingId();
@@ -288,6 +322,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity {
void setPhysicalNetworkId(Long physicalNetworkId);
+ public void setTrafficType(TrafficType type);
+
ACLType getAclType();
boolean isRestartRequired();
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
new file mode 100644
index 00000000000..9731a61667d
--- /dev/null
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -0,0 +1,260 @@
+// 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.network;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import com.cloud.dc.Vlan;
+import com.cloud.exception.InsufficientAddressCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.Provider;
+import com.cloud.network.Network.Service;
+import com.cloud.network.Networks.TrafficType;
+import com.cloud.network.element.NetworkElement;
+import com.cloud.network.element.UserDataServiceProvider;
+import com.cloud.offering.NetworkOffering;
+import com.cloud.user.Account;
+import com.cloud.vm.Nic;
+import com.cloud.vm.NicProfile;
+import com.cloud.vm.VirtualMachine;
+
+
+/**
+ * The NetworkModel presents a read-only view into the Network data such as L2 networks,
+ * Nics, PublicIps, NetworkOfferings, traffic labels, physical networks and the like
+ * The idea is that only the orchestration core should be able to modify the data, while other
+ * participants in the orchestration can use this interface to query the data.
+ */
+public interface NetworkModel {
+
+ /**
+ * Lists IP addresses that belong to VirtualNetwork VLANs
+ *
+ * @param accountId
+ * - account that the IP address should belong to
+ * @param associatedNetworkId
+ * TODO
+ * @param sourceNat
+ * - (optional) true if the IP address should be a source NAT address
+ * @return - list of IP addresses
+ */
+ List extends IpAddress> listPublicIpsAssignedToGuestNtwk(long accountId, long associatedNetworkId, Boolean sourceNat);
+
+ List extends NetworkOffering> getSystemAccountNetworkOfferings(String... offeringNames);
+
+ List extends Nic> getNics(long vmId);
+
+ String getNextAvailableMacAddressInNetwork(long networkConfigurationId) throws InsufficientAddressCapacityException;
+
+ PublicIpAddress getPublicIpAddress(long ipAddressId);
+
+ List extends Vlan> listPodVlans(long podId);
+
+ List extends Network> listNetworksUsedByVm(long vmId, boolean isSystem);
+
+ Nic getNicInNetwork(long vmId, long networkId);
+
+ List extends Nic> getNicsForTraffic(long vmId, TrafficType type);
+
+ Network getDefaultNetworkForVm(long vmId);
+
+ Nic getDefaultNic(long vmId);
+
+ UserDataServiceProvider getUserDataUpdateProvider(Network network);
+
+ boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId);
+
+ Map getNetworkServiceCapabilities(long networkId, Service service);
+
+ boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services);
+
+ Network getNetworkWithSecurityGroupEnabled(Long zoneId);
+
+ String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId);
+
+ List extends Network> listNetworksForAccount(long accountId, long zoneId, Network.GuestType type);
+
+ List extends Network> listAllNetworksInAllZonesByType(Network.GuestType type);
+
+ String getGlobalGuestDomainSuffix();
+
+ String getStartIpAddress(long networkId);
+
+ String getIpInNetwork(long vmId, long networkId);
+
+ String getIpInNetworkIncludingRemoved(long vmId, long networkId);
+
+ Long getPodIdForVlan(long vlanDbId);
+
+ List listNetworkOfferingsForUpgrade(long networkId);
+
+ boolean isSecurityGroupSupportedInNetwork(Network network);
+
+ boolean isProviderSupportServiceInNetwork(long networkId, Service service, Provider provider);
+
+ boolean isProviderEnabledInPhysicalNetwork(long physicalNetowrkId, String providerName);
+
+ String getNetworkTag(HypervisorType hType, Network network);
+
+ List getElementServices(Provider provider);
+
+ boolean canElementEnableIndividualServices(Provider provider);
+
+ boolean areServicesSupportedInNetwork(long networkId, Service... services);
+
+ boolean isNetworkSystem(Network network);
+
+ Map getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service);
+
+ Long getPhysicalNetworkId(Network network);
+
+ boolean getAllowSubdomainAccessGlobal();
+
+ boolean isProviderForNetwork(Provider provider, long networkId);
+
+ boolean isProviderForNetworkOffering(Provider provider, long networkOfferingId);
+
+ void canProviderSupportServices(Map> providersMap);
+
+ List getPhysicalNetworkInfo(long dcId, HypervisorType hypervisorType);
+
+ boolean canAddDefaultSecurityGroup();
+
+ List listNetworkOfferingServices(long networkOfferingId);
+
+ boolean areServicesEnabledInZone(long zoneId, NetworkOffering offering, List services);
+
+ Map> getIpToServices(List extends PublicIpAddress> publicIps, boolean rulesRevoked,
+ boolean includingFirewall);
+
+ Map> getProviderToIpList(Network network, Map> ipToServices);
+
+ boolean checkIpForService(IpAddress ip, Service service, Long networkId);
+
+ void checkCapabilityForProvider(Set providers, Service service, Capability cap, String capValue);
+
+ Provider getDefaultUniqueProviderForService(String serviceName);
+
+ void checkNetworkPermissions(Account owner, Network network);
+
+ String getDefaultManagementTrafficLabel(long zoneId, HypervisorType hypervisorType);
+
+ String getDefaultStorageTrafficLabel(long zoneId, HypervisorType hypervisorType);
+
+ String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware);
+
+ String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware);
+
+ /**
+ * @param providerName
+ * @return
+ */
+ NetworkElement getElementImplementingProvider(String providerName);
+
+ /**
+ * @param accountId
+ * @param zoneId
+ * @return
+ */
+ String getAccountNetworkDomain(long accountId, long zoneId);
+
+ /**
+ * @return
+ */
+ String getDefaultNetworkDomain();
+
+ /**
+ * @param ntwkOffId
+ * @return
+ */
+ List getNtwkOffDistinctProviders(long ntwkOffId);
+
+ /**
+ * @param accountId
+ * @param dcId
+ * @param sourceNat
+ * @return
+ */
+ List extends IpAddress> listPublicIpsAssignedToAccount(long accountId, long dcId, Boolean sourceNat);
+
+ /**
+ * @param zoneId
+ * @param trafficType
+ * @return
+ */
+ List extends PhysicalNetwork> getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType);
+
+ /**
+ * @param guestNic
+ * @return
+ */
+ boolean isPrivateGateway(Nic guestNic);
+
+ Map> getNetworkCapabilities(long networkId);
+
+ Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
+
+ Long getDedicatedNetworkDomain(long networkId);
+
+ Map> getNetworkOfferingServiceProvidersMap(long networkOfferingId);
+
+ List extends Provider> listSupportedNetworkServiceProviders(String serviceName);
+
+ List extends Network> listNetworksByVpc(long vpcId);
+
+ boolean canUseForDeploy(Network network);
+
+ Network getExclusiveGuestNetwork(long zoneId);
+
+ long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType);
+
+ Integer getNetworkRate(long networkId, Long vmId);
+
+ boolean isVmPartOfNetwork(long vmId, long ntwkId);
+
+ PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
+
+ Network getNetwork(long networkId);
+
+ IpAddress getIp(long sourceIpAddressId);
+
+ boolean isNetworkAvailableInDomain(long networkId, long domainId);
+
+ NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri);
+
+ Set getAvailableIps(Network network, String requestedIp);
+
+ String getDomainNetworkDomain(long domainId, long zoneId);
+
+ PublicIpAddress getSourceNatIpAddressForGuestNetwork(Account owner, Network guestNetwork);
+
+ boolean isNetworkInlineMode(Network network);
+
+ boolean isIP6AddressAvailableInNetwork(long networkId);
+
+ boolean isIP6AddressAvailableInVlan(long vlanId);
+
+ void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
+
+ void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
+}
\ No newline at end of file
diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/com/cloud/network/NetworkProfile.java
index b5c463de375..2f56645139c 100644
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@ -21,7 +21,6 @@ import java.net.URI;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
-import org.apache.cloudstack.api.InternalIdentity;
public class NetworkProfile implements Network {
private long id;
@@ -39,6 +38,9 @@ public class NetworkProfile implements Network {
private TrafficType trafficType;
private String gateway;
private String cidr;
+ private String networkCidr;
+ private String ip6Gateway;
+ private String ip6Cidr;
private long networkOfferingId;
private long related;
private String displayText;
@@ -64,6 +66,9 @@ public class NetworkProfile implements Network {
this.trafficType = network.getTrafficType();
this.gateway = network.getGateway();
this.cidr = network.getCidr();
+ this.networkCidr = network.getNetworkCidr();
+ this.ip6Gateway = network.getIp6Gateway();
+ this.ip6Cidr = network.getIp6Cidr();
this.networkOfferingId = network.getNetworkOfferingId();
this.related = network.getRelated();
this.displayText = network.getDisplayText();
@@ -159,6 +164,11 @@ public class NetworkProfile implements Network {
return cidr;
}
+ @Override
+ public String getNetworkCidr() {
+ return networkCidr;
+ }
+
@Override
public long getNetworkOfferingId() {
return networkOfferingId;
@@ -226,4 +236,18 @@ public class NetworkProfile implements Network {
return vpcId;
}
+ @Override
+ public void setTrafficType(TrafficType type) {
+ this.trafficType = type;
+ }
+
+ @Override
+ public String getIp6Gateway() {
+ return ip6Gateway;
+ }
+
+ @Override
+ public String getIp6Cidr() {
+ return ip6Cidr;
+ }
}
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index b3332a345b3..95bcc42b17a 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -17,26 +17,28 @@
package com.cloud.network;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
-import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
+import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network.Capability;
-import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.Pair;
+/**
+ * The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
+ * Such entities are usually the admin and end-user API.
+ *
+ */
public interface NetworkService {
List extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
@@ -64,24 +66,10 @@ public interface NetworkService {
IpAddress getIp(long id);
- NetworkProfile convertNetworkToNetworkProfile(long networkId);
-
- Map> getNetworkCapabilities(long networkId);
-
- boolean isNetworkAvailableInDomain(long networkId, long domainId);
-
- Long getDedicatedNetworkDomain(long networkId);
-
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
- String domainSuffix, Long networkOfferingId, Boolean changeCidr);
+ String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr);
- Integer getNetworkRate(long networkId, Long vmId);
-
- Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
-
- Map> getNetworkOfferingServiceProvidersMap(long networkOfferingId);
-
- PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
+ PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
List isolationMethods, String broadcastDomainRange, Long domainId, List tags, String name);
Pair, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword,
@@ -94,8 +82,6 @@ public interface NetworkService {
List extends Service> listNetworkServices(String providerName);
- List extends Provider> listSupportedNetworkServiceProviders(String serviceName);
-
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName,
Long destinationPhysicalNetworkId, List enabledServices);
@@ -127,17 +113,14 @@ public interface NetworkService {
Pair, Integer> listTrafficTypes(Long physicalNetworkId);
- PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
Network getExclusiveGuestNetwork(long zoneId);
List> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd);
List extends Network> getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner);
-
- List extends Network> listNetworksByVpc(long vpcId);
-
- boolean isVmPartOfNetwork(long vmId, long ntwkId);
+
+
/**
* @param networkId
@@ -170,9 +153,5 @@ public interface NetworkService {
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
- /**
- * @param network
- * @return
- */
- boolean canUseForDeploy(Network network);
+
}
diff --git a/api/src/com/cloud/network/NetworkUsageService.java b/api/src/com/cloud/network/NetworkUsageService.java
new file mode 100644
index 00000000000..1cfea24d05a
--- /dev/null
+++ b/api/src/com/cloud/network/NetworkUsageService.java
@@ -0,0 +1,37 @@
+// 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.network;
+
+import java.util.List;
+
+import com.cloud.host.Host;
+
+import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd;
+import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficMonitorCmd;
+import org.apache.cloudstack.api.command.admin.usage.ListTrafficMonitorsCmd;
+import org.apache.cloudstack.api.response.TrafficMonitorResponse;
+import com.cloud.utils.component.Manager;
+
+public interface NetworkUsageService extends Manager {
+
+ Host addTrafficMonitor(AddTrafficMonitorCmd cmd);
+
+ boolean deleteTrafficMonitor(DeleteTrafficMonitorCmd cmd);
+
+ List extends Host> listTrafficMonitors(ListTrafficMonitorsCmd cmd);
+
+}
diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java
index b15661910b4..e3d21584ad8 100755
--- a/api/src/com/cloud/network/Networks.java
+++ b/api/src/com/cloud/network/Networks.java
@@ -48,7 +48,7 @@ public class Networks {
public enum AddressFormat {
Ip4,
Ip6,
- Mixed
+ DualStack
}
/**
diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java
index a495092879e..343a2b14e33 100644
--- a/api/src/com/cloud/network/PhysicalNetwork.java
+++ b/api/src/com/cloud/network/PhysicalNetwork.java
@@ -16,11 +16,11 @@
// under the License.
package com.cloud.network;
+import java.util.List;
+
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.List;
-
/**
*
*/
@@ -35,7 +35,8 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
VLAN,
L3,
GRE,
- STT;
+ STT,
+ VNS;
}
public enum BroadcastDomainRange {
diff --git a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
index 0a433dcbc05..d67c3c7b1ee 100644
--- a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
+++ b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java
@@ -18,9 +18,10 @@ package com.cloud.network;
import java.util.List;
-import com.cloud.network.Network.Service;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.network.Network.Service;
+
/**
*
*/
diff --git a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java
index 62400e80a9e..a385b533af8 100644
--- a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java
+++ b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java
@@ -16,10 +16,11 @@
// under the License.
package com.cloud.network;
-import com.cloud.network.Networks.TrafficType;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.network.Networks.TrafficType;
+
/**
*
*/
diff --git a/api/src/com/cloud/network/PublicIpAddress.java b/api/src/com/cloud/network/PublicIpAddress.java
index 21dae54202a..d81e9c1ee6c 100644
--- a/api/src/com/cloud/network/PublicIpAddress.java
+++ b/api/src/com/cloud/network/PublicIpAddress.java
@@ -17,9 +17,10 @@
package com.cloud.network;
import org.apache.cloudstack.acl.ControlledEntity;
-import com.cloud.dc.Vlan;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.dc.Vlan;
+
/**
*/
public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, InternalIdentity {
diff --git a/api/src/com/cloud/network/StorageNetworkService.java b/api/src/com/cloud/network/StorageNetworkService.java
index 1bda247179c..5aae0ca9688 100755
--- a/api/src/com/cloud/network/StorageNetworkService.java
+++ b/api/src/com/cloud/network/StorageNetworkService.java
@@ -19,11 +19,12 @@ package com.cloud.network;
import java.sql.SQLException;
import java.util.List;
-import org.apache.cloudstack.api.command.admin.network.*;
-import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
-import com.cloud.dc.StorageNetworkIpRange;
import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.ListStorageNetworkIpRangeCmd;
+import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd;
+
+import com.cloud.dc.StorageNetworkIpRange;
public interface StorageNetworkService {
StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException;
diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java
index 7b553b29a7f..250ecb24e91 100644
--- a/api/src/com/cloud/network/VirtualNetworkApplianceService.java
+++ b/api/src/com/cloud/network/VirtualNetworkApplianceService.java
@@ -17,6 +17,7 @@
package com.cloud.network;
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/as/AutoScaleService.java b/api/src/com/cloud/network/as/AutoScaleService.java
index daa8d191366..32d693d7b8a 100644
--- a/api/src/com/cloud/network/as/AutoScaleService.java
+++ b/api/src/com/cloud/network/as/AutoScaleService.java
@@ -19,11 +19,19 @@ package com.cloud.network.as;
import java.util.List;
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
-import org.apache.cloudstack.api.command.user.autoscale.*;
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd;
+import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd;
import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd;
+import org.apache.cloudstack.api.command.user.autoscale.CreateConditionCmd;
import org.apache.cloudstack.api.command.user.autoscale.ListAutoScalePoliciesCmd;
+import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd;
+import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd;
+import org.apache.cloudstack.api.command.user.autoscale.ListConditionsCmd;
+import org.apache.cloudstack.api.command.user.autoscale.ListCountersCmd;
+import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd;
import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd;
+import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd;
+
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
index 3be5a3e8124..9c6a0f2f45a 100644
--- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java
+++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java
@@ -20,9 +20,10 @@ package com.cloud.network.as;
import java.util.List;
import org.apache.cloudstack.acl.ControlledEntity;
-import com.cloud.utils.Pair;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.utils.Pair;
+
/**
* AutoScaleVmProfile
*/
diff --git a/api/src/com/cloud/network/element/IpDeployer.java b/api/src/com/cloud/network/element/IpDeployer.java
index 55b21abe9ab..c92d3e3cf2d 100644
--- a/api/src/com/cloud/network/element/IpDeployer.java
+++ b/api/src/com/cloud/network/element/IpDeployer.java
@@ -24,8 +24,9 @@ import com.cloud.network.Network;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.PublicIpAddress;
+import com.cloud.utils.component.Adapter;
-public interface IpDeployer {
+public interface IpDeployer extends Adapter{
/**
* Apply ip addresses to this network
* @param network
diff --git a/api/src/com/cloud/network/element/NetworkElement.java b/api/src/com/cloud/network/element/NetworkElement.java
index 1ddd60b27de..d89c2a3c403 100644
--- a/api/src/com/cloud/network/element/NetworkElement.java
+++ b/api/src/com/cloud/network/element/NetworkElement.java
@@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.element;
-import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -45,19 +44,19 @@ public interface NetworkElement extends Adapter {
Map> getCapabilities();
/**
- * NOTE:
+ * NOTE:
* NetworkElement -> Network.Provider is a one-to-one mapping. While adding a new NetworkElement, one must add a new Provider name to Network.Provider.
*/
Provider getProvider();
/**
- * Implement the network configuration as specified.
+ * Implement the network configuration as specified.
* @param config fully specified network configuration.
* @param offering network offering that originated the network configuration.
* @return true if network configuration is now usable; false if not; null if not handled by this element.
* @throws InsufficientNetworkCapacityException TODO
*/
- boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
+ boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
/**
@@ -72,8 +71,8 @@ public interface NetworkElement extends Adapter {
* @throws ResourceUnavailableException
* @throws InsufficientNetworkCapacityException
*/
- boolean prepare(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm,
- DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
+ boolean prepare(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm,
+ DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;
/**
@@ -86,7 +85,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
- boolean release(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm,
+ boolean release(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm,
ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
/**
@@ -98,7 +97,7 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
- boolean shutdown(Network network, ReservationContext context, boolean cleanup)
+ boolean shutdown(Network network, ReservationContext context, boolean cleanup)
throws ConcurrentOperationException, ResourceUnavailableException;
/**
@@ -125,11 +124,11 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
- boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context)
+ boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context)
throws ConcurrentOperationException, ResourceUnavailableException;
/**
- * This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false.
+ * This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false.
* @return true/false
*/
boolean canEnableIndividualServices();
diff --git a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
index 4625d22f6a5..4950ed92cab 100644
--- a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
+++ b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java
@@ -22,8 +22,9 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.VpnUser;
+import com.cloud.utils.component.Adapter;
-public interface RemoteAccessVPNServiceProvider extends NetworkElement, IpDeployingRequester {
+public interface RemoteAccessVPNServiceProvider extends Adapter {
String[] applyVpnUsers(RemoteAccessVpn vpn, List extends VpnUser> users) throws ResourceUnavailableException;
boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java
index a61273a8159..dd451324a72 100644
--- a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java
+++ b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java
@@ -17,10 +17,10 @@
package com.cloud.network.element;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.Network;
import com.cloud.network.Site2SiteVpnConnection;
+import com.cloud.utils.component.Adapter;
-public interface Site2SiteVpnServiceProvider extends NetworkElement {
+public interface Site2SiteVpnServiceProvider extends Adapter {
boolean startSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
boolean stopSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/element/UserDataServiceProvider.java b/api/src/com/cloud/network/element/UserDataServiceProvider.java
index 321ccc7d456..d9ddf9329ff 100644
--- a/api/src/com/cloud/network/element/UserDataServiceProvider.java
+++ b/api/src/com/cloud/network/element/UserDataServiceProvider.java
@@ -30,4 +30,5 @@ public interface UserDataServiceProvider extends NetworkElement {
public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm) throws ResourceUnavailableException;
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm) throws ResourceUnavailableException;
+ boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile extends VirtualMachine> vm, String SSHPublicKey) throws ResourceUnavailableException;
}
diff --git a/api/src/com/cloud/network/element/VirtualRouterElementService.java b/api/src/com/cloud/network/element/VirtualRouterElementService.java
index 3ba2045cfd6..ea971b89c5d 100644
--- a/api/src/com/cloud/network/element/VirtualRouterElementService.java
+++ b/api/src/com/cloud/network/element/VirtualRouterElementService.java
@@ -20,6 +20,7 @@ import java.util.List;
import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd;
import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd;
+
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType;
import com.cloud.utils.component.PluggableService;
diff --git a/api/src/com/cloud/network/element/VpcProvider.java b/api/src/com/cloud/network/element/VpcProvider.java
index 482fe6245a7..81b1cf321db 100644
--- a/api/src/com/cloud/network/element/VpcProvider.java
+++ b/api/src/com/cloud/network/element/VpcProvider.java
@@ -27,7 +27,6 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.StaticRouteProfile;
import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcGateway;
import com.cloud.vm.ReservationContext;
public interface VpcProvider extends NetworkElement{
diff --git a/api/src/com/cloud/network/firewall/FirewallService.java b/api/src/com/cloud/network/firewall/FirewallService.java
index 3858499b2bb..179e9f7ae22 100644
--- a/api/src/com/cloud/network/firewall/FirewallService.java
+++ b/api/src/com/cloud/network/firewall/FirewallService.java
@@ -20,6 +20,7 @@ package com.cloud.network.firewall;
import java.util.List;
import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd;
+
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
@@ -27,7 +28,8 @@ import com.cloud.user.Account;
import com.cloud.utils.Pair;
public interface FirewallService {
- FirewallRule createFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
+ FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
+ FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException;
Pair, Integer> listFirewallRules(ListFirewallRulesCmd cmd);
@@ -40,7 +42,8 @@ public interface FirewallService {
*/
boolean revokeFirewallRule(long ruleId, boolean apply);
- boolean applyFirewallRules(long ipId, Account caller) throws ResourceUnavailableException;
+ boolean applyEgressFirewallRules (FirewallRule rule, Account caller) throws ResourceUnavailableException;
+ boolean applyIngressFirewallRules(long Ipid , Account caller) throws ResourceUnavailableException;
FirewallRule getFirewallRule(long ruleId);
diff --git a/api/src/com/cloud/network/firewall/NetworkACLService.java b/api/src/com/cloud/network/firewall/NetworkACLService.java
index a1fb02cb71f..97de496f64f 100644
--- a/api/src/com/cloud/network/firewall/NetworkACLService.java
+++ b/api/src/com/cloud/network/firewall/NetworkACLService.java
@@ -20,6 +20,7 @@ package com.cloud.network.firewall;
import java.util.List;
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
+
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/com/cloud/network/lb/LoadBalancingRule.java
index b68b9cbddd4..fb1d988a4de 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRule.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java
@@ -26,7 +26,6 @@ import com.cloud.network.as.Counter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.utils.Pair;
-import org.apache.cloudstack.api.InternalIdentity;
public class LoadBalancingRule implements FirewallRule, LoadBalancer {
private LoadBalancer lb;
diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
index 4081f6efc2c..3743aae4bf8 100644
--- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -18,9 +18,13 @@ package com.cloud.network.lb;
import java.util.List;
-import org.apache.cloudstack.api.command.user.loadbalancer.*;
import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd;
+import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd;
+
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/rules/LbStickinessMethod.java b/api/src/com/cloud/network/rules/LbStickinessMethod.java
index c71b19e3a86..1e5a55e6cc5 100644
--- a/api/src/com/cloud/network/rules/LbStickinessMethod.java
+++ b/api/src/com/cloud/network/rules/LbStickinessMethod.java
@@ -16,8 +16,9 @@
// under the License.
package com.cloud.network.rules;
-import java.util.List;
import java.util.ArrayList;
+import java.util.List;
+
import com.google.gson.annotations.SerializedName;
diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/com/cloud/network/rules/RulesService.java
index 80c96d558c4..921a86e865f 100644
--- a/api/src/com/cloud/network/rules/RulesService.java
+++ b/api/src/com/cloud/network/rules/RulesService.java
@@ -19,6 +19,7 @@ package com.cloud.network.rules;
import java.util.List;
import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
+
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
diff --git a/api/src/com/cloud/network/rules/StickinessPolicy.java b/api/src/com/cloud/network/rules/StickinessPolicy.java
index e23ff828f74..da487546669 100644
--- a/api/src/com/cloud/network/rules/StickinessPolicy.java
+++ b/api/src/com/cloud/network/rules/StickinessPolicy.java
@@ -18,10 +18,11 @@ package com.cloud.network.rules;
import java.util.List;
-import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.utils.Pair;
+
/**
*/
public interface StickinessPolicy extends InternalIdentity, Identity {
diff --git a/api/src/com/cloud/network/security/SecurityGroupRules.java b/api/src/com/cloud/network/security/SecurityGroupRules.java
index 0b575e10d56..d255e46fde5 100644
--- a/api/src/com/cloud/network/security/SecurityGroupRules.java
+++ b/api/src/com/cloud/network/security/SecurityGroupRules.java
@@ -15,9 +15,10 @@
// specific language governing permissions and limitations
// under the License.
package com.cloud.network.security;
-import com.cloud.network.security.SecurityRule.SecurityRuleType;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.network.security.SecurityRule.SecurityRuleType;
+
public interface SecurityGroupRules extends InternalIdentity {
String getName();
diff --git a/api/src/com/cloud/network/security/SecurityGroupService.java b/api/src/com/cloud/network/security/SecurityGroupService.java
index 741f179db50..c6480323780 100644
--- a/api/src/com/cloud/network/security/SecurityGroupService.java
+++ b/api/src/com/cloud/network/security/SecurityGroupService.java
@@ -18,7 +18,12 @@ package com.cloud.network.security;
import java.util.List;
-import org.apache.cloudstack.api.command.user.securitygroup.*;
+import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupEgressCmd;
+import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupIngressCmd;
+import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupCmd;
+import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd;
+import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd;
+import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
diff --git a/api/src/com/cloud/network/security/SecurityRule.java b/api/src/com/cloud/network/security/SecurityRule.java
index bd4192d614c..350b52dbb20 100644
--- a/api/src/com/cloud/network/security/SecurityRule.java
+++ b/api/src/com/cloud/network/security/SecurityRule.java
@@ -16,10 +16,11 @@
// under the License.
package com.cloud.network.security;
-import com.cloud.async.AsyncInstanceCreateStatus;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.async.AsyncInstanceCreateStatus;
+
public interface SecurityRule extends Identity, InternalIdentity {
public static class SecurityRuleType {
diff --git a/api/src/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/com/cloud/network/vpc/StaticRouteProfile.java
index 656355590f3..54aa6e4dd2d 100644
--- a/api/src/com/cloud/network/vpc/StaticRouteProfile.java
+++ b/api/src/com/cloud/network/vpc/StaticRouteProfile.java
@@ -16,7 +16,6 @@
// under the License.
package com.cloud.network.vpc;
-import org.apache.cloudstack.api.InternalIdentity;
public class StaticRouteProfile implements StaticRoute {
private long id;
diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java
index 9365e56dd82..c07077f7b7e 100644
--- a/api/src/com/cloud/network/vpc/Vpc.java
+++ b/api/src/com/cloud/network/vpc/Vpc.java
@@ -17,10 +17,11 @@
package com.cloud.network.vpc;
import org.apache.cloudstack.acl.ControlledEntity;
-import com.cloud.network.Network;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.network.Network;
+
public interface Vpc extends ControlledEntity, Identity, InternalIdentity {
public enum State {
Enabled,
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index 68e062c7d79..9bf1beea5f0 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -22,6 +22,7 @@ import java.util.Set;
import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
@@ -40,7 +41,7 @@ public interface VpcService {
public VpcOffering getVpcOffering(long vpcOfferingId);
- public VpcOffering createVpcOffering(String name, String displayText, List supportedServices);
+ public VpcOffering createVpcOffering(String name, String displayText, List supportedServices, Map> serviceProviders);
public Vpc getVpc(long vpcId);
@@ -245,5 +246,5 @@ public interface VpcService {
InsufficientAddressCapacityException, ConcurrentOperationException;
public Network updateVpcGuestNetwork(long networkId, String name, String displayText, Account callerAccount,
- User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr);
+ User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr, String guestVmCidr);
}
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index 81599a0c3c9..bfd2c892ca1 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -18,8 +18,9 @@ package com.cloud.network.vpn;
import java.util.List;
-import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd;
+import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd;
+
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.RemoteAccessVpn;
diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
index 7ac567774d8..d90e3a99783 100644
--- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
+++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java
@@ -18,7 +18,6 @@ package com.cloud.network.vpn;
import java.util.List;
-import org.apache.cloudstack.api.command.user.vpn.*;
import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd;
import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd;
import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd;
@@ -26,9 +25,11 @@ import org.apache.cloudstack.api.command.user.vpn.DeleteVpnConnectionCmd;
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnCustomerGatewayCmd;
import org.apache.cloudstack.api.command.user.vpn.DeleteVpnGatewayCmd;
import org.apache.cloudstack.api.command.user.vpn.ListVpnConnectionsCmd;
+import org.apache.cloudstack.api.command.user.vpn.ListVpnCustomerGatewaysCmd;
import org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd;
import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
+
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Site2SiteCustomerGateway;
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java
index 9a48f4bb655..dd77c70abd9 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -16,12 +16,12 @@
// under the License.
package com.cloud.offering;
+import java.util.Date;
+
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.Date;
-
/**
* Represents a disk offering that specifies what the end user needs in
* the disk offering.
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index f2c4de520a1..8cb82996036 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -16,12 +16,13 @@
// under the License.
package com.cloud.offering;
-import com.cloud.network.Network.GuestType;
-import com.cloud.network.Networks.TrafficType;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.network.Network.GuestType;
+import com.cloud.network.Networks.TrafficType;
+
/**
* Describes network offering
*
@@ -110,4 +111,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
boolean getSpecifyIpRanges();
boolean isInline();
+
+ boolean getIsPersistent();
+
}
diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java
index b13346cfb83..d6c215f42f0 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -16,12 +16,12 @@
// under the License.
package com.cloud.offering;
+import java.util.Date;
+
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.Date;
-
/**
* offered.
*/
@@ -77,6 +77,11 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
*/
boolean getLimitCpuUse();
+ /**
+ * @return Does this service plan support Volatile VM that is, discard VM's root disk and create a new one on reboot?
+ */
+ boolean getVolatileVm();
+
/**
* @return the rate in megabits per sec to which a VM's network interface is throttled to
*/
diff --git a/api/src/com/cloud/org/Cluster.java b/api/src/com/cloud/org/Cluster.java
index cb72a70b817..d14f86bcbb0 100644
--- a/api/src/com/cloud/org/Cluster.java
+++ b/api/src/com/cloud/org/Cluster.java
@@ -16,11 +16,12 @@
// under the License.
package com.cloud.org;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.org.Managed.ManagedState;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Managed.ManagedState;
+
public interface Cluster extends Grouping, InternalIdentity, Identity {
public static enum ClusterType {
CloudManaged,
diff --git a/api/src/com/cloud/projects/Project.java b/api/src/com/cloud/projects/Project.java
index 78d52574f28..9240930c2bf 100644
--- a/api/src/com/cloud/projects/Project.java
+++ b/api/src/com/cloud/projects/Project.java
@@ -19,9 +19,10 @@ package com.cloud.projects;
import java.util.Date;
import org.apache.cloudstack.api.Identity;
-import com.cloud.domain.PartOf;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.domain.PartOf;
+
public interface Project extends PartOf, Identity, InternalIdentity {
public enum State {
Active, Disabled, Suspended
diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
index b9db8e734d9..08e2585d1a7 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -20,12 +20,18 @@ import java.util.List;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
-import org.apache.cloudstack.api.command.admin.host.*;
+import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
+import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd;
+import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
+import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd;
+import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd;
import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd;
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
-import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd;
+
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceInUseException;
@@ -34,8 +40,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.org.Cluster;
import com.cloud.storage.S3;
import com.cloud.storage.Swift;
+import com.cloud.utils.Pair;
import com.cloud.utils.fsm.NoTransitionException;
-import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd;
public interface ResourceService {
/**
@@ -65,7 +71,7 @@ public interface ResourceService {
boolean deleteCluster(DeleteClusterCmd cmd);
- Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate);
+ Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate,Float memoryOvercommitRatio, Float cpuOvercommitRatio);
List extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
@@ -97,7 +103,7 @@ public interface ResourceService {
List getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId);
- List extends Swift> listSwifts(ListSwiftsCmd cmd);
+ Pair, Integer> listSwifts(ListSwiftsCmd cmd);
List extends S3> listS3s(ListS3sCmd cmd);
diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java
index fb8af1a5b4b..1736da3778c 100755
--- a/api/src/com/cloud/server/ManagementService.java
+++ b/api/src/com/cloud/server/ManagementService.java
@@ -22,42 +22,42 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
-import com.cloud.alert.Alert;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
+import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
+import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
+import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
-import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
-import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.*;
+import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
+import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
+import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
+import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
+import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
-import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
-import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
-import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
-import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
-import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
-import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
-import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
+import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd;
-import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd;
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd;
-import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
+import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd;
+import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
+import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
-import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
-import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
+import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
+import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
+import com.cloud.alert.Alert;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
import com.cloud.dc.DataCenter;
@@ -77,7 +77,6 @@ import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOsCategory;
-import com.cloud.storage.StoragePool;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.SSHKeyPair;
import com.cloud.utils.Pair;
@@ -92,16 +91,6 @@ import com.cloud.vm.VirtualMachine.Type;
public interface ManagementService {
static final String Name = "management-server";
- /**
- * Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones
- * for the
- * account that invokes the API. By specifying available=true all zones which the account can access. By specifying
- * available=false the zones where the account has virtual machine instances will be returned.
- *
- * @return a list of DataCenters
- */
- List extends DataCenter> listDataCenters(ListZonesByCmd cmd);
-
/**
* returns the a map of the names/values in the configuraton table
*
@@ -109,13 +98,6 @@ public interface ManagementService {
*/
Pair, Integer> searchForConfigurations(ListCfgsByCmd c);
- /**
- * Searches for Service Offerings by the specified search criteria Can search by: "name"
- *
- * @param cmd
- * @return List of ServiceOfferings
- */
- List extends ServiceOffering> searchForServiceOfferings(ListServiceOfferingsCmd cmd);
/**
* Searches for Clusters by the specified search criteria
@@ -140,6 +122,14 @@ public interface ManagementService {
*/
Pair, Integer> searchForPods(ListPodsByCmd cmd);
+ /**
+ * Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId",
+ * "podId"
+ *
+ * @param cmd
+ * @return List of Hosts
+ */
+ Pair, Integer> searchForServers(ListHostsCmd cmd);
/**
* Creates a new template
@@ -234,15 +224,6 @@ public interface ManagementService {
*/
Set> listTemplates(ListTemplatesCmd cmd);
- /**
- * Search for disk offerings based on search criteria
- *
- * @param cmd
- * the command containing the criteria to use for searching for disk offerings
- * @return a list of disk offerings that match the given criteria
- */
- List extends DiskOffering> searchForDiskOfferings(ListDiskOfferingsCmd cmd);
-
/**
* List system VMs by the given search criteria
@@ -384,7 +365,7 @@ public interface ManagementService {
* @return Pair, List extends Host>> List of all Hosts in VM's cluster and list of Hosts with
* enough capacity
*/
- Pair, List extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
+ Pair, Integer>, List extends Host>> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize);
String[] listEventTypes();
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
index 5ec9f0171cc..ee56748640c 100644
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -37,7 +37,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
Project,
Vpc,
NetworkACL,
- StaticRoute
+ StaticRoute,
+ VMSnapshot
}
/**
diff --git a/api/src/com/cloud/storage/S3.java b/api/src/com/cloud/storage/S3.java
index 708e280ca5b..0c58a902923 100644
--- a/api/src/com/cloud/storage/S3.java
+++ b/api/src/com/cloud/storage/S3.java
@@ -18,11 +18,12 @@
*/
package com.cloud.storage;
-import com.cloud.agent.api.to.S3TO;
+import java.util.Date;
+
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.Date;
+import com.cloud.agent.api.to.S3TO;
public interface S3 extends InternalIdentity, Identity {
diff --git a/api/src/com/cloud/storage/Snapshot.java b/api/src/com/cloud/storage/Snapshot.java
index 99bdee6bea9..f71265cd230 100644
--- a/api/src/com/cloud/storage/Snapshot.java
+++ b/api/src/com/cloud/storage/Snapshot.java
@@ -18,12 +18,13 @@ package com.cloud.storage;
import java.util.Date;
-import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.utils.fsm.StateObject;
+import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
+public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject {
public enum Type {
MANUAL,
RECURRING,
@@ -42,6 +43,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
return max;
}
+ @Override
public String toString() {
return this.name();
}
@@ -51,7 +53,8 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
}
}
- public enum Status {
+ public enum State {
+ Allocated,
Creating,
CreatedOnPrimary,
BackingUp,
@@ -67,6 +70,15 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
}
}
+ enum Event {
+ CreateRequested,
+ OperationNotPerformed,
+ BackupToSecondary,
+ BackedupToSecondary,
+ OperationSucceeded,
+ OperationFailed
+ }
+
public static final long MANUAL_POLICY_ID = 0L;
long getAccountId();
@@ -79,9 +91,9 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity {
Date getCreated();
- Type getType();
+ Type getRecurringType();
- Status getStatus();
+ State getState();
HypervisorType getHypervisorType();
diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java
index 3334da54ec0..091eef182cc 100644
--- a/api/src/com/cloud/storage/StoragePool.java
+++ b/api/src/com/cloud/storage/StoragePool.java
@@ -18,10 +18,11 @@ package com.cloud.storage;
import java.util.Date;
-import com.cloud.storage.Storage.StoragePoolType;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.storage.Storage.StoragePoolType;
+
public interface StoragePool extends Identity, InternalIdentity {
/**
@@ -94,4 +95,11 @@ public interface StoragePool extends Identity, InternalIdentity {
int getPort();
Long getPodId();
+
+ /**
+ * @return
+ */
+ Long getStorageProviderId();
+
+ boolean isInMaintenance();
}
diff --git a/api/src/com/cloud/storage/StoragePoolStatus.java b/api/src/com/cloud/storage/StoragePoolStatus.java
index 0c949614412..a35f706d702 100644
--- a/api/src/com/cloud/storage/StoragePoolStatus.java
+++ b/api/src/com/cloud/storage/StoragePoolStatus.java
@@ -17,10 +17,6 @@
package com.cloud.storage;
public enum StoragePoolStatus {
- Up,
- PrepareForMaintenance,
- ErrorInMaintenance,
- CancelMaintenance,
- Maintenance,
- Removed;
+ Initial, Initialized, Creating, Attaching, Up, PrepareForMaintenance,
+ ErrorInMaintenance, CancelMaintenance, Maintenance, Removed;
}
diff --git a/api/src/com/cloud/storage/StorageService.java b/api/src/com/cloud/storage/StorageService.java
index ff8ec13e33b..63c5023ee91 100644
--- a/api/src/com/cloud/storage/StorageService.java
+++ b/api/src/com/cloud/storage/StorageService.java
@@ -18,18 +18,14 @@ package com.cloud.storage;
import java.net.UnknownHostException;
-import org.apache.cloudstack.api.command.admin.storage.*;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
+import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
+import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
-import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
-import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
-import com.cloud.exception.ConcurrentOperationException;
+
import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.PermissionDeniedException;
-import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.user.Account;
public interface StorageService{
/**
@@ -48,28 +44,6 @@ public interface StorageService{
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
UnknownHostException, ResourceUnavailableException;
- /**
- * Creates the database object for a volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
- * name)
- * @return the volume object
- * @throws PermissionDeniedException
- */
- Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
-
- /**
- * Creates the volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
- * name)
- * @return the volume object
- */
- Volume createVolume(CreateVolumeCmd cmd);
-
-
/**
* Delete the storage pool
*
@@ -108,19 +82,4 @@ public interface StorageService{
public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException;
public StoragePool getStoragePool(long id);
-
- Volume migrateVolume(Long volumeId, Long storagePoolId) throws ConcurrentOperationException;
-
-
- /**
- * Uploads the volume to secondary storage
- *
- * @param UploadVolumeCmd cmd
- *
- * @return Volume object
- */
- Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException;
-
- boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException;
-
}
diff --git a/api/src/com/cloud/storage/Swift.java b/api/src/com/cloud/storage/Swift.java
index 9cd3a34cd59..028e96e48b8 100644
--- a/api/src/com/cloud/storage/Swift.java
+++ b/api/src/com/cloud/storage/Swift.java
@@ -16,9 +16,10 @@
// under the License.
package com.cloud.storage;
-import com.cloud.agent.api.to.SwiftTO;
import org.apache.cloudstack.api.InternalIdentity;
+import com.cloud.agent.api.to.SwiftTO;
+
public interface Swift extends InternalIdentity {
public long getId();
diff --git a/api/src/com/cloud/storage/Upload.java b/api/src/com/cloud/storage/Upload.java
index a20faf1dc34..ac3836caf55 100755
--- a/api/src/com/cloud/storage/Upload.java
+++ b/api/src/com/cloud/storage/Upload.java
@@ -16,11 +16,11 @@
// under the License.
package com.cloud.storage;
+import java.util.Date;
+
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import java.util.Date;
-
public interface Upload extends InternalIdentity, Identity {
public static enum Status {
diff --git a/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java
index 97baa4b29c4..d40eafe7a15 100644
--- a/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java
+++ b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java
@@ -16,14 +16,13 @@
// under the License.
package com.cloud.storage;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
+import org.apache.cloudstack.api.InternalIdentity;
+
public interface VMTemplateStorageResourceAssoc extends InternalIdentity {
public static enum Status {
- UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS
+ UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED
}
String getInstallPath();
diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java
index bfbd816d911..4903594f0af 100755
--- a/api/src/com/cloud/storage/Volume.java
+++ b/api/src/com/cloud/storage/Volume.java
@@ -19,11 +19,12 @@ package com.cloud.storage;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.template.BasedOn;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
public interface Volume extends ControlledEntity, Identity, InternalIdentity, BasedOn, StateObject {
enum Type {
@@ -36,9 +37,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
Ready("The volume is ready to be used."),
Migrating("The volume is migrating to other storage pool"),
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
+ Resizing("The volume is being resized"),
Expunging("The volume is being expunging"),
- Destroy("The volume is destroyed, and can't be recovered."),
- UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage");
+ Expunged("The volume is being expunging"),
+ Destroy("The volume is destroyed, and can't be recovered."),
+ Destroying("The volume is destroying, and can't be recovered."),
+ UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage"),
+ Uploading("volume is uploading"),
+ Uploaded("volume is uploaded");
String _description;
@@ -62,14 +68,20 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
s_fsm.addTransition(Creating, Event.OperationFailed, Allocated);
s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy);
- s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
+ s_fsm.addTransition(Creating, Event.CreateRequested, Creating);
+ s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing);
+ s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready);
+ s_fsm.addTransition(Resizing, Event.OperationFailed, Ready);
s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp);
- s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
+ s_fsm.addTransition(Uploaded, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage
s_fsm.addTransition(Creating, Event.CopySucceeded, Ready);
- s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed.
+ s_fsm.addTransition(Creating, Event.CopyFailed, Uploaded);// Copying volume from sec to primary failed.
s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy);
s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy);
s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.ExpungingRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.OperationSucceeded, Expunged);
+ s_fsm.addTransition(Expunging, Event.OperationFailed, Expunging);
s_fsm.addTransition(Ready, Event.SnapshotRequested, Snapshotting);
s_fsm.addTransition(Snapshotting, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Snapshotting, Event.OperationFailed, Ready);
@@ -77,6 +89,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
s_fsm.addTransition(Migrating, Event.OperationSucceeded, Ready);
s_fsm.addTransition(Migrating, Event.OperationFailed, Ready);
s_fsm.addTransition(Destroy, Event.OperationSucceeded, Destroy);
+ s_fsm.addTransition(UploadOp, Event.OperationSucceeded, Uploaded);
+ s_fsm.addTransition(UploadOp, Event.OperationFailed, Allocated);
+ s_fsm.addTransition(Uploaded, Event.DestroyRequested, Destroy);
}
}
@@ -92,7 +107,8 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
MigrationRequested,
SnapshotRequested,
DestroyRequested,
- ExpungingRequested;
+ ExpungingRequested,
+ ResizeRequested;
}
/**
@@ -103,7 +119,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
/**
* @return total size of the partition
*/
- long getSize();
+ Long getSize();
/**
* @return the vm instance id
@@ -147,4 +163,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
public void incrUpdatedCount();
public Date getUpdated();
+
+ /**
+ * @return
+ */
+ String getReservationId();
+
+ /**
+ * @param reserv
+ */
+ void setReservationId(String reserv);
}
diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java
new file mode 100644
index 00000000000..8517988dfc6
--- /dev/null
+++ b/api/src/com/cloud/storage/VolumeApiService.java
@@ -0,0 +1,81 @@
+/*
+ * 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.storage;
+
+import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.user.Account;
+
+public interface VolumeApiService {
+ /**
+ * Creates the database object for a volume based on the given criteria
+ *
+ * @param cmd
+ * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
+ * name)
+ * @return the volume object
+ * @throws PermissionDeniedException
+ */
+ Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
+
+ /**
+ * Creates the volume based on the given criteria
+ *
+ * @param cmd
+ * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
+ * name)
+ * @return the volume object
+ */
+ Volume createVolume(CreateVolumeCmd cmd);
+
+
+ /**
+ * Resizes the volume based on the given criteria
+ *
+ * @param cmd
+ * the API command wrapping the criteria
+ * @return the volume object
+ */
+ Volume resizeVolume(ResizeVolumeCmd cmd);
+
+ Volume migrateVolume(MigrateVolumeCmd cmd) throws ConcurrentOperationException;
+
+ /**
+ * Uploads the volume to secondary storage
+ *
+ * @param UploadVolumeCmd cmd
+ *
+ * @return Volume object
+ */
+ Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException;
+
+ boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException;
+
+ Volume attachVolumeToVM(AttachVolumeCmd command);
+
+ Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
+}
diff --git a/api/src/com/cloud/storage/snapshot/SnapshotService.java b/api/src/com/cloud/storage/snapshot/SnapshotService.java
index 79041c47b69..b5325f52080 100644
--- a/api/src/com/cloud/storage/snapshot/SnapshotService.java
+++ b/api/src/com/cloud/storage/snapshot/SnapshotService.java
@@ -19,10 +19,11 @@ package com.cloud.storage.snapshot;
import java.util.List;
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
-import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
-import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
+import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
+
+import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.Snapshot;
@@ -82,7 +83,7 @@ public interface SnapshotService {
* the command that specifies the volume criteria
* @return list of snapshot policies
*/
- List extends SnapshotPolicy> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd);
+ Pair, Integer> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd);
boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd);
diff --git a/api/src/com/cloud/template/TemplateService.java b/api/src/com/cloud/template/TemplateService.java
index 93e8a2576b6..7e831fb0055 100755
--- a/api/src/com/cloud/template/TemplateService.java
+++ b/api/src/com/cloud/template/TemplateService.java
@@ -24,13 +24,17 @@ import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd;
import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd;
import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd;
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
-import org.apache.cloudstack.api.command.user.template.*;
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
+import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
+import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
+
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.StorageUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.utils.exception.CloudRuntimeException;
public interface TemplateService {
@@ -86,4 +90,11 @@ public interface TemplateService {
List listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd);
boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd);
+
+ VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd,
+ Account templateOwner) throws ResourceAllocationException;
+
+ VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command)
+ throws CloudRuntimeException;
+
}
diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/com/cloud/template/VirtualMachineTemplate.java
index 274b7b63843..cdfe8d38dc5 100755
--- a/api/src/com/cloud/template/VirtualMachineTemplate.java
+++ b/api/src/com/cloud/template/VirtualMachineTemplate.java
@@ -20,11 +20,12 @@ import java.util.Date;
import java.util.Map;
import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity {
@@ -89,6 +90,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
Long getSourceTemplateId();
String getTemplateTag();
-
Map getDetails();
}
diff --git a/api/src/com/cloud/user/Account.java b/api/src/com/cloud/user/Account.java
index a5b3e87156d..e65e017c266 100755
--- a/api/src/com/cloud/user/Account.java
+++ b/api/src/com/cloud/user/Account.java
@@ -62,5 +62,8 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
public String getNetworkDomain();
public Long getDefaultZoneId();
-
+
+ public int getRegionId();
+
+ public String getUuid();
}
diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java
index 9f5f4d225e0..8026891c5fa 100755
--- a/api/src/com/cloud/user/AccountService.java
+++ b/api/src/com/cloud/user/AccountService.java
@@ -22,16 +22,15 @@ import java.util.Map;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
-
+import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd;
import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
-import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd;
+
+import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
import com.cloud.domain.Domain;
-import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.PermissionDeniedException;
-import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
public interface AccountService {
@@ -63,35 +62,7 @@ public interface AccountService {
* @return the user if created successfully, null otherwise
*/
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
- Map details);
-
- /**
- * Deletes a user by userId
- *
- * @param accountId
- * - id of the account do delete
- *
- * @return true if delete was successful, false otherwise
- */
- boolean deleteUserAccount(long accountId);
-
- /**
- * Disables a user by userId
- *
- * @param userId
- * - the userId
- * @return UserAccount object
- */
- UserAccount disableUser(long userId);
-
- /**
- * Enables a user
- *
- * @param userId
- * - the userId
- * @return UserAccount object
- */
- UserAccount enableUser(long userId);
+ Map details, String accountUUID, String userUUID, Integer regionId);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@@ -102,71 +73,11 @@ public interface AccountService {
*/
UserAccount lockUser(long userId);
- /**
- * Update a user by userId
- *
- * @param userId
- * @return UserAccount object
- */
- UserAccount updateUser(UpdateUserCmd cmd);
-
- /**
- * Disables an account by accountName and domainId
- *
- * @param accountName
- * TODO
- * @param domainId
- * TODO
- * @param accountId
- * @param disabled
- * account if success
- * @return true if disable was successful, false otherwise
- */
- Account disableAccount(String accountName, Long domainId, Long accountId) throws ConcurrentOperationException, ResourceUnavailableException;
-
- /**
- * Enables an account by accountId
- *
- * @param accountName
- * - the enableAccount command defining the accountId to be deleted.
- * @param domainId
- * TODO
- * @param accountId
- * @return account object
- */
- Account enableAccount(String accountName, Long domainId, Long accountId);
-
- /**
- * Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP
- * addresses
- * allocated/etc.
- *
- * @param accountName
- * - the LockAccount command defining the accountId to be locked.
- * @param domainId
- * TODO
- * @param accountId
- * @return account object
- */
- Account lockAccount(String accountName, Long domainId, Long accountId);
-
- /**
- * Updates an account name
- *
- * @param cmd
- * - the parameter containing accountId
- * @return updated account object
- */
-
- Account updateAccount(UpdateAccountCmd cmd);
-
Account getSystemAccount();
User getSystemUser();
- User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
-
- boolean deleteUser(DeleteUserCmd deleteUserCmd);
+ User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, Integer regionId);
boolean isAdmin(short accountType);
diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java
index cd20060b710..1a9635499f1 100644
--- a/api/src/com/cloud/user/DomainService.java
+++ b/api/src/com/cloud/user/DomainService.java
@@ -20,13 +20,14 @@ import java.util.List;
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
+
import com.cloud.domain.Domain;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.utils.Pair;
public interface DomainService {
- Domain createDomain(String name, Long parentId, String networkDomain);
+ Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID, Integer regionId);
Domain getDomain(long id);
@@ -40,12 +41,19 @@ public interface DomainService {
*/
boolean isChildDomain(Long parentId, Long childId);
- boolean deleteDomain(long domainId, Boolean cleanup);
-
Pair, Integer> searchForDomains(ListDomainsCmd cmd)
throws PermissionDeniedException;
Pair, Integer> searchForDomainChildren(ListDomainChildrenCmd cmd)
throws PermissionDeniedException;
+ /**
+ * find the domain by its path
+ *
+ * @param domainPath
+ * the path to use to lookup a domain
+ * @return domainVO the domain with the matching path, or null if no domain with the given path exists
+ */
+ Domain findDomainByPath(String domainPath);
+
}
diff --git a/api/src/com/cloud/user/User.java b/api/src/com/cloud/user/User.java
index 36a7c6543b0..7d80c435e3d 100644
--- a/api/src/com/cloud/user/User.java
+++ b/api/src/com/cloud/user/User.java
@@ -16,10 +16,10 @@
// under the License.
package com.cloud.user;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
+import org.apache.cloudstack.api.InternalIdentity;
+
public interface User extends OwnedBy, InternalIdentity {
public static final long UID_SYSTEM = 1;
@@ -73,4 +73,5 @@ public interface User extends OwnedBy, InternalIdentity {
boolean isRegistered();
+ public int getRegionId();
}
diff --git a/api/src/com/cloud/user/UserAccount.java b/api/src/com/cloud/user/UserAccount.java
index c09b5c0fac5..0cb0f697a5c 100644
--- a/api/src/com/cloud/user/UserAccount.java
+++ b/api/src/com/cloud/user/UserAccount.java
@@ -16,10 +16,10 @@
// under the License.
package com.cloud.user;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.Date;
+import org.apache.cloudstack.api.InternalIdentity;
+
public interface UserAccount extends InternalIdentity {
long getId();
diff --git a/api/src/com/cloud/user/UserContext.java b/api/src/com/cloud/user/UserContext.java
index 539e11812af..bcb33b5edeb 100644
--- a/api/src/com/cloud/user/UserContext.java
+++ b/api/src/com/cloud/user/UserContext.java
@@ -16,14 +16,11 @@
// under the License.
package com.cloud.user;
-import com.cloud.server.ManagementService;
-import com.cloud.utils.component.ComponentLocator;
+import com.cloud.utils.component.ComponentContext;
+import javax.inject.Inject;
public class UserContext {
-
private static ThreadLocal s_currentContext = new ThreadLocal();
- private static final ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- private static final AccountService _accountMgr = locator.getManager(AccountService.class);
private long userId;
private String sessionId;
@@ -31,10 +28,9 @@ public class UserContext {
private long startEventId = 0;
private long accountId;
private String eventDetails;
-
private boolean apiServer;
- private static UserContext s_adminContext = new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false);
+ @Inject private AccountService _accountMgr = null;
public UserContext() {
}
@@ -51,6 +47,9 @@ public class UserContext {
}
public User getCallerUser() {
+ if (_accountMgr == null) {
+ _accountMgr = ComponentContext.getComponent(AccountService.class);
+ }
return _accountMgr.getActiveUser(userId);
}
@@ -90,10 +89,10 @@ public class UserContext {
// however, there are many places that run background jobs assume the system context.
//
// If there is a security concern, all entry points from user (including the front end that takes HTTP
-// request in and
+ // request in and
// the core async-job manager that runs commands from user) have explicitly setup the UserContext.
//
- return s_adminContext;
+ return UserContextInitializer.getInstance().getAdminContext();
}
return context;
}
diff --git a/api/src/com/cloud/user/UserContextInitializer.java b/api/src/com/cloud/user/UserContextInitializer.java
new file mode 100644
index 00000000000..a54596373eb
--- /dev/null
+++ b/api/src/com/cloud/user/UserContextInitializer.java
@@ -0,0 +1,40 @@
+// 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.user;
+
+import javax.inject.Inject;
+
+import org.springframework.stereotype.Component;
+
+@Component
+public class UserContextInitializer {
+ @Inject private AccountService _accountMgr;
+
+ private static UserContextInitializer s_instance;
+
+ public UserContextInitializer() {
+ s_instance = this;
+ }
+
+ public static UserContextInitializer getInstance() {
+ return s_instance;
+ }
+
+ public UserContext getAdminContext() {
+ return new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false);
+ }
+}
diff --git a/api/src/com/cloud/uservm/UserVm.java b/api/src/com/cloud/uservm/UserVm.java
index a587666bc8b..b1d1712d9cf 100755
--- a/api/src/com/cloud/uservm/UserVm.java
+++ b/api/src/com/cloud/uservm/UserVm.java
@@ -17,6 +17,7 @@
package com.cloud.uservm;
import org.apache.cloudstack.acl.ControlledEntity;
+
import com.cloud.vm.VirtualMachine;
/**
diff --git a/api/src/com/cloud/vm/DiskProfile.java b/api/src/com/cloud/vm/DiskProfile.java
index bb74d848342..e34a3340e9e 100644
--- a/api/src/com/cloud/vm/DiskProfile.java
+++ b/api/src/com/cloud/vm/DiskProfile.java
@@ -34,6 +34,7 @@ public class DiskProfile {
private long diskOfferingId;
private Long templateId;
private long volumeId;
+ private String path;
private HypervisorType hyperType;
@@ -56,6 +57,10 @@ public class DiskProfile {
this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isCustomized(), null);
this.hyperType = hyperType;
}
+
+ public DiskProfile(DiskProfile dp) {
+
+ }
/**
* @return size of the disk requested in bytes.
@@ -137,4 +142,16 @@ public class DiskProfile {
public HypervisorType getHypersorType() {
return this.hyperType;
}
+
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ public String getPath() {
+ return this.path;
+ }
+
+ public void setSize(long size) {
+ this.size = size;
+ }
}
diff --git a/api/src/com/cloud/vm/Nic.java b/api/src/com/cloud/vm/Nic.java
index 84c0034b430..9d21130327a 100644
--- a/api/src/com/cloud/vm/Nic.java
+++ b/api/src/com/cloud/vm/Nic.java
@@ -21,12 +21,13 @@ import java.util.Date;
import java.util.List;
import java.util.Set;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.network.Networks.AddressFormat;
import com.cloud.network.Networks.Mode;
import com.cloud.utils.fsm.FiniteState;
import com.cloud.utils.fsm.StateMachine;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
/**
* Nic represents one nic on the VM.
@@ -144,4 +145,10 @@ public interface Nic extends Identity, InternalIdentity {
VirtualMachine.Type getVmType();
AddressFormat getAddressFormat();
+
+ String getIp6Gateway();
+
+ String getIp6Cidr();
+
+ String getIp6Address();
}
diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java
index 32e3f212e99..5970ccd24ee 100644
--- a/api/src/com/cloud/vm/NicProfile.java
+++ b/api/src/com/cloud/vm/NicProfile.java
@@ -18,13 +18,14 @@ package com.cloud.vm;
import java.net.URI;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.network.Network;
import com.cloud.network.Networks.AddressFormat;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.vm.Nic.ReservationStrategy;
-import org.apache.cloudstack.api.InternalIdentity;
public class NicProfile implements InternalIdentity {
long id;
@@ -37,6 +38,8 @@ public class NicProfile implements InternalIdentity {
TrafficType trafficType;
String ip4Address;
String ip6Address;
+ String ip6Gateway;
+ String ip6Cidr;
String macAddress;
URI isolationUri;
String netmask;
@@ -47,10 +50,13 @@ public class NicProfile implements InternalIdentity {
Integer deviceId;
String dns1;
String dns2;
+ String ip6Dns1;
+ String ip6Dns2;
Integer networkRate;
boolean isSecurityGroupEnabled;
String name;
- String requestedIp;
+ String requestedIpv4;
+ String requestedIpv6;
public String getDns1() {
return dns1;
@@ -218,7 +224,7 @@ public class NicProfile implements InternalIdentity {
this.trafficType = network.getTrafficType();
this.ip4Address = nic.getIp4Address();
this.format = nic.getAddressFormat();
- this.ip6Address = null;
+ this.ip6Address = nic.getIp6Address();
this.macAddress = nic.getMacAddress();
this.reservationId = nic.getReservationId();
this.strategy = nic.getReservationStrategy();
@@ -230,6 +236,8 @@ public class NicProfile implements InternalIdentity {
this.isSecurityGroupEnabled = isSecurityGroupEnabled;
this.vmId = nic.getInstanceId();
this.name = name;
+ this.ip6Cidr = nic.getIp6Cidr();
+ this.ip6Gateway = nic.getIp6Gateway();
if (networkRate != null) {
this.networkRate = networkRate;
@@ -245,8 +253,9 @@ public class NicProfile implements InternalIdentity {
this.strategy = strategy;
}
- public NicProfile(String requestedIp) {
- this.requestedIp = requestedIp;
+ public NicProfile(String requestedIpv4, String requestedIpv6) {
+ this.requestedIpv4 = requestedIpv4;
+ this.requestedIpv6 = requestedIpv6;
}
public NicProfile() {
@@ -272,8 +281,8 @@ public class NicProfile implements InternalIdentity {
this.isSecurityGroupEnabled = enabled;
}
- public String getRequestedIp() {
- return requestedIp;
+ public String getRequestedIpv4() {
+ return requestedIpv4;
}
public void deallocate() {
@@ -301,4 +310,44 @@ public class NicProfile implements InternalIdentity {
append(reservationId).append("-").append(ip4Address).append("-").append(broadcastUri).toString();
}
+ public String getIp6Gateway() {
+ return ip6Gateway;
+ }
+
+ public void setIp6Gateway(String ip6Gateway) {
+ this.ip6Gateway = ip6Gateway;
+ }
+
+ public String getIp6Cidr() {
+ return ip6Cidr;
+ }
+
+ public void setIp6Cidr(String ip6Cidr) {
+ this.ip6Cidr = ip6Cidr;
+ }
+
+ public String getRequestedIpv6() {
+ return requestedIpv6;
+ }
+
+ public void setRequestedIpv6(String requestedIpv6) {
+ this.requestedIpv6 = requestedIpv6;
+ }
+
+ public String getIp6Dns1() {
+ return ip6Dns1;
+ }
+
+ public void setIp6Dns1(String ip6Dns1) {
+ this.ip6Dns1 = ip6Dns1;
+ }
+
+ public String getIp6Dns2() {
+ return ip6Dns2;
+ }
+
+ public void setIp6Dns2(String ip6Dns2) {
+ this.ip6Dns2 = ip6Dns2;
+ }
+
}
diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index b1ebe10596d..ea89eda89d2 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -22,19 +22,23 @@ import java.util.Map;
import javax.naming.InsufficientResourcesException;
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
-import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
-import org.apache.cloudstack.api.command.user.vm.*;
-import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
+import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
+import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd;
import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd;
-import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
import org.apache.cloudstack.api.command.user.vm.RebootVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
+import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd;
import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd;
+import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd;
import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
+import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
+import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
+import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
+import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
+import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
import com.cloud.dc.DataCenter;
import com.cloud.exception.ConcurrentOperationException;
@@ -46,6 +50,7 @@ import com.cloud.exception.StorageUnavailableException;
import com.cloud.exception.VirtualMachineMigrationException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
@@ -89,22 +94,13 @@ public interface UserVmService {
UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password) throws ResourceUnavailableException, InsufficientCapacityException;
/**
- * Attaches the specified volume to the specified VM
+ * Resets the SSH Key of a virtual machine.
*
* @param cmd
- * - the command specifying volumeId and vmId
- * @return the Volume object if attach worked successfully.
+ * - the command specifying vmId, Keypair name
+ * @return the VM if reset worked successfully, null otherwise
*/
- Volume attachVolumeToVM(AttachVolumeCmd cmd);
-
- /**
- * Detaches the specified volume from the VM it is currently attached to.
- *
- * @param cmd
- * - the command specifying volumeId
- * @return the Volume object if detach worked successfully.
- */
- Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
+ UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException,
ResourceAllocationException;
@@ -113,30 +109,29 @@ public interface UserVmService {
UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
+ /**
+ * Adds a NIC on the given network to the virtual machine
+ * @param cmd the command object that defines the vm and the given network
+ * @return the vm object if successful, null otherwise
+ */
+ UserVm addNicToVirtualMachine(AddNicToVMCmd cmd);
+
+ /**
+ * Removes a NIC on the given network from the virtual machine
+ * @param cmd the command object that defines the vm and the given network
+ * @return the vm object if successful, null otherwise
+ */
+ UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd);
+
+ /**
+ * Updates default Nic to the given network for given virtual machine
+ * @param cmd the command object that defines the vm and the given network
+ * @return the vm object if successful, null otherwise
+ */
+ UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd);
+
UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException;
- /**
- * Create a template database record in preparation for creating a private template.
- *
- * @param cmd
- * the command object that defines the name, display text, snapshot/volume, bits, public/private, etc.
- * for the
- * private template
- * @param templateOwner
- * TODO
- * @return the vm template object if successful, null otherwise
- * @throws ResourceAllocationException
- */
- VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd, Account templateOwner) throws ResourceAllocationException;
-
- /**
- * Creates a private template from a snapshot of a VM
- *
- * @param cmd
- * - the command specifying snapshotId, name, description
- * @return a template if successfully created, null otherwise
- */
- VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd cmd);
/**
* Creates a Basic Zone User VM in the database and returns the VM to the caller.
@@ -197,7 +192,7 @@ public interface UserVmService {
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List securityGroupIdList, Account owner, String hostName,
- String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, String defaultIp, String keyboard)
+ String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIp, String keyboard)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -244,7 +239,7 @@ public interface UserVmService {
* - name of the ssh key pair used to login to the virtual machine
* @param requestedIps
* TODO
- * @param defaultIp
+ * @param defaultIps
* TODO
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
@@ -262,8 +257,8 @@ public interface UserVmService {
* @throws InsufficientResourcesException
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, List securityGroupIdList,
- Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps,
- String defaultIp, String keyboard)
+ Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps,
+ IpAddresses defaultIps, String keyboard)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -308,8 +303,7 @@ public interface UserVmService {
* - name of the ssh key pair used to login to the virtual machine
* @param requestedIps
* TODO
- * @param defaultIp
- * TODO
+ * @param defaultIps TODO
* @param accountName
* - an optional account for the virtual machine. Must be used with domainId
* @param domainId
@@ -326,7 +320,7 @@ public interface UserVmService {
* @throws InsufficientResourcesException
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, Account owner, String hostName,
- String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, String defaultIp, String keyboard)
+ String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIps, String keyboard)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index cd305795478..4300dd548c1 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -21,14 +21,15 @@ import java.util.Map;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
-import org.apache.cloudstack.api.InternalIdentity;
/**
* VirtualMachine describes the properties held by a virtual machine
- *
+ *
*/
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject {
@@ -111,7 +112,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
}
-
+
public static boolean isVmStarted(State oldState, Event e, State newState) {
if (oldState == State.Starting && newState == State.Running) {
return true;
@@ -173,7 +174,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
OperationFailedToError,
OperationRetry,
AgentReportShutdowned,
- AgentReportMigrated
+ AgentReportMigrated,
+ RevertRequested,
+ SnapshotRequested
};
public enum Type {
@@ -239,9 +242,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
*/
public long getTemplateId();
+
+
/**
* returns the guest OS ID
- *
+ *
* @return guestOSId
*/
public long getGuestOSId();
@@ -254,7 +259,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
/**
* @return data center id.
*/
- public long getDataCenterIdToDeployIn();
+ public long getDataCenterId();
/**
* @return id of the host it was assigned last time.
@@ -280,6 +285,8 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
public Date getCreated();
public long getServiceOfferingId();
+
+ public Long getDiskOfferingId();
Type getType();
@@ -287,5 +294,4 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
public Map getDetails();
- boolean canPlugNics();
}
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 0fab4436807..33a9171e732 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -136,4 +136,10 @@ public interface VirtualMachineProfile {
BootloaderType getBootLoaderType();
Map getParameters();
+
+ Float getCpuOvercommitRatio();
+
+ Float getMemoryOvercommitRatio();
+
+
}
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
new file mode 100644
index 00000000000..f0ee7ee7e8a
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
@@ -0,0 +1,110 @@
+// 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.vm.snapshot;
+
+import java.util.Date;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity,StateObject {
+
+ enum State {
+ Allocated("The VM snapshot is allocated but has not been created yet."),
+ Creating("The VM snapshot is being created."),
+ Ready("The VM snapshot is ready to be used."),
+ Reverting("The VM snapshot is being used to revert"),
+ Expunging("The volume is being expunging"),
+ Removed("The volume is destroyed, and can't be recovered."),
+ Error ("The volume is in error state, and can't be recovered");
+
+ String _description;
+
+ private State(String description) {
+ _description = description;
+ }
+
+ public static StateMachine2 getStateMachine() {
+ return s_fsm;
+ }
+
+ public String getDescription() {
+ return _description;
+ }
+
+ private final static StateMachine2 s_fsm = new StateMachine2();
+ static {
+ s_fsm.addTransition(Allocated, Event.CreateRequested, Creating);
+ s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
+ s_fsm.addTransition(Creating, Event.OperationFailed, Error);
+ s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);
+ s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready);
+ s_fsm.addTransition(Reverting, Event.OperationFailed, Ready);
+ s_fsm.addTransition(Ready, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
+ }
+ }
+
+ enum Type{
+ Disk, DiskAndMemory
+ }
+
+ enum Event {
+ CreateRequested,
+ OperationFailed,
+ OperationSucceeded,
+ RevertRequested,
+ ExpungeRequested,
+ }
+
+ long getId();
+
+ public String getName();
+
+ public Long getVmId();
+
+ public State getState();
+
+ public Date getCreated();
+
+ public String getDescription();
+
+ public String getDisplayName();
+
+ public Long getParent();
+
+ public Boolean getCurrent();
+
+ public Type getType();
+
+ public long getUpdatedCount();
+
+ public void incrUpdatedCount();
+
+ public Date getUpdated();
+
+ public Date getRemoved();
+
+ public long getAccountId();
+}
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
new file mode 100644
index 00000000000..83f86bc90db
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
@@ -0,0 +1,48 @@
+// 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.vm.snapshot;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+public interface VMSnapshotService {
+
+ List extends VMSnapshot> listVMSnapshots(ListVMSnapshotCmd cmd);
+
+ VMSnapshot getVMSnapshotById(Long id);
+
+ VMSnapshot creatVMSnapshot(Long vmId, Long vmSnapshotId);
+
+ VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory)
+ throws ResourceAllocationException;
+
+ boolean deleteVMSnapshot(Long vmSnapshotId);
+
+ UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
+
+ VirtualMachine getVMBySnapshotId(Long id);
+}
diff --git a/api/src/org/apache/cloudstack/acl/APIChecker.java b/api/src/org/apache/cloudstack/acl/APIChecker.java
index 0d0dfd1be4e..2e2b73ba782 100644
--- a/api/src/org/apache/cloudstack/acl/APIChecker.java
+++ b/api/src/org/apache/cloudstack/acl/APIChecker.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.acl;
import com.cloud.exception.PermissionDeniedException;
+import com.cloud.exception.RequestLimitException;
import com.cloud.user.User;
import com.cloud.utils.component.Adapter;
@@ -26,5 +27,5 @@ public interface APIChecker extends Adapter {
// If true, apiChecker has checked the operation
// If false, apiChecker is unable to handle the operation or not implemented
// On exception, checkAccess failed don't allow
- boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
+ boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException, RequestLimitException;
}
diff --git a/api/src/org/apache/cloudstack/acl/APILimitChecker.java b/api/src/org/apache/cloudstack/acl/APILimitChecker.java
new file mode 100644
index 00000000000..110742c059d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/acl/APILimitChecker.java
@@ -0,0 +1,30 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.acl;
+
+import org.apache.cloudstack.api.ServerApiException;
+
+import com.cloud.user.Account;
+import com.cloud.utils.component.Adapter;
+
+/**
+ * APILimitChecker checks if we should block an API request based on pre-set account based api limit.
+ */
+public interface APILimitChecker extends Adapter {
+ // Interface for checking if the account is over its api limit
+ void checkLimit(Account account) throws ServerApiException;
+}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
old mode 100644
new mode 100755
index a4cb8695d35..4d6099bb863
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.api;
-import org.omg.CORBA.PUBLIC_MEMBER;
public class ApiConstants {
public static final String ACCOUNT = "account";
@@ -38,6 +37,7 @@ public class ApiConstants {
public static final String DOMAIN_SUFFIX = "domainsuffix";
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
public static final String CIDR = "cidr";
+ public static final String IP6_CIDR = "ip6cidr";
public static final String CIDR_LIST = "cidrlist";
public static final String CLEANUP = "cleanup";
public static final String CLUSTER_ID = "clusterid";
@@ -46,6 +46,7 @@ public class ApiConstants {
public static final String COMPONENT = "component";
public static final String CPU_NUMBER = "cpunumber";
public static final String CPU_SPEED = "cpuspeed";
+ public static final String CPU_OVERCOMMIT_RATIO="cpuovercommitratio";
public static final String CREATED = "created";
public static final String CUSTOMIZED = "customized";
public static final String DESCRIPTION = "description";
@@ -58,12 +59,15 @@ public class ApiConstants {
public static final String DISPLAY_TEXT = "displaytext";
public static final String DNS1 = "dns1";
public static final String DNS2 = "dns2";
+ public static final String IP6_DNS1 = "ip6dns1";
+ public static final String IP6_DNS2 = "ip6dns2";
public static final String DOMAIN = "domain";
public static final String DOMAIN_ID = "domainid";
public static final String DURATION = "duration";
public static final String EMAIL = "email";
public static final String END_DATE = "enddate";
public static final String END_IP = "endip";
+ public static final String END_IPV6 = "endipv6";
public static final String END_PORT = "endport";
public static final String ENTRY_TIME = "entrytime";
public static final String FETCH_LATEST = "fetchlatest";
@@ -73,6 +77,7 @@ public class ApiConstants {
public static final String FORMAT = "format";
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
public static final String GATEWAY = "gateway";
+ public static final String IP6_GATEWAY = "ip6gateway";
public static final String GROUP = "group";
public static final String GROUP_ID = "groupid";
public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
@@ -90,6 +95,7 @@ public class ApiConstants {
public static final String INTERNAL_DNS2 = "internaldns2";
public static final String INTERVAL_TYPE = "intervaltype";
public static final String IP_ADDRESS = "ipaddress";
+ public static final String IP6_ADDRESS = "ip6address";
public static final String IP_ADDRESS_ID = "ipaddressid";
public static final String IS_ASYNC = "isasync";
public static final String IP_AVAILABLE = "ipavailable";
@@ -99,6 +105,7 @@ public class ApiConstants {
public static final String IS_EXTRACTABLE = "isextractable";
public static final String IS_FEATURED = "isfeatured";
public static final String IS_PUBLIC = "ispublic";
+ public static final String IS_PERSISTENT = "ispersistent";
public static final String IS_READY = "isready";
public static final String IS_RECURSIVE = "isrecursive";
public static final String ISO_FILTER = "isofilter";
@@ -115,6 +122,7 @@ public class ApiConstants {
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MEMORY = "memory";
+ public static final String MEMORY_OVERCOMMIT_RATIO="memoryovercommitratio";
public static final String MODE = "mode";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
@@ -181,6 +189,7 @@ public class ApiConstants {
public static final String SOURCE_ZONE_ID = "sourcezoneid";
public static final String START_DATE = "startdate";
public static final String START_IP = "startip";
+ public static final String START_IPV6 = "startipv6";
public static final String START_PORT = "startport";
public static final String STATE = "state";
public static final String STATUS = "status";
@@ -213,6 +222,7 @@ public class ApiConstants {
public static final String VM_LIMIT = "vmlimit";
public static final String VM_TOTAL = "vmtotal";
public static final String VNET = "vnet";
+ public static final String IS_VOLATILE = "isvolatile";
public static final String VOLUME_ID = "volumeid";
public static final String ZONE_ID = "zoneid";
public static final String ZONE_NAME = "zonename";
@@ -224,6 +234,7 @@ public class ApiConstants {
public static final String NETWORK_OFFERING_ID = "networkofferingid";
public static final String NETWORK_IDS = "networkids";
public static final String NETWORK_ID = "networkid";
+ public static final String NIC_ID = "nicid";
public static final String SPECIFY_VLAN = "specifyvlan";
public static final String IS_DEFAULT = "isdefault";
public static final String IS_SYSTEM = "issystem";
@@ -368,6 +379,9 @@ public class ApiConstants {
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
public static final String ADD_VSM_FLAG = "addvsmflag";
+ public static final String END_POINT = "endpoint";
+ public static final String REGION_ID = "regionid";
+ public static final String IS_PROPAGATE = "ispropagate";
public static final String VPC_OFF_ID = "vpcofferingid";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
@@ -387,6 +401,7 @@ public class ApiConstants {
public static final String ESP_LIFETIME = "esplifetime";
public static final String DPD = "dpd";
public static final String FOR_VPC = "forvpc";
+ public static final String SHRINK_OK = "shrinkok";
public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
@@ -426,8 +441,19 @@ public class ApiConstants {
public static final String CONDITION_IDS = "conditionids";
public static final String COUNTERPARAM_LIST = "counterparam";
public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
+ public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
+ public static final String UCS_DN = "ucsdn";
+ public static final String VM_SNAPSHOT_DESCRIPTION = "description";
+ public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
+ public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
+ public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
+ public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
+ public static final String IMAGE_STORE_UUID = "imagestoreuuid";
+ public static final String GUEST_VM_CIDR = "guestvmcidr";
+ public static final String NETWORK_CIDR = "networkcidr";
+ public static final String RESERVED_IP_RANGE = "reservediprange";
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
-
+
public enum HostDetails {
all, capacity, events, stats, min;
}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java.orig b/api/src/org/apache/cloudstack/api/ApiConstants.java.orig
new file mode 100644
index 00000000000..3801506ffaa
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java.orig
@@ -0,0 +1,468 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api;
+
+
+public class ApiConstants {
+ public static final String ACCOUNT = "account";
+ public static final String ACCOUNTS = "accounts";
+ public static final String ACCOUNT_TYPE = "accounttype";
+ public static final String ACCOUNT_ID = "accountid";
+ public static final String ALGORITHM = "algorithm";
+ public static final String ALLOCATED_ONLY = "allocatedonly";
+ public static final String API_KEY = "userapikey";
+ public static final String APPLIED = "applied";
+ public static final String AVAILABLE = "available";
+ public static final String BITS = "bits";
+ public static final String BOOTABLE = "bootable";
+ public static final String BIND_DN = "binddn";
+ public static final String BIND_PASSWORD = "bindpass";
+ public static final String CATEGORY = "category";
+ public static final String CERTIFICATE = "certificate";
+ public static final String PRIVATE_KEY = "privatekey";
+ public static final String DOMAIN_SUFFIX = "domainsuffix";
+ public static final String DNS_SEARCH_ORDER = "dnssearchorder";
+ public static final String CIDR = "cidr";
+ public static final String IP6_CIDR = "ip6cidr";
+ public static final String CIDR_LIST = "cidrlist";
+ public static final String CLEANUP = "cleanup";
+ public static final String CLUSTER_ID = "clusterid";
+ public static final String CLUSTER_NAME = "clustername";
+ public static final String CLUSTER_TYPE = "clustertype";
+ public static final String COMPONENT = "component";
+ public static final String CPU_NUMBER = "cpunumber";
+ public static final String CPU_SPEED = "cpuspeed";
+ public static final String CREATED = "created";
+ public static final String CUSTOMIZED = "customized";
+ public static final String DESCRIPTION = "description";
+ public static final String DESTINATION_ZONE_ID = "destzoneid";
+ public static final String DETAILS = "details";
+ public static final String DEVICE_ID = "deviceid";
+ public static final String DISK_OFFERING_ID = "diskofferingid";
+ public static final String DISK_SIZE = "disksize";
+ public static final String DISPLAY_NAME = "displayname";
+ public static final String DISPLAY_TEXT = "displaytext";
+ public static final String DNS1 = "dns1";
+ public static final String DNS2 = "dns2";
+ public static final String DOMAIN = "domain";
+ public static final String DOMAIN_ID = "domainid";
+ public static final String DURATION = "duration";
+ public static final String EMAIL = "email";
+ public static final String END_DATE = "enddate";
+ public static final String END_IP = "endip";
+ public static final String END_IPV6 = "endipv6";
+ public static final String END_PORT = "endport";
+ public static final String ENTRY_TIME = "entrytime";
+ public static final String FETCH_LATEST = "fetchlatest";
+ public static final String FIRSTNAME = "firstname";
+ public static final String FORCED = "forced";
+ public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
+ public static final String FORMAT = "format";
+ public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
+ public static final String GATEWAY = "gateway";
+ public static final String IP6_GATEWAY = "ip6gateway";
+ public static final String GROUP = "group";
+ public static final String GROUP_ID = "groupid";
+ public static final String GUEST_CIDR_ADDRESS = "guestcidraddress";
+ public static final String HA_ENABLE = "haenable";
+ public static final String HOST_ID = "hostid";
+ public static final String HOST_NAME = "hostname";
+ public static final String HYPERVISOR = "hypervisor";
+ public static final String INLINE = "inline";
+ public static final String INSTANCE = "instance";
+ public static final String ICMP_CODE = "icmpcode";
+ public static final String ICMP_TYPE = "icmptype";
+ public static final String ID = "id";
+ public static final String IDS = "ids";
+ public static final String INTERNAL_DNS1 = "internaldns1";
+ public static final String INTERNAL_DNS2 = "internaldns2";
+ public static final String INTERVAL_TYPE = "intervaltype";
+ public static final String IP_ADDRESS = "ipaddress";
+ public static final String IP6_ADDRESS = "ip6address";
+ public static final String IP_ADDRESS_ID = "ipaddressid";
+ public static final String IS_ASYNC = "isasync";
+ public static final String IP_AVAILABLE = "ipavailable";
+ public static final String IP_LIMIT = "iplimit";
+ public static final String IP_TOTAL = "iptotal";
+ public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired";
+ public static final String IS_EXTRACTABLE = "isextractable";
+ public static final String IS_FEATURED = "isfeatured";
+ public static final String IS_PUBLIC = "ispublic";
+ public static final String IS_PERSISTENT = "ispersistent";
+ public static final String IS_READY = "isready";
+ public static final String IS_RECURSIVE = "isrecursive";
+ public static final String ISO_FILTER = "isofilter";
+ public static final String ISO_GUEST_OS_NONE = "None";
+ public static final String JOB_ID = "jobid";
+ public static final String JOB_STATUS = "jobstatus";
+ public static final String LASTNAME = "lastname";
+ public static final String LEVEL = "level";
+ public static final String LENGTH = "length";
+ public static final String LIMIT_CPU_USE = "limitcpuuse";
+ public static final String LOCK = "lock";
+ public static final String LUN = "lun";
+ public static final String LBID = "lbruleid";
+ public static final String MAX = "max";
+ public static final String MAX_SNAPS = "maxsnaps";
+ public static final String MEMORY = "memory";
+ public static final String MODE = "mode";
+ public static final String NAME = "name";
+ public static final String METHOD_NAME = "methodname";
+ public static final String NETWORK_DOMAIN = "networkdomain";
+ public static final String NETMASK = "netmask";
+ public static final String NEW_NAME = "newname";
+ public static final String NUM_RETRIES = "numretries";
+ public static final String OFFER_HA = "offerha";
+ public static final String IS_SYSTEM_OFFERING = "issystem";
+ public static final String IS_DEFAULT_USE = "defaultuse";
+ public static final String OP = "op";
+ public static final String OS_CATEGORY_ID = "oscategoryid";
+ public static final String OS_TYPE_ID = "ostypeid";
+ public static final String PARAMS = "params";
+ public static final String PARENT_DOMAIN_ID = "parentdomainid";
+ public static final String PASSWORD = "password";
+ public static final String NEW_PASSWORD = "new_password";
+ public static final String PASSWORD_ENABLED = "passwordenabled";
+ public static final String SSHKEY_ENABLED = "sshkeyenabled";
+ public static final String PATH = "path";
+ public static final String POD_ID = "podid";
+ public static final String POD_IDS = "podids";
+ public static final String POLICY_ID = "policyid";
+ public static final String PORT = "port";
+ public static final String PORTAL = "portal";
+ public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid";
+ public static final String PRIVATE_INTERFACE = "privateinterface";
+ public static final String PRIVATE_IP = "privateip";
+ public static final String PRIVATE_PORT = "privateport";
+ public static final String PRIVATE_START_PORT = "privateport";
+ public static final String PRIVATE_END_PORT = "privateendport";
+ public static final String PRIVATE_ZONE = "privatezone";
+ public static final String PROTOCOL = "protocol";
+ public static final String PUBLIC_INTERFACE = "publicinterface";
+ public static final String PUBLIC_IP_ID = "publicipid";
+ public static final String PUBLIC_IP = "publicip";
+ public static final String PUBLIC_PORT = "publicport";
+ public static final String PUBLIC_START_PORT = "publicport";
+ public static final String PUBLIC_END_PORT = "publicendport";
+ public static final String PUBLIC_ZONE = "publiczone";
+ public static final String RECEIVED_BYTES = "receivedbytes";
+ public static final String REQUIRES_HVM = "requireshvm";
+ public static final String RESOURCE_TYPE = "resourcetype";
+ public static final String RESPONSE = "response";
+ public static final String QUERY_FILTER = "queryfilter";
+ public static final String SCHEDULE = "schedule";
+ public static final String SCOPE = "scope";
+ public static final String SECRET_KEY = "usersecretkey";
+ public static final String SINCE = "since";
+ public static final String KEY = "key";
+ public static final String SEARCH_BASE = "searchbase";
+ public static final String SECURITY_GROUP_IDS = "securitygroupids";
+ public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
+ public static final String SECURITY_GROUP_NAME = "securitygroupname";
+ public static final String SECURITY_GROUP_ID = "securitygroupid";
+ public static final String SENT = "sent";
+ public static final String SENT_BYTES = "sentbytes";
+ public static final String SERVICE_OFFERING_ID = "serviceofferingid";
+ public static final String SHOW_CAPACITIES = "showcapacities";
+ public static final String SIZE = "size";
+ public static final String SNAPSHOT_ID = "snapshotid";
+ public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
+ public static final String SNAPSHOT_TYPE = "snapshottype";
+ public static final String SOURCE_ZONE_ID = "sourcezoneid";
+ public static final String START_DATE = "startdate";
+ public static final String START_IP = "startip";
+ public static final String START_IPV6 = "startipv6";
+ public static final String START_PORT = "startport";
+ public static final String STATE = "state";
+ public static final String STATUS = "status";
+ public static final String STORAGE_TYPE = "storagetype";
+ public static final String SYSTEM_VM_TYPE = "systemvmtype";
+ public static final String TAGS = "tags";
+ public static final String TARGET_IQN = "targetiqn";
+ public static final String TEMPLATE_FILTER = "templatefilter";
+ public static final String TEMPLATE_ID = "templateid";
+ public static final String ISO_ID = "isoid";
+ public static final String TIMEOUT = "timeout";
+ public static final String TIMEZONE = "timezone";
+ public static final String TYPE = "type";
+ public static final String TRUST_STORE = "truststore";
+ public static final String TRUST_STORE_PASSWORD = "truststorepass";
+ public static final String URL = "url";
+ public static final String USAGE_INTERFACE = "usageinterface";
+ public static final String USER_DATA = "userdata";
+ public static final String USER_ID = "userid";
+ public static final String USE_SSL = "ssl";
+ public static final String USERNAME = "username";
+ public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
+ public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
+ public static final String VALUE = "value";
+ public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
+ public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
+ public static final String VLAN = "vlan";
+ public static final String VLAN_ID = "vlanid";
+ public static final String VM_AVAILABLE = "vmavailable";
+ public static final String VM_LIMIT = "vmlimit";
+ public static final String VM_TOTAL = "vmtotal";
+ public static final String VNET = "vnet";
+ public static final String VOLUME_ID = "volumeid";
+ public static final String ZONE_ID = "zoneid";
+ public static final String ZONE_NAME = "zonename";
+ public static final String NETWORK_TYPE = "networktype";
+ public static final String PAGE = "page";
+ public static final String PAGE_SIZE = "pagesize";
+ public static final String COUNT = "count";
+ public static final String TRAFFIC_TYPE = "traffictype";
+ public static final String NETWORK_OFFERING_ID = "networkofferingid";
+ public static final String NETWORK_IDS = "networkids";
+ public static final String NETWORK_ID = "networkid";
+ public static final String NIC_ID = "nicid";
+ public static final String SPECIFY_VLAN = "specifyvlan";
+ public static final String IS_DEFAULT = "isdefault";
+ public static final String IS_SYSTEM = "issystem";
+ public static final String AVAILABILITY = "availability";
+ public static final String NETWORKRATE = "networkrate";
+ public static final String HOST_TAGS = "hosttags";
+ public static final String SSH_KEYPAIR = "keypair";
+ public static final String HOST_CPU_CAPACITY = "hostcpucapacity";
+ public static final String HOST_CPU_NUM = "hostcpunum";
+ public static final String HOST_MEM_CAPACITY = "hostmemcapacity";
+ public static final String HOST_MAC = "hostmac";
+ public static final String HOST_TAG = "hosttag";
+ public static final String PXE_SERVER_TYPE = "pxeservertype";
+ public static final String LINMIN_USERNAME = "linminusername";
+ public static final String LINMIN_PASSWORD = "linminpassword";
+ public static final String LINMIN_APID = "linminapid";
+ public static final String DHCP_SERVER_TYPE = "dhcpservertype";
+ public static final String LINK_LOCAL_IP = "linklocalip";
+ public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress";
+ public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask";
+ public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid";
+ public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress";
+ public static final String PRIVATE_NETMASK = "privatenetmask";
+ public static final String PRIVATE_NETWORK_ID = "privatenetworkid";
+ public static final String ALLOCATION_STATE = "allocationstate";
+ public static final String MANAGED_STATE = "managedstate";
+ public static final String STORAGE_ID = "storageid";
+ public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
+ public static final String PING_DIR = "pingdir";
+ public static final String TFTP_DIR = "tftpdir";
+ public static final String PING_CIFS_USERNAME = "pingcifsusername";
+ public static final String PING_CIFS_PASSWORD = "pingcifspassword";
+ public static final String CHECKSUM = "checksum";
+ public static final String NETWORK_DEVICE_TYPE = "networkdevicetype";
+ public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist";
+ public static final String ZONE_TOKEN = "zonetoken";
+ public static final String DHCP_PROVIDER = "dhcpprovider";
+ public static final String RESULT = "success";
+ public static final String LUN_ID = "lunId";
+ public static final String IQN = "iqn";
+ public static final String AGGREGATE_NAME = "aggregatename";
+ public static final String POOL_NAME = "poolname";
+ public static final String VOLUME_NAME = "volumename";
+ public static final String SNAPSHOT_POLICY = "snapshotpolicy";
+ public static final String SNAPSHOT_RESERVATION = "snapshotreservation";
+ public static final String IP_NETWORK_LIST = "iptonetworklist";
+ public static final String PARAM_LIST = "param";
+ public static final String FOR_LOAD_BALANCING = "forloadbalancing";
+ public static final String KEYBOARD = "keyboard";
+ public static final String OPEN_FIREWALL = "openfirewall";
+ public static final String TEMPLATE_TAG = "templatetag";
+ public static final String HYPERVISOR_VERSION = "hypervisorversion";
+ public static final String MAX_GUESTS_LIMIT = "maxguestslimit";
+ public static final String PROJECT_ID = "projectid";
+ public static final String PROJECT_IDS = "projectids";
+ public static final String PROJECT = "project";
+ public static final String ROLE = "role";
+ public static final String USER = "user";
+ public static final String ACTIVE_ONLY = "activeonly";
+ public static final String TOKEN = "token";
+ public static final String ACCEPT = "accept";
+ public static final String SORT_KEY = "sortkey";
+ public static final String ACCOUNT_DETAILS = "accountdetails";
+ public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist";
+ public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist";
+ public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability";
+ public static final String PROVIDER = "provider";
+ public static final String NETWORK_SPEED = "networkspeed";
+ public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
+ public static final String ISOLATION_METHODS = "isolationmethods";
+ public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
+ public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
+ public static final String ENABLED = "enabled";
+ public static final String SERVICE_NAME = "servicename";
+ public static final String DHCP_RANGE = "dhcprange";
+ public static final String UUID = "uuid";
+ public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled";
+ public static final String LOCAL_STORAGE_ENABLED = "localstorageenabled";
+ public static final String GUEST_IP_TYPE = "guestiptype";
+ public static final String XEN_NETWORK_LABEL = "xennetworklabel";
+ public static final String KVM_NETWORK_LABEL = "kvmnetworklabel";
+ public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel";
+ public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid";
+ public static final String SERVICE_LIST = "servicelist";
+ public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice";
+ public static final String SUPPORTED_SERVICES = "supportedservices";
+ public static final String NSP_ID = "nspid";
+ public static final String ACL_TYPE = "acltype";
+ public static final String SUBDOMAIN_ACCESS = "subdomainaccess";
+ public static final String LOAD_BALANCER_DEVICE_ID = "lbdeviceid";
+ public static final String LOAD_BALANCER_DEVICE_NAME = "lbdevicename";
+ public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate";
+ public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity";
+ public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated";
+ public static final String FIREWALL_DEVICE_ID = "fwdeviceid";
+ public static final String FIREWALL_DEVICE_NAME = "fwdevicename";
+ public static final String FIREWALL_DEVICE_STATE = "fwdevicestate";
+ public static final String FIREWALL_DEVICE_CAPACITY = "fwdevicecapacity";
+ public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated";
+ public static final String SERVICE = "service";
+ public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid";
+ public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname";
+ public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported";
+ public static final String RESOURCE_STATE = "resourcestate";
+ public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired";
+ public static final String REQUIRED = "required";
+ public static final String RESTART_REQUIRED = "restartrequired";
+ public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects";
+ public static final String CONSERVE_MODE = "conservemode";
+ public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor";
+ public static final String KEYWORD = "keyword";
+ public static final String LIST_ALL = "listall";
+ public static final String SPECIFY_IP_RANGES = "specifyipranges";
+ public static final String IS_SOURCE_NAT = "issourcenat";
+ public static final String IS_STATIC_NAT = "isstaticnat";
+ public static final String SORT_BY = "sortby";
+ public static final String CHANGE_CIDR = "changecidr";
+ public static final String PURPOSE = "purpose";
+ public static final String IS_TAGGED = "istagged";
+ public static final String INSTANCE_NAME = "instancename";
+ public static final String START_VM = "startvm";
+ public static final String HA_HOST = "hahost";
+ public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
+ public static final String DEFAULT_ZONE_ID = "defaultzoneid";
+ public static final String GUID = "guid";
+
+ public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
+ public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
+ public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
+ // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this later.
+ public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity";
+ public static final String CISCO_NEXUS_VSM_NAME = "vsmname";
+ public static final String VSM_USERNAME = "vsmusername";
+ public static final String VSM_PASSWORD = "vsmpassword";
+ public static final String VSM_IPADDRESS = "vsmipaddress";
+ public static final String VSM_MGMT_VLAN_ID = "vsmmgmtvlanid";
+ public static final String VSM_PKT_VLAN_ID = "vsmpktvlanid";
+ public static final String VSM_CTRL_VLAN_ID = "vsmctrlvlanid";
+ public static final String VSM_STORAGE_VLAN_ID = "vsmstoragevlanid";
+ public static final String VSM_DOMAIN_ID = "vsmdomainid";
+ public static final String VSM_CONFIG_MODE = "vsmconfigmode";
+ public static final String VSM_CONFIG_STATE = "vsmconfigstate";
+ public static final String VSM_DEVICE_STATE = "vsmdevicestate";
+ public static final String ADD_VSM_FLAG = "addvsmflag";
+ public static final String END_POINT = "endpoint";
+ public static final String REGION_ID = "regionid";
+ public static final String IS_PROPAGATE = "ispropagate";
+ public static final String VPC_OFF_ID = "vpcofferingid";
+ public static final String NETWORK = "network";
+ public static final String VPC_ID = "vpcid";
+ public static final String GATEWAY_ID = "gatewayid";
+ public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy";
+ public static final String RESOURCE_IDS = "resourceids";
+ public static final String RESOURCE_ID = "resourceid";
+ public static final String CUSTOMER = "customer";
+ public static final String S2S_VPN_GATEWAY_ID = "s2svpngatewayid";
+ public static final String S2S_CUSTOMER_GATEWAY_ID = "s2scustomergatewayid";
+ public static final String IPSEC_PSK = "ipsecpsk";
+ public static final String GUEST_IP = "guestip";
+ public static final String REMOVED = "removed";
+ public static final String IKE_POLICY = "ikepolicy";
+ public static final String ESP_POLICY = "esppolicy";
+ public static final String IKE_LIFETIME = "ikelifetime";
+ public static final String ESP_LIFETIME = "esplifetime";
+ public static final String DPD = "dpd";
+ public static final String FOR_VPC = "forvpc";
+ public static final String SHRINK_OK = "shrinkok";
+ public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
+ public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
+ public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
+ public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
+ public static final String S3_ACCESS_KEY = "accesskey";
+ public static final String S3_SECRET_KEY = "secretkey";
+ public static final String S3_END_POINT = "endpoint";
+ public static final String S3_BUCKET_NAME = "bucket";
+ public static final String S3_HTTPS_FLAG = "usehttps";
+ public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout";
+ public static final String S3_MAX_ERROR_RETRY = "maxerrorretry";
+ public static final String S3_SOCKET_TIMEOUT = "sockettimeout";
+ public static final String INCL_ZONES = "includezones";
+ public static final String EXCL_ZONES = "excludezones";
+ public static final String SOURCE = "source";
+ public static final String COUNTER_ID = "counterid";
+ public static final String AGGR_OPERATOR = "aggroperator";
+ public static final String AGGR_FUNCTION = "aggrfunction";
+ public static final String AGGR_VALUE = "aggrvalue";
+ public static final String THRESHOLD = "threshold";
+ public static final String RELATIONAL_OPERATOR = "relationaloperator";
+ public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams";
+ public static final String MIN_MEMBERS = "minmembers";
+ public static final String MAX_MEMBERS = "maxmembers";
+ public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod";
+ public static final String VMPROFILE_ID = "vmprofileid";
+ public static final String VMGROUP_ID = "vmgroupid";
+ public static final String CS_URL = "csurl";
+ public static final String SCALEUP_POLICY_IDS = "scaleuppolicyids";
+ public static final String SCALEDOWN_POLICY_IDS = "scaledownpolicyids";
+ public static final String SCALEUP_POLICIES = "scaleuppolicies";
+ public static final String SCALEDOWN_POLICIES = "scaledownpolicies";
+ public static final String INTERVAL = "interval";
+ public static final String QUIETTIME = "quiettime";
+ public static final String ACTION = "action";
+ public static final String CONDITION_ID = "conditionid";
+ public static final String CONDITION_IDS = "conditionids";
+ public static final String COUNTERPARAM_LIST = "counterparam";
+ public static final String AUTOSCALE_USER_ID = "autoscaleuserid";
+ public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername";
+<<<<<<< HEAD
+ public static final String UCS_DN = "ucsdn";
+=======
+ public static final String VM_SNAPSHOT_DESCRIPTION = "description";
+ public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
+ public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
+ public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
+ public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
+>>>>>>> CLOUDSTACK-684 Support VM Snapshot
+
+ public enum HostDetails {
+ all, capacity, events, stats, min;
+ }
+
+ public enum VMDetails {
+ all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min;
+ }
+
+ public enum LDAPParams {
+ hostname, port, usessl, queryfilter, searchbase, dn, passwd, truststore, truststorepass;
+
+ @Override
+ public String toString() {
+ return "ldap." + name();
+ }
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
new file mode 100644
index 00000000000..69bd0284cef
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api;
+
+/**
+ * Enum class for various API error code used in CloudStack
+ *
+ */
+public enum ApiErrorCode {
+
+ MALFORMED_PARAMETER_ERROR(430),
+ PARAM_ERROR(431),
+ UNSUPPORTED_ACTION_ERROR(432),
+ API_LIMIT_EXCEED(429),
+
+ INTERNAL_ERROR(530),
+ ACCOUNT_ERROR(531),
+ ACCOUNT_RESOURCE_LIMIT_ERROR(532),
+ INSUFFICIENT_CAPACITY_ERROR(533),
+ RESOURCE_UNAVAILABLE_ERROR(534),
+ RESOURCE_ALLOCATION_ERROR(535),
+ RESOURCE_IN_USE_ERROR(536),
+ NETWORK_RULE_CONFLICT_ERROR(537);
+
+ private int httpCode;
+
+ private ApiErrorCode(int httpStatusCode){
+ httpCode = httpStatusCode;
+ }
+
+ public int getHttpCode() {
+ return httpCode;
+ }
+
+ public void setHttpCode(int httpCode) {
+ this.httpCode = httpCode;
+ }
+
+ public String toString(){
+ return String.valueOf(this.httpCode);
+ }
+
+
+}
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
index fd67ed89675..97edb4c7c64 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.api;
import org.apache.cloudstack.api.response.AsyncJobResponse;
+
import com.cloud.async.AsyncJob;
import com.cloud.user.User;
import com.cloud.user.UserContext;
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index 3399784d2a2..816b6deed77 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -25,7 +25,11 @@ import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
+import javax.inject.Inject;
+
import org.apache.cloudstack.query.QueryService;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
@@ -40,6 +44,7 @@ import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.NetworkService;
+import com.cloud.network.NetworkUsageService;
import com.cloud.network.StorageNetworkService;
import com.cloud.network.VpcVirtualNetworkApplianceService;
import com.cloud.network.as.AutoScaleService;
@@ -57,6 +62,7 @@ import com.cloud.resource.ResourceService;
import com.cloud.server.ManagementService;
import com.cloud.server.TaggedResourceService;
import com.cloud.storage.StorageService;
+import com.cloud.storage.VolumeApiService;
import com.cloud.storage.snapshot.SnapshotService;
import com.cloud.template.TemplateService;
import com.cloud.user.Account;
@@ -64,9 +70,8 @@ import com.cloud.user.AccountService;
import com.cloud.user.DomainService;
import com.cloud.user.ResourceLimitService;
import com.cloud.utils.Pair;
-import com.cloud.utils.component.ComponentLocator;
-import com.cloud.vm.BareMetalVmService;
import com.cloud.vm.UserVmService;
+import com.cloud.vm.snapshot.VMSnapshotService;
public abstract class BaseCmd {
private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
@@ -81,23 +86,6 @@ public abstract class BaseCmd {
BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID
}
- // FIXME: Extract these out into a separate file
- // Client error codes
- public static final int MALFORMED_PARAMETER_ERROR = 430;
- public static final int PARAM_ERROR = 431;
- public static final int UNSUPPORTED_ACTION_ERROR = 432;
- public static final int PAGE_LIMIT_EXCEED = 433;
-
- // Server error codes
- public static final int INTERNAL_ERROR = 530;
- public static final int ACCOUNT_ERROR = 531;
- public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532;
- public static final int INSUFFICIENT_CAPACITY_ERROR = 533;
- public static final int RESOURCE_UNAVAILABLE_ERROR = 534;
- public static final int RESOURCE_ALLOCATION_ERROR = 534;
- public static final int RESOURCE_IN_USE_ERROR = 536;
- public static final int NETWORK_RULE_CONFLICT_ERROR = 537;
-
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
@@ -109,75 +97,46 @@ public abstract class BaseCmd {
@Parameter(name = "response", type = CommandType.STRING)
private String responseType;
- public static ComponentLocator s_locator;
- public static ConfigurationService _configService;
- public static AccountService _accountService;
- public static UserVmService _userVmService;
- public static ManagementService _mgr;
- public static StorageService _storageService;
- public static ResourceService _resourceService;
- public static NetworkService _networkService;
- public static TemplateService _templateService;
- public static SecurityGroupService _securityGroupService;
- public static SnapshotService _snapshotService;
- public static ConsoleProxyService _consoleProxyService;
- public static VpcVirtualNetworkApplianceService _routerService;
- public static ResponseGenerator _responseGenerator;
- public static EntityManager _entityMgr;
- public static RulesService _rulesService;
- public static AutoScaleService _autoScaleService;
- public static LoadBalancingRulesService _lbService;
- public static RemoteAccessVpnService _ravService;
- public static BareMetalVmService _bareMetalVmService;
- public static ProjectService _projectService;
- public static FirewallService _firewallService;
- public static DomainService _domainService;
- public static ResourceLimitService _resourceLimitService;
- public static IdentityService _identityService;
- public static StorageNetworkService _storageNetworkService;
- public static TaggedResourceService _taggedResourceService;
- public static VpcService _vpcService;
- public static NetworkACLService _networkACLService;
- public static Site2SiteVpnService _s2sVpnService;
+ @Inject public ConfigurationService _configService;
+ @Inject public AccountService _accountService;
+ @Inject public UserVmService _userVmService;
+ @Inject public ManagementService _mgr;
+ @Inject public StorageService _storageService;
+ @Inject public VolumeApiService _volumeService;
+ @Inject public ResourceService _resourceService;
+ @Inject public NetworkService _networkService;
+ @Inject public TemplateService _templateService;
+ @Inject public SecurityGroupService _securityGroupService;
+ @Inject public SnapshotService _snapshotService;
+ @Inject public ConsoleProxyService _consoleProxyService;
+ @Inject public VpcVirtualNetworkApplianceService _routerService;
+ @Inject public ResponseGenerator _responseGenerator;
+ @Inject public EntityManager _entityMgr;
+ @Inject public RulesService _rulesService;
+ @Inject public AutoScaleService _autoScaleService;
+ @Inject public LoadBalancingRulesService _lbService;
+ @Inject public RemoteAccessVpnService _ravService;
+ @Inject public ProjectService _projectService;
+ @Inject public FirewallService _firewallService;
+ @Inject public DomainService _domainService;
+ @Inject public ResourceLimitService _resourceLimitService;
+ @Inject public IdentityService _identityService;
+ @Inject public StorageNetworkService _storageNetworkService;
+ @Inject public TaggedResourceService _taggedResourceService;
+ @Inject public VpcService _vpcService;
+ @Inject public NetworkACLService _networkACLService;
+ @Inject public Site2SiteVpnService _s2sVpnService;
- public static QueryService _queryService;
-
- public static void setComponents(ResponseGenerator generator) {
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- _mgr = (ManagementService) ComponentLocator.getComponent(ManagementService.Name);
- _accountService = locator.getManager(AccountService.class);
- _configService = locator.getManager(ConfigurationService.class);
- _userVmService = locator.getManager(UserVmService.class);
- _storageService = locator.getManager(StorageService.class);
- _resourceService = locator.getManager(ResourceService.class);
- _networkService = locator.getManager(NetworkService.class);
- _templateService = locator.getManager(TemplateService.class);
- _securityGroupService = locator.getManager(SecurityGroupService.class);
- _snapshotService = locator.getManager(SnapshotService.class);
- _consoleProxyService = locator.getManager(ConsoleProxyService.class);
- _routerService = locator.getManager(VpcVirtualNetworkApplianceService.class);
- _entityMgr = locator.getManager(EntityManager.class);
- _rulesService = locator.getManager(RulesService.class);
- _lbService = locator.getManager(LoadBalancingRulesService.class);
- _autoScaleService = locator.getManager(AutoScaleService.class);
- _ravService = locator.getManager(RemoteAccessVpnService.class);
- _responseGenerator = generator;
- _bareMetalVmService = locator.getManager(BareMetalVmService.class);
- _projectService = locator.getManager(ProjectService.class);
- _firewallService = locator.getManager(FirewallService.class);
- _domainService = locator.getManager(DomainService.class);
- _resourceLimitService = locator.getManager(ResourceLimitService.class);
- _identityService = locator.getManager(IdentityService.class);
- _storageNetworkService = locator.getManager(StorageNetworkService.class);
- _taggedResourceService = locator.getManager(TaggedResourceService.class);
- _vpcService = locator.getManager(VpcService.class);
- _networkACLService = locator.getManager(NetworkACLService.class);
- _s2sVpnService = locator.getManager(Site2SiteVpnService.class);
- _queryService = locator.getManager(QueryService.class);
- }
+ @Inject public QueryService _queryService;
+ @Inject public UsageService _usageService;
+ @Inject public NetworkUsageService _networkUsageService;
+ @Inject public VMSnapshotService _vmSnapshotService;
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException;
+ public void configure() {
+ }
+
public String getResponseType() {
if (responseType == null) {
return RESPONSE_TYPE_XML;
@@ -194,7 +153,7 @@ public abstract class BaseCmd {
/**
* For commands the API framework needs to know the owner of the object being acted upon. This method is
* used to determine that information.
- *
+ *
* @return the id of the account that owns the object being acted upon
*/
public abstract long getEntityOwnerId();
@@ -230,7 +189,7 @@ public abstract class BaseCmd {
int arrayStartIndex = key.indexOf('[');
int arrayStartLastIndex = key.lastIndexOf('[');
if (arrayStartIndex != arrayStartLastIndex) {
- throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
@@ -239,7 +198,7 @@ public abstract class BaseCmd {
int arrayEndLastIndex = key.lastIndexOf(']');
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
// malformed parameter
- throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
@@ -247,7 +206,7 @@ public abstract class BaseCmd {
int fieldIndex = key.indexOf('.');
String fieldName = null;
if (fieldIndex < arrayEndIndex) {
- throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
} else {
fieldName = key.substring(fieldIndex + 1);
@@ -272,7 +231,7 @@ public abstract class BaseCmd {
}
if (!parsedIndex) {
- throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key
+ "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
@@ -306,14 +265,14 @@ public abstract class BaseCmd {
StringBuffer sb = new StringBuffer();
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
// JSON response
- sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
+ sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }");
} else {
sb.append("");
sb.append("<" + getCommandName() + ">");
sb.append("" + apiException.getErrorCode() + "");
sb.append("" + escapeXml(apiException.getDescription()) + "");
- sb.append("" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
+ sb.append("" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
}
return sb.toString();
}
@@ -324,10 +283,10 @@ public abstract class BaseCmd {
// set up the return value with the name of the response
if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) {
- prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},");
+ prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},");
} else {
prefixSb.append("");
- prefixSb.append("<" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">");
+ prefixSb.append("<" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">");
}
int i = 0;
@@ -507,7 +466,7 @@ public abstract class BaseCmd {
if (!enabledOnly || account.getState() == Account.State.enabled) {
return account.getId();
} else {
- throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
+ throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active");
}
} else {
// idList is not used anywhere, so removed it now
@@ -524,7 +483,7 @@ public abstract class BaseCmd {
return project.getProjectAccountId();
} else {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active");
- ex.addProxyObject(project, projectId, "projectId");
+ ex.addProxyObject(project, projectId, "projectId");
throw ex;
}
} else {
diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
index 038da63ec4c..0586117f0c6 100644
--- a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
@@ -18,7 +18,7 @@ package org.apache.cloudstack.api;
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd {
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by account. Must be used with the domainId parameter.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.")
private String accountName;
public String getAccountName() {
diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java
index 58e83f70929..bc0b2b8f3b5 100644
--- a/api/src/org/apache/cloudstack/api/BaseListCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java
@@ -42,6 +42,9 @@ public abstract class BaseListCmd extends BaseCmd {
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
+ public BaseListCmd() {
+ }
+
public String getKeyword() {
return keyword;
}
@@ -62,10 +65,14 @@ public abstract class BaseListCmd extends BaseCmd {
return pageSize;
}
- public static void configure() {
- if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
- MAX_PAGESIZE = _configService.getDefaultPageSize();
- }
+ public void configure() {
+ if(MAX_PAGESIZE == null) {
+ if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
+ MAX_PAGESIZE = _configService.getDefaultPageSize();
+ } else {
+ MAX_PAGESIZE = PAGESIZE_UNLIMITED;
+ }
+ }
}
@Override
diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
index cde2d948686..47aa6791943 100644
--- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -18,9 +18,9 @@ package org.apache.cloudstack.api;
import java.util.List;
+import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java
index 01f1be3253b..187ad9456bc 100644
--- a/api/src/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/org/apache/cloudstack/api/BaseResponse.java
@@ -16,8 +16,6 @@
// under the License.
package org.apache.cloudstack.api;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.ResponseObject;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
old mode 100755
new mode 100644
index dd6ae007ab9..6fd97731189
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -21,10 +21,6 @@ import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.Parameter;
-
public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());
diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
old mode 100755
new mode 100644
index aacc6efa2e0..5cd4881e207
--- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -19,10 +19,10 @@ package org.apache.cloudstack.api;
import java.util.List;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.exception.InvalidParameterValueException;
public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
@@ -119,7 +119,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 63df4dc5532..267238af37b 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -60,10 +60,12 @@ import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
+import org.apache.cloudstack.api.response.S3Response;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.ServiceResponse;
@@ -81,9 +83,12 @@ import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
+import org.apache.cloudstack.api.response.UsageRecordResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
@@ -91,8 +96,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
-
-import org.apache.cloudstack.api.response.S3Response;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.usage.Usage;
import com.cloud.async.AsyncJob;
import com.cloud.capacity.Capacity;
@@ -159,6 +164,7 @@ import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.snapshot.VMSnapshot;
public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
@@ -314,6 +320,8 @@ public interface ResponseGenerator {
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);
+ RegionResponse createRegionResponse(Region region);
+
/**
* @param resourceTag
* @param keyValueOnly TODO
@@ -372,4 +380,9 @@ public interface ResponseGenerator {
GuestOSResponse createGuestOSResponse(GuestOS os);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
+
+ UsageRecordResponse createUsageResponse(Usage usageRecord);
+
+ TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
+ VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
}
diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java
index 1f57b74745d..4b0fae58548 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -15,28 +15,60 @@
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api;
+import java.util.ArrayList;
+
+import com.cloud.exception.CloudException;
+import com.cloud.utils.exception.CSExceptionErrorCode;
import com.cloud.utils.exception.CloudRuntimeException;
@SuppressWarnings("serial")
public class ServerApiException extends CloudRuntimeException {
- private int _errorCode;
+ private ApiErrorCode _errorCode;
private String _description;
public ServerApiException() {
- _errorCode = 0;
+ _errorCode = ApiErrorCode.INTERNAL_ERROR;
_description = null;
+ setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
}
- public ServerApiException(int errorCode, String description) {
+ public ServerApiException(ApiErrorCode errorCode, String description) {
_errorCode = errorCode;
_description = description;
+ setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName()));
}
- public int getErrorCode() {
+ // wrap a specific CloudRuntimeException to a ServerApiException
+ public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause){
+ super(description, cause);
+ _errorCode = errorCode;
+ _description = description;
+ if (cause instanceof CloudRuntimeException) {
+ CloudRuntimeException rt = (CloudRuntimeException) cause;
+ ArrayList idList = rt.getIdProxyList();
+ if (idList != null) {
+ for (int i = 0; i < idList.size(); i++) {
+ addProxyObject(idList.get(i));
+ }
+ }
+ setCSErrorCode(rt.getCSErrorCode());
+ } else if (cause instanceof CloudException) {
+ CloudException rt = (CloudException) cause;
+ ArrayList idList = rt.getIdProxyList();
+ if (idList != null) {
+ for (int i = 0; i < idList.size(); i++) {
+ addProxyObject(idList.get(i));
+ }
+ }
+ setCSErrorCode(rt.getCSErrorCode());
+ }
+ }
+
+ public ApiErrorCode getErrorCode() {
return _errorCode;
}
- public void setErrorCode(int errorCode) {
+ public void setErrorCode(ApiErrorCode errorCode) {
_errorCode = errorCode;
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index f93787b7bc5..b0f73d1d8f8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -19,13 +19,17 @@ package org.apache.cloudstack.api.command.admin.account;
import java.util.Collection;
import java.util.Map;
-import org.apache.cloudstack.api.*;
-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.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
@@ -74,6 +78,19 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
+ //@Parameter(name = ApiConstants.REGION_DETAILS, type = CommandType.MAP, description = "details for account used to store region specific parameters")
+ //private Map regionDetails;
+
+ @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from another Region")
+ private String accountUUID;
+
+ @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
+ private String userUUID;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the account")
+ private Integer regionId;
+
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -128,6 +145,18 @@ public class CreateAccountCmd extends BaseCmd {
return params;
}
+ public String getAccountUUID() {
+ return accountUUID;
+ }
+
+ public String getUserUUID() {
+ return userUUID;
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -145,13 +174,14 @@ public class CreateAccountCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
- UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails());
+ UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails(),
+ getAccountUUID(), getUserUUID(), getRegionId());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index a1d9b6419cb..959d7ce985b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -16,12 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -41,14 +48,24 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
required=true, description="Account id")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+
public Long getId() {
return id;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -86,12 +103,13 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Account Id: "+getId());
- boolean result = _accountService.deleteUserAccount(getId());
+
+ boolean result = _regionService.deleteUserAccount(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index f0a5e7078b7..60e9fd5aa60 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -16,12 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
@@ -52,6 +58,11 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
private Boolean lockRequested;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -68,6 +79,14 @@ public class DisableAccountCmd extends BaseAsyncCmd {
return domainId;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
+ public Boolean getLockRequested() {
+ return lockRequested;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -105,17 +124,13 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
- Account result = null;
- if(lockRequested)
- result = _accountService.lockAccount(getAccountName(), getDomainId(), getId());
- else
- result = _accountService.disableAccount(getAccountName(), getDomainId(), getId());
+ Account result = _regionService.disableAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" );
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index 4aa1e4fc1b9..9a92f789132 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -16,15 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@ -47,6 +50,11 @@ public class EnableAccountCmd extends BaseCmd {
description="Enables specified account in this domain.")
private Long domainId;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -63,6 +71,10 @@ public class EnableAccountCmd extends BaseCmd {
return domainId;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -89,13 +101,13 @@ public class EnableAccountCmd extends BaseCmd {
@Override
public void execute(){
- Account result = _accountService.enableAccount(getAccountName(), getDomainId(), getId());
+ Account result = _regionService.enableAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index 34e9e53b84d..f4aa3afa8f5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -16,14 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@ -84,7 +83,7 @@ public class LockAccountCmd extends BaseCmd {
// response.setResponseName(getCommandName());
// this.setResponseObject(response);
// } else {
-// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock account");
+// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock account");
// }
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index f1340464d6b..6fad48bf66e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -19,15 +19,18 @@ package org.apache.cloudstack.api.command.admin.account;
import java.util.Collection;
import java.util.Map;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@ -60,6 +63,11 @@ public class UpdateAccountCmd extends BaseCmd{
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -94,6 +102,10 @@ public class UpdateAccountCmd extends BaseCmd{
return params;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -119,13 +131,13 @@ public class UpdateAccountCmd extends BaseCmd{
@Override
public void execute(){
- Account result = _accountService.updateAccount(this);
+ Account result = _regionService.updateAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index a119d0f44bf..98ffc51f7a0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -17,15 +17,15 @@
package org.apache.cloudstack.api.command.admin.autoscale;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.CounterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.Counter;
@@ -86,7 +86,7 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
index 9304eeb7b93..35d99bbc985 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
@@ -17,16 +17,16 @@
package org.apache.cloudstack.api.command.admin.autoscale;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceInUseException;
@@ -56,7 +56,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
result = _autoScaleService.deleteCounter(getId());
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
if (result) {
@@ -64,7 +64,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete counter with Id: " + getId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete counter.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index 28bf72ddba7..7b1cd067eb1 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
@@ -20,14 +20,21 @@ package org.apache.cloudstack.api.command.admin.cluster;
import java.util.ArrayList;
import java.util.List;
+import com.cloud.exception.InvalidParameterValueException;
import org.apache.cloudstack.api.*;
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.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.ResourceInUseException;
@@ -78,6 +85,12 @@ public class AddClusterCmd extends BaseCmd {
@Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster")
private String vsmipaddress;
+ @Parameter (name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false , description = "value of the cpu overcommit ratio, defaults to 1")
+ private String cpuovercommitRatio;
+
+ @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false ,description = "value of the default ram overcommit ratio, defaults to 1")
+ private String memoryovercommitratio;
+
public String getVSMIpaddress() {
return vsmipaddress;
}
@@ -144,9 +157,26 @@ public class AddClusterCmd extends BaseCmd {
this.allocationState = allocationState;
}
+ public Float getCpuOvercommitRatio (){
+ if(cpuovercommitRatio != null){
+ return Float.parseFloat(cpuovercommitRatio);
+ }
+ return 1.0f;
+ }
+
+ public Float getMemoryOvercommitRaito (){
+ if (memoryovercommitratio != null){
+ return Float.parseFloat(memoryovercommitratio);
+ }
+ return 1.0f;
+ }
+
@Override
public void execute(){
try {
+ if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
+ throw new InvalidParameterValueException("Cpu and ram overcommit ratios should not be less than 1");
+ }
List extends Cluster> result = _resourceService.discoverCluster(this);
ListResponse response = new ListResponse();
List clusterResponses = new ArrayList();
@@ -156,7 +186,7 @@ public class AddClusterCmd extends BaseCmd {
clusterResponses.add(clusterResponse);
}
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add cluster");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add cluster");
}
response.setResponses(clusterResponses);
@@ -165,10 +195,10 @@ public class AddClusterCmd extends BaseCmd {
this.setResponseObject(response);
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
- ServerApiException e = new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
for (String proxyObj : ex.getIdProxyList()) {
e.addProxyObject(proxyObj);
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
index f0b40cb6b03..4fece0c7a30 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.ClusterResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteCluster", description="Deletes a cluster.", responseObject=SuccessResponse.class)
@@ -70,7 +71,7 @@ public class DeleteClusterCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete cluster");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete cluster");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 95ab0bff4f3..0417b187e38 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -19,17 +19,16 @@ package org.apache.cloudstack.api.command.admin.cluster;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
-import org.apache.cloudstack.api.response.PodResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.org.Cluster;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
index 03b43def3ca..95728dd184d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java
@@ -16,14 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.ClusterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
@@ -53,6 +54,13 @@ public class UpdateClusterCmd extends BaseCmd {
@Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
private String managedState;
+ @Parameter(name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of cpu overcommit ratio")
+ private String cpuovercommitratio;
+
+ @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of ram overcommit ratio")
+ private String memoryovercommitratio;
+
+
public String getClusterName() {
return clusterName;
}
@@ -99,6 +107,20 @@ public class UpdateClusterCmd extends BaseCmd {
this.managedState = managedstate;
}
+ public Float getCpuOvercommitRatio (){
+ if(cpuovercommitratio != null){
+ return Float.parseFloat(cpuovercommitratio);
+ }
+ return 1.0f;
+ }
+
+ public Float getMemoryOvercommitRaito (){
+ if (memoryovercommitratio != null){
+ return Float.parseFloat(memoryovercommitratio);
+ }
+ return 1.0f;
+ }
+
@Override
public void execute(){
Cluster cluster = _resourceService.getCluster(getId());
@@ -106,13 +128,17 @@ public class UpdateClusterCmd extends BaseCmd {
throw new InvalidParameterValueException("Unable to find the cluster by id=" + getId());
}
- Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate());
+ if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
+ throw new InvalidParameterValueException("Cpu and ram overcommit ratios should be greater than one");
+ }
+
+ Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate(), getMemoryOvercommitRaito(), getCpuOvercommitRatio());
if (result != null) {
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false);
clusterResponse.setResponseName(getCommandName());
this.setResponseObject(clusterResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update cluster");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update cluster");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index 16010fdb495..aabfd4a620d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.configuration.Configuration;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
index b69e9eab597..f2220271559 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
index 79693e76f84..ffeb58621b9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java
@@ -16,14 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.config;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.ConfigurationResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.configuration.Configuration;
import com.cloud.user.Account;
@@ -76,7 +77,7 @@ public class UpdateCfgCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
index 82880c1fbae..e2fe8a7b1ea 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.config;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.user.Account;
@@ -86,7 +87,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
index 0e6ae32583b..e0ba69359ad 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
-import org.apache.cloudstack.api.*;
+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.DomainResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.DomainResponse;
import com.cloud.domain.Domain;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -45,6 +49,12 @@ public class CreateDomainCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain")
private String networkDomain;
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region")
+ private String domainUUID;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the Domain")
+ private Integer regionId;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -61,6 +71,14 @@ public class CreateDomainCmd extends BaseCmd {
return networkDomain;
}
+ public String getDomainUUID() {
+ return domainUUID;
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -78,13 +96,13 @@ public class CreateDomainCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():""));
- Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain());
+ Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID(), getRegionId());
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create domain");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create domain");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
index 7009e70ca32..eae393da81e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java
@@ -16,12 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.log4j.Logger;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -43,7 +50,11 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, description="true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise")
private Boolean cleanup;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean propagate;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -56,6 +67,10 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
return cleanup;
}
+ public Boolean isPropagate() {
+ return propagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -88,12 +103,12 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Domain Id: "+getId());
- boolean result = _domainService.deleteDomain(id, cleanup);
+ boolean result = _regionService.deleteDomain(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete domain");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete domain");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
index 4bc05d1c0f9..26d8bbf64d2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java
@@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.admin.domain;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
index 9b9e200abcd..ed14194490e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java
@@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.admin.domain;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
index cc5926cace1..c217f16c93a 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java
@@ -16,13 +16,21 @@
// under the License.
package org.apache.cloudstack.api.command.admin.domain;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+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 org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.domain.Domain;
import com.cloud.user.Account;
+import com.cloud.user.UserAccount;
import com.cloud.user.UserContext;
@APICommand(name = "updateDomain", description="Updates a domain with a new name", responseObject=DomainResponse.class)
@@ -44,6 +52,11 @@ public class UpdateDomainCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the domain's networks; empty string will update domainName with NULL value")
private String networkDomain;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -60,6 +73,10 @@ public class UpdateDomainCmd extends BaseCmd {
return networkDomain;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -77,13 +94,14 @@ public class UpdateDomainCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Domain Id: "+getId());
- Domain domain = _mgr.updateDomain(this);
+ Domain domain = _regionService.updateDomain(this);
+
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update domain");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update domain");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
index 0a0a98c1c45..3a2f4144745 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java
@@ -19,11 +19,10 @@ package org.apache.cloudstack.api.command.admin.host;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.ClusterResponse;
@@ -31,6 +30,8 @@ import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.DiscoveryException;
import com.cloud.host.Host;
import com.cloud.user.Account;
@@ -148,7 +149,7 @@ public class AddHostCmd extends BaseCmd {
hostResponses.add(hostResponse);
}
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add host");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add host");
}
response.setResponses(hostResponses);
@@ -157,7 +158,7 @@ public class AddHostCmd extends BaseCmd {
this.setResponseObject(response);
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
index 579e286f884..f1d12b3b07b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java
@@ -18,12 +18,16 @@ package org.apache.cloudstack.api.command.admin.host;
import java.util.List;
-import org.apache.cloudstack.api.*;
-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.HostResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.DiscoveryException;
import com.cloud.host.Host;
import com.cloud.user.Account;
@@ -84,11 +88,11 @@ public class AddSecondaryStorageCmd extends BaseCmd {
this.setResponseObject(hostResponse);
}
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add secondary storage");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
index 93dca9140f9..d9e593462ea 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.host;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
@@ -104,7 +104,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel host maintenance");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel host maintenance");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
index 5103f986e10..e1cef62e92f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.host;
-import org.apache.cloudstack.api.response.HostResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.HostResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class)
@@ -84,7 +85,7 @@ public class DeleteHostCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete host");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index 82f329f4b7e..29844c31113 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@ -21,8 +21,6 @@ import java.util.EnumSet;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.BaseListCmd;
@@ -33,6 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
@@ -168,17 +168,16 @@ public class ListHostsCmd extends BaseListCmd {
if (getVirtualMachineId() == null) {
response = _queryService.searchForServers(this);
} else {
- List extends Host> result = new ArrayList();
+ Pair,Integer> result;
List extends Host> hostsWithCapacity = new ArrayList();
- Pair, List extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(),
- this.getStartIndex(), this.getPageSizeVal());
+ Pair,Integer>, List extends Host>> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
result = hostsForMigration.first();
hostsWithCapacity = hostsForMigration.second();
response = new ListResponse();
List hostResponses = new ArrayList();
- for (Host host : result) {
+ for (Host host : result.first()) {
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
Boolean suitableForMigration = false;
if (hostsWithCapacity.contains(host)) {
@@ -189,7 +188,7 @@ public class ListHostsCmd extends BaseListCmd {
hostResponses.add(hostResponse);
}
- response.setResponses(hostResponses);
+ response.setResponses(hostResponses, result.second());
}
response.setResponseName(getCommandName());
this.setResponseObject(response);
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
index 385e2aef415..c1a83fabe28 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.host;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
@@ -104,7 +104,7 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd {
response.setResponseName("host");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare host for maintenance");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare host for maintenance");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
index 99e867bbebd..b151865bab3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.host;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.host.Host;
@@ -103,11 +103,11 @@ public class ReconnectHostCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host");
}
} catch (Exception ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
index 9ab27178838..3bf95dbeabe 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java
@@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.admin.host;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.host.Host;
import com.cloud.user.Account;
@@ -108,7 +109,7 @@ public class UpdateHostCmd extends BaseCmd {
this.setResponseObject(hostResponse);
} catch (Exception e) {
s_logger.debug("Failed to update host:" + getId(), e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
index dd9e4559b9d..c4420bd13fe 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.host;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
index b71ba73405f..2976de4bf28 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
@@ -19,18 +19,19 @@ package org.apache.cloudstack.api.command.admin.ldap;
import javax.naming.NamingException;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
@APICommand(name = "ldapConfig", description="Configure the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.0")
@@ -43,7 +44,10 @@ public class LDAPConfigCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com")
+ @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com")
+ private String listall;
+
+ @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com")
private String hostname;
@Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.")
@@ -52,10 +56,10 @@ public class LDAPConfigCmd extends BaseCmd {
@Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.")
private Boolean useSSL;
- @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, required=true, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
+ @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.")
private String searchBase;
- @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, required=true, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
+ @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, description="You specify a query filter here, which narrows down the users, who can be part of this domain.")
private String queryFilter;
@Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.")
@@ -74,6 +78,10 @@ public class LDAPConfigCmd extends BaseCmd {
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
+ public String getListAll() {
+ return listall == null ? "false" : listall;
+ }
+
public String getBindPassword() {
return bindPassword;
}
@@ -82,30 +90,56 @@ public class LDAPConfigCmd extends BaseCmd {
return bindDN;
}
+ public void setBindDN(String bdn) {
+ this.bindDN=bdn;
+ }
+
public String getQueryFilter() {
return queryFilter;
}
+ public void setQueryFilter(String queryFilter) {
+ this.queryFilter=queryFilter;
+ }
public String getSearchBase() {
return searchBase;
}
+ public void setSearchBase(String searchBase) {
+ this.searchBase=searchBase;
+ }
+
public Boolean getUseSSL() {
- return useSSL == null ? Boolean.FALSE : Boolean.TRUE;
+ return useSSL == null ? Boolean.FALSE : useSSL;
+ }
+
+ public void setUseSSL(Boolean useSSL) {
+ this.useSSL=useSSL;
}
public String getHostname() {
return hostname;
}
+ public void setHostname(String hostname) {
+ this.hostname=hostname;
+ }
+
public Integer getPort() {
return port <= 0 ? 389 : port;
}
+ public void setPort(Integer port) {
+ this.port=port;
+ }
+
public String getTrustStore() {
return trustStore;
}
+ public void setTrustStore(String trustStore) {
+ this.trustStore=trustStore;
+ }
public String getTrustStorePassword() {
return trustStorePassword;
@@ -122,12 +156,25 @@ public class LDAPConfigCmd extends BaseCmd {
InsufficientCapacityException, ServerApiException,
ConcurrentOperationException, ResourceAllocationException {
try {
- boolean result = _configService.updateLDAP(this);
- if (result){
- LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
+ if ("true".equalsIgnoreCase(getListAll())){
+ // return the existing conf
+ LDAPConfigCmd cmd = _configService.listLDAPConfig(this);
+ LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(),
+ cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
lr.setResponseName(getCommandName());
this.setResponseObject(lr);
}
+ else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) {
+ throw new InvalidParameterValueException("You need to provide hostname, serachbase and queryfilter to configure your LDAP server");
+ }
+ else {
+ boolean result = _configService.updateLDAP(this);
+ if (result){
+ LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN());
+ lr.setResponseName(getCommandName());
+ this.setResponseObject(lr);
+ }
+ }
}
catch (NamingException ne){
ne.printStackTrace();
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java
index 6bf5f4ff851..5159fbadb0b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java
@@ -18,11 +18,11 @@ package org.apache.cloudstack.api.command.admin.ldap;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
import org.apache.cloudstack.api.response.LDAPRemoveResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "ldapRemove", description="Remove the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.1")
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
index 3e1d74df405..4983255389d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java
@@ -18,23 +18,24 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.Map;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.NetworkDeviceResponse;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
+import org.apache.log4j.Logger;
+
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.host.Host;
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
-import com.cloud.server.ManagementService;
-import org.apache.cloudstack.api.response.NetworkDeviceResponse;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "addNetworkDevice", description="Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer", responseObject = NetworkDeviceResponse.class)
@@ -46,6 +47,7 @@ public class AddNetworkDeviceCmd extends BaseCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
+ @Inject ExternalNetworkDeviceManager nwDeviceMgr;
@Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall")
private String type;
@@ -63,20 +65,17 @@ public class AddNetworkDeviceCmd extends BaseCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
+ ResourceAllocationException {
try {
- ExternalNetworkDeviceManager nwDeviceMgr;
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
Host device = nwDeviceMgr.addNetworkDevice(this);
NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
response.setObjectName("networkdevice");
response.setResponseName(getCommandName());
this.setResponseObject(response);
} catch (InvalidParameterValueException ipve) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
index 6d4b962d4a1..2c6cc609ea7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java
@@ -18,16 +18,16 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -103,7 +103,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider to physical network");
}
}
@@ -114,7 +114,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
index b97f85ec1ba..b48bf9e763e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
@@ -23,12 +23,17 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
+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.NetworkOfferingResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Service;
@@ -69,7 +74,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.CONSERVE_MODE, type=CommandType.BOOLEAN, description="true if the network offering is IP conserve mode enabled")
private Boolean conserveMode;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
description="the service offering ID used by virtual router provider")
private Long serviceOfferingId;
@@ -88,6 +93,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if network offering supports specifying ip ranges; defaulted to false if not specified")
private Boolean specifyIpRanges;
+ @Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified")
+ private Boolean isPersistent;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -147,6 +155,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
return conserveMode;
}
+ public Boolean getIsPersistent() {
+ return isPersistent == null ? false : isPersistent;
+ }
+
public Map> getServiceProviders() {
Map> serviceProviderMap = null;
if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
@@ -225,7 +237,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
index f56ae7dbf50..fb6db61f9a6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java
@@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -151,7 +151,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network");
}
}
@@ -162,7 +162,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network entity");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
index ccd92e19d67..008fa329f7f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -110,7 +110,7 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} catch (Exception e) {
s_logger.warn("Create storage network IP range failed", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
index 09451242daf..2ca618cd1ec 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java
@@ -16,23 +16,24 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.network.ExternalNetworkDeviceManager;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
+import org.apache.log4j.Logger;
+
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.server.ManagementService;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "deleteNetworkDevice", description="Deletes network device.", responseObject=SuccessResponse.class)
@@ -40,6 +41,8 @@ public class DeleteNetworkDeviceCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteNetworkDeviceCmd.class);
private static final String s_name = "deletenetworkdeviceresponse";
+ @Inject ExternalNetworkDeviceManager nwDeviceMgr;
+
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -54,23 +57,20 @@ public class DeleteNetworkDeviceCmd extends BaseCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
+ ResourceAllocationException {
try {
- ExternalNetworkDeviceManager nwDeviceMgr;
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
boolean result = nwDeviceMgr.deleteNetworkDevice(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network device:" + getId());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network device:" + getId());
}
} catch (InvalidParameterValueException ipve) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
index c13088f6123..69f34e871ad 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteNetworkOffering", description="Deletes a network offering.", responseObject=SuccessResponse.class, since="3.0.0")
@@ -70,7 +71,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
index bc744399a33..cbcf29b8f44 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -76,14 +76,14 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network service provider");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
index 5f86efa9ad8..c7dd93c88f8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -70,7 +74,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete physical network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
index 1873fc7d6ef..b2dcfa52e34 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -70,7 +74,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} catch (Exception e) {
s_logger.warn("Failed to delete storage network ip range " + getId(), e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
index 742ff1f74af..0b7836de3a8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java
@@ -20,25 +20,25 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
-import org.apache.cloudstack.api.response.NetworkDeviceResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkDeviceResponse;
+import org.apache.cloudstack.network.ExternalNetworkDeviceManager;
+import org.apache.log4j.Logger;
+
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.host.Host;
-import com.cloud.server.ManagementService;
-import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "listNetworkDevice", description="List network devices", responseObject = NetworkDeviceResponse.class)
@@ -46,6 +46,7 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkDeviceCmd.class);
private static final String s_name = "listnetworkdevice";
+ @Inject ExternalNetworkDeviceManager nwDeviceMgr;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@@ -66,11 +67,8 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
- ResourceAllocationException {
+ ResourceAllocationException {
try {
- ExternalNetworkDeviceManager nwDeviceMgr;
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
List devices = nwDeviceMgr.listNetworkDevice(this);
List nwdeviceResponses = new ArrayList();
ListResponse listResponse = new ListResponse();
@@ -85,9 +83,9 @@ public class ListNetworkDeviceCmd extends BaseListCmd {
listResponse.setResponseName(getCommandName());
this.setResponseObject(listResponse);
} catch (InvalidParameterValueException ipve) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
} catch (CloudRuntimeException cre) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
index 06a0518af20..e51c47eb6df 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java
@@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
index a301ac004ea..f7794c3069c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.PhysicalNetwork;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
@@ -100,7 +100,7 @@ public class ListPhysicalNetworksCmd extends BaseListCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to search for physical networks");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
index 8fcaf4958b1..46af6a69068 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java
@@ -19,14 +19,18 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.PodResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -88,7 +92,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
this.setResponseObject(response);
} catch (Exception e) {
s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
index f7407a108e0..85ae1395060 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
index dc2f3099206..ba685a94995 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.cloudstack.api.*;
+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.NetworkOfferingResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
@@ -102,7 +106,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
index b770ea26c12..4364b2d7afb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java
@@ -18,15 +18,15 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkServiceProvider;
@@ -88,7 +88,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service provider");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
index d9a3e044c73..06cf38dba3f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java
@@ -19,12 +19,12 @@ package org.apache.cloudstack.api.command.admin.network;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetwork;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
index d6d0b92e4b7..613e4c01121 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.network;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -96,7 +100,7 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} catch (Exception e) {
s_logger.warn("Update storage network IP range failed", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
index 08101dc4137..68d5dd466a3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -115,7 +116,7 @@ public class CreateDiskOfferingCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create disk offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index f93c2a88ce2..e915c48e9b6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -58,6 +59,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.LIMIT_CPU_USE, type=CommandType.BOOLEAN, description="restrict the CPU usage to committed service offering")
private Boolean limitCpuUse;
+ @Parameter(name=ApiConstants.IS_VOLATILE, type=CommandType.BOOLEAN, description="true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM")
+ private Boolean isVolatile;
+
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the service offering. Values are local and shared.")
private String storageType;
@@ -105,11 +109,15 @@ public class CreateServiceOfferingCmd extends BaseCmd {
}
public Boolean getOfferHa() {
- return offerHa;
+ return offerHa == null ? false : offerHa;
}
public Boolean GetLimitCpuUse() {
- return limitCpuUse;
+ return limitCpuUse == null ? false : limitCpuUse;
+ }
+
+ public Boolean getVolatileVm() {
+ return isVolatile == null ? false : isVolatile;
}
public String getStorageType() {
@@ -162,7 +170,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create service offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
index 85e034f6191..f8e27fb5717 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DiskOfferingResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteDiskOffering", description="Updates a disk offering.", responseObject=SuccessResponse.class)
@@ -70,7 +71,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete disk offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete disk offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
index d1ea4de0504..e3664deeea2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.cloudstack.api.*;
+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.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.user.Account;
@APICommand(name = "deleteServiceOffering", description="Deletes a service offering.", responseObject=SuccessResponse.class)
@@ -68,7 +72,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
index 8db731d3b31..1e421a13d3f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java
@@ -15,14 +15,15 @@
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DiskOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.DiskOffering;
import com.cloud.user.Account;
@@ -91,7 +92,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
index 38220b90673..a8de0741814 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.offering;
-import org.apache.cloudstack.api.*;
+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.ServiceOfferingResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -89,7 +93,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
index 331968b00db..a110b50021e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java
@@ -16,12 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.pod;
-import org.apache.cloudstack.api.*;
-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.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.dc.Pod;
import com.cloud.user.Account;
@@ -111,7 +114,7 @@ public class CreatePodCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
index 8c64a8dad33..f663633a6e7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.pod;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.PodResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
@@ -70,7 +70,7 @@ public class DeletePodCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete pod");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete pod");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
index a64ecdde9b5..3dace4244ae 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
@@ -20,14 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.dc.Pod;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
index ca5e03953a3..a71c3624247 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java
@@ -16,11 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.admin.pod;
-import org.apache.cloudstack.api.*;
-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.PodResponse;
+import org.apache.log4j.Logger;
import com.cloud.dc.Pod;
import com.cloud.user.Account;
@@ -110,7 +113,7 @@ public class UpdatePodCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update pod");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
new file mode 100644
index 00000000000..20366702dd1
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java
@@ -0,0 +1,109 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.region;
+
+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 org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "addRegion", description="Adds a Region", responseObject=RegionResponse.class)
+public class AddRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName());
+
+ private static final String s_name = "addregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of the Region")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the region")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="Region service endpoint")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key of Admin user")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user")
+ private String secretKey;
+
+ @Inject public RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Region");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
new file mode 100644
index 00000000000..79c34d0690f
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java
@@ -0,0 +1,79 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.region;
+
+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 org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "removeRegion", description="Removes specified region", responseObject=SuccessResponse.class)
+public class RemoveRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of the region to delete")
+ private Integer id;
+
+ @Inject RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ boolean result = _regionService.removeRegion(id);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove region");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
new file mode 100644
index 00000000000..16693b64650
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java
@@ -0,0 +1,108 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.region;
+
+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 org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+import com.cloud.user.Account;
+
+@APICommand(name = "updateRegion", description="Updates a region", responseObject=RegionResponse.class)
+public class UpdateRegionCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName());
+ private static final String s_name = "updateregionresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of region to update")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates region with this name")
+ private String regionName;
+
+ @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point")
+ private String endPoint;
+
+ @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="new API key for the Region")
+ private String apiKey;
+
+ @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region")
+ private String secretKey;
+
+ @Inject RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getRegionName() {
+ return regionName;
+ }
+
+ public String getEndPoint() {
+ return endPoint;
+ }
+
+ public String getApiKey() {
+ return apiKey;
+ }
+
+ public String getSecretKey() {
+ return secretKey;
+ }
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey());
+ if (region != null) {
+ RegionResponse response = _responseGenerator.createRegionResponse(region);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Region");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
index db7a20b02a3..015d82bcccb 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java
@@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
-import com.cloud.alert.Alert;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AlertResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.alert.Alert;
import com.cloud.utils.Pair;
@APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
index ce20a3e27de..b0badb8bb42 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java
@@ -20,16 +20,16 @@ import java.text.DecimalFormat;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.CapacityResponse;
+import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
-import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.capacity.Capacity;
import com.cloud.exception.InvalidParameterValueException;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
index 0e559189904..9704c640f28 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.resource;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.CustomCertificateResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.CustomCertificateResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -99,7 +103,7 @@ public class UploadCustomCertificateCmd extends BaseAsyncCmd {
response.setObjectName("customcertificate");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload custom certificate");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload custom certificate");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
index be6be26a36f..f19e0fae7c6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java
@@ -16,23 +16,26 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.log4j.Logger;
+import java.util.List;
+
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
-import com.cloud.network.VirtualRouterProvider;
-import com.cloud.network.element.VirtualRouterElementService;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.VirtualRouterProvider;
+import com.cloud.network.element.VirtualRouterElementService;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -41,8 +44,8 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(ConfigureVirtualRouterElementCmd.class.getName());
private static final String s_name = "configurevirtualrouterelementresponse";
- @PlugService
- private VirtualRouterElementService _service;
+ @Inject
+ private List _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -114,13 +117,13 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Virtual router element: " + id);
- VirtualRouterProvider result = _service.configure(this);
+ VirtualRouterProvider result = _service.get(0).configure(this);
if (result != null){
VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result);
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the virtual router provider");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
index f6a7b744ca3..39fac136233 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java
@@ -16,12 +16,20 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.ProviderResponse;
-import org.apache.log4j.Logger;
+import java.util.List;
+
+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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.VirtualRouterProvider;
@@ -35,8 +43,8 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName());
private static final String s_name = "createvirtualrouterelementresponse";
- @PlugService
- private VirtualRouterElementService _service;
+ @Inject
+ private List _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -76,24 +84,24 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId());
- VirtualRouterProvider result = _service.getCreatedElement(getEntityId());
+ VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId());
if (result != null) {
VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
@Override
public void create() throws ResourceAllocationException {
- VirtualRouterProvider result = _service.addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
+ VirtualRouterProvider result = _service.get(0).addElement(getNspId(), VirtualRouterProviderType.VirtualRouter);
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
index 1157aaa7b93..3efc865e4f2 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -104,7 +104,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy router");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
index 198d8766b21..d2b26c0ac8f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java
@@ -16,20 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
index 0a93ea5ab3e..9420473a52c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java
@@ -19,18 +19,19 @@ package org.apache.cloudstack.api.command.admin.router;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
-import org.apache.cloudstack.api.response.ProviderResponse;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.PlugService;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
@@ -43,8 +44,9 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
private static final String _name = "listvirtualrouterelementsresponse";
- @PlugService
- private VirtualRouterElementService _service;
+ // TODO, VirtualRouterElementServer is not singleton in system!
+ @Inject
+ private List _service;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@@ -95,7 +97,7 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
- List extends VirtualRouterProvider> providers = _service.searchForVirtualRouterElement(this);
+ List extends VirtualRouterProvider> providers = _service.get(0).searchForVirtualRouterElement(this);
ListResponse response = new ListResponse();
List providerResponses = new ArrayList();
for (VirtualRouterProvider provider : providers) {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
index 9c50d2ffb0f..c9b518f63da 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.DomainRouterResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -98,7 +102,7 @@ public class RebootRouterCmd extends BaseAsyncCmd {
response.setResponseName("router");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
index f1f3f681829..1d3930b6b63 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.DomainRouterResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -102,7 +106,7 @@ public class StartRouterCmd extends BaseAsyncCmd {
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start router");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
index 2d1b609aa5d..60dd9386c75 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainRouterResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -109,7 +109,7 @@ public class StopRouterCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop router");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
index e2b020e09f9..b049f66f648 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
+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.DomainRouterResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.DomainRouterResponse;
import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
@@ -38,7 +42,7 @@ public class UpgradeRouterCmd extends BaseCmd {
required=true, description="The ID of the router")
private Long id;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = ServiceOfferingResponse.class,
required=true, description="the service offering ID to apply to the domain router")
private Long serviceOfferingId;
@@ -81,7 +85,7 @@ public class UpgradeRouterCmd extends BaseCmd {
routerResponse.setResponseName(getCommandName());
this.setResponseObject(routerResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade router");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
index 13f066a6e57..dbd9bff632b 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java
@@ -18,24 +18,26 @@
*/
package org.apache.cloudstack.api.command.admin.storage;
+import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM;
import static org.apache.cloudstack.api.ApiConstants.S3_ACCESS_KEY;
+import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME;
import static org.apache.cloudstack.api.ApiConstants.S3_CONNECTION_TIMEOUT;
import static org.apache.cloudstack.api.ApiConstants.S3_END_POINT;
import static org.apache.cloudstack.api.ApiConstants.S3_HTTPS_FLAG;
import static org.apache.cloudstack.api.ApiConstants.S3_MAX_ERROR_RETRY;
import static org.apache.cloudstack.api.ApiConstants.S3_SECRET_KEY;
import static org.apache.cloudstack.api.ApiConstants.S3_SOCKET_TIMEOUT;
-import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME;
+import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
import static org.apache.cloudstack.api.BaseCmd.CommandType.INTEGER;
import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING;
-import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN;
-import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+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.S3Response;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InsufficientCapacityException;
@@ -93,12 +95,12 @@ public final class AddS3Cmd extends BaseCmd {
result = _resourceService.discoverS3(this);
if (result == null) {
- throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3.");
}
} catch (DiscoveryException e) {
- throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage());
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
index 24ef48be222..b50cb277b8f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
@@ -107,7 +107,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel primary storage maintenance");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
index 78a142ac449..da9d3467792 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
@@ -19,19 +19,24 @@ package org.apache.cloudstack.api.command.admin.storage;
import java.net.UnknownHostException;
import java.util.Map;
-import org.apache.cloudstack.api.*;
+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.ClusterResponse;
import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.StoragePoolResponse;
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
+
@SuppressWarnings("rawtypes")
@APICommand(name = "createStoragePool", description="Creates a storage pool.", responseObject=StoragePoolResponse.class)
public class CreateStoragePoolCmd extends BaseCmd {
@@ -66,6 +71,14 @@ public class CreateStoragePoolCmd extends BaseCmd {
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
required=true, description="the Zone ID for the storage pool")
private Long zoneId;
+
+ @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
+ required=false, description="the storage provider uuid")
+ private String storageProviderUuid;
+
+ @Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING,
+ required=false, description="the scope of the storage: cluster or zone")
+ private String scope;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -98,6 +111,14 @@ public class CreateStoragePoolCmd extends BaseCmd {
public Long getZoneId() {
return zoneId;
}
+
+ public String getStorageProviderUuid() {
+ return this.storageProviderUuid;
+ }
+
+ public String getScope() {
+ return this.scope;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -122,17 +143,17 @@ public class CreateStoragePoolCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add storage pool");
}
} catch (ResourceUnavailableException ex1) {
s_logger.warn("Exception: ", ex1);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage());
}catch (ResourceInUseException ex2) {
s_logger.warn("Exception: ", ex2);
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex2.getMessage());
} catch (UnknownHostException ex3) {
s_logger.warn("Exception: ", ex3);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex3.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
index 1510f7822f7..6aaf53ea5bc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-import org.apache.cloudstack.api.*;
+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.StoragePoolResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.storage.StoragePool;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.user.Account;
@@ -78,9 +82,9 @@ public class DeletePoolCmd extends BaseCmd {
} else {
StoragePool pool = _storageService.getStoragePool(id);
if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed");
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete storage pool");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
index d0f6d722179..4ab71de24d0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java
@@ -26,6 +26,7 @@ import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.S3Response;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
@@ -34,7 +35,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.storage.S3;
@APICommand(name = "listS3s", description = "Lists S3s", responseObject = S3Response.class, since = "4.0.0")
-public final class ListS3sCmd extends BaseListCmd {
+public class ListS3sCmd extends BaseListCmd {
private static final String COMMAND_NAME = "lists3sresponse";
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
index 9c5c584b7cb..02b98037b2e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
@@ -16,12 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-import java.util.ArrayList;
-import java.util.List;
-
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
@@ -29,11 +24,10 @@ import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
-import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
-import com.cloud.storage.StoragePool;
-import com.cloud.utils.Pair;
@APICommand(name = "listStoragePools", description="Lists storage pools.", responseObject=StoragePoolResponse.class)
public class ListStoragePoolsCmd extends BaseListCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
index 6a4175516cc..95a92149da9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.StoragePoolResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientCapacityException;
@@ -105,7 +105,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd {
response.setResponseName("storagepool");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
index 806df561397..2ecb90f69c7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
@@ -18,11 +18,15 @@ package org.apache.cloudstack.api.command.admin.storage;
import java.util.List;
-import org.apache.cloudstack.api.*;
+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.StoragePoolResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.StoragePoolResponse;
import com.cloud.storage.StoragePool;
import com.cloud.user.Account;
@@ -78,7 +82,7 @@ public class UpdateStoragePoolCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update storage pool");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
index 23a00ca04dc..364d916add6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.swift;
-import org.apache.cloudstack.api.*;
-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.HostResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.DiscoveryException;
import com.cloud.storage.Swift;
import com.cloud.user.Account;
@@ -92,12 +96,12 @@ public class AddSwiftCmd extends BaseCmd {
swiftResponse.setObjectName("swift");
this.setResponseObject(swiftResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift");
}
} catch (DiscoveryException ex) {
String errMsg = "Failed to add Swift due to " + ex.toString();
s_logger.warn(errMsg, ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errMsg);
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
index d7c151188e7..7cfe6e1ab7f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java
@@ -20,16 +20,17 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.storage.Swift;
import com.cloud.user.Account;
+import com.cloud.utils.Pair;
@APICommand(name = "listSwifts", description = "List Swift.", responseObject = HostResponse.class, since="3.0.0")
public class ListSwiftsCmd extends BaseListCmd {
@@ -64,20 +65,19 @@ public class ListSwiftsCmd extends BaseListCmd {
@Override
public void execute(){
- List extends Swift> result = _resourceService.listSwifts(this);
+ Pair, Integer> result = _resourceService.listSwifts(this);
ListResponse response = new ListResponse();
List swiftResponses = new ArrayList();
if (result != null) {
- SwiftResponse swiftResponse = null;
- for (Swift swift : result) {
- swiftResponse = _responseGenerator.createSwiftResponse(swift);
+ for (Swift swift : result.first()) {
+ SwiftResponse swiftResponse = _responseGenerator.createSwiftResponse(swift);
swiftResponse.setResponseName(getCommandName());
swiftResponse.setObjectName("swift");
swiftResponses.add(swiftResponse);
}
}
- response.setResponses(swiftResponses);
+ response.setResponses(swiftResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
index ad0f09cba46..ef7af5c0a6f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SystemVmResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -95,7 +99,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
index 27e2ee40daf..f230a20d513 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
@@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
index dd844acd17f..31871b92b8f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
-import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
+import org.apache.cloudstack.api.response.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
@@ -116,20 +116,20 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
} catch (ManagementServerException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
} catch (VirtualMachineMigrationException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
index 49e895b22fe..6e4c925ffd5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -105,7 +105,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
index 70ab5f38720..f97d89992c9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SystemVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -109,7 +109,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
index af2bd3ad64f..5f9a3efbdf6 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SystemVmResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -112,7 +116,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
index 290c3603f1f..e91d0053c64 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
-import org.apache.cloudstack.api.*;
+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.command.user.vm.UpgradeVMCmd;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SystemVmResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -44,7 +48,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
required=true, description="The ID of the system vm")
private Long id;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
required=true, description="the service offering ID to apply to the system vm")
private Long serviceOfferingId;
@@ -94,7 +98,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
index 74f33915551..7d41d10ae08 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java
@@ -18,15 +18,15 @@ package org.apache.cloudstack.api.command.admin.template;
import java.util.List;
-import org.apache.cloudstack.api.response.ZoneResponse;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
new file mode 100644
index 00000000000..48424fef246
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java
@@ -0,0 +1,107 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.usage;
+
+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 org.apache.cloudstack.api.response.TrafficMonitorResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.host.Host;
+import com.cloud.user.Account;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+@APICommand(name = "addTrafficMonitor", description="Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class)
+public class AddTrafficMonitorCmd extends BaseCmd {
+ public static final Logger s_logger = Logger.getLogger(AddTrafficMonitorCmd.class.getName());
+ private static final String s_name = "addtrafficmonitorresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
+ required = true, description="Zone in which to add the external firewall appliance.")
+ private Long zoneId;
+
+ @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the traffic monitor Host")
+ private String url;
+
+ @Parameter(name=ApiConstants.INCL_ZONES, type=CommandType.STRING, description="Traffic going into the listed zones will be metered")
+ private String inclZones;
+
+ @Parameter(name=ApiConstants.EXCL_ZONES, type=CommandType.STRING, description="Traffic going into the listed zones will not be metered")
+ private String exclZones;
+
+ ///////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getInclZones() {
+ return inclZones;
+ }
+
+ public String getExclZones() {
+ return exclZones;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute(){
+ try {
+ Host trafficMonitor = _networkUsageService.addTrafficMonitor(this);
+ TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor);
+ response.setObjectName("trafficmonitor");
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } catch (InvalidParameterValueException ipve) {
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage());
+ } catch (CloudRuntimeException cre) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage());
+ }
+ }
+}
+
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
index 5dca9d2d4c1..7211bae8dd4 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.usage;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -123,7 +123,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
@@ -134,7 +134,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network");
}
}
diff --git a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
similarity index 51%
rename from server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java
rename to api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
index 4c7d3a70546..e3bb299dc30 100644
--- a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java
@@ -14,73 +14,71 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.api.commands;
+package org.apache.cloudstack.api.command.admin.usage;
-import org.apache.cloudstack.api.response.HostResponse;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.HostResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.NetworkUsageManager;
-import com.cloud.server.ManagementService;
import com.cloud.user.Account;
-import com.cloud.utils.component.ComponentLocator;
@APICommand(name = "deleteTrafficMonitor", description="Deletes an traffic monitor host.", responseObject = SuccessResponse.class)
public class DeleteTrafficMonitorCmd extends BaseCmd {
- public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName());
- private static final String s_name = "deletetrafficmonitorresponse";
-
- /////////////////////////////////////////////////////
+ public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName());
+ private static final String s_name = "deletetrafficmonitorresponse";
+
+ /////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
-
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class,
- required = true, description="Id of the Traffic Monitor Host.")
- private Long id;
-
- ///////////////////////////////////////////////////
- /////////////////// Accessors ///////////////////////
- /////////////////////////////////////////////////////
-
- public Long getId() {
- return id;
- }
-
- /////////////////////////////////////////////////////
- /////////////// API Implementation///////////////////
- /////////////////////////////////////////////////////
- @Override
- public String getCommandName() {
- return s_name;
- }
-
- @Override
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class,
+ required = true, description="Id of the Traffic Monitor Host.")
+ private Long id;
+
+ ///////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
-
- @Override
+
+ @Override
public void execute(){
- try {
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- NetworkUsageManager _networkUsageMgr = locator.getManager(NetworkUsageManager.class);
- boolean result = _networkUsageMgr.deleteTrafficMonitor(this);
- if (result) {
- SuccessResponse response = new SuccessResponse(getCommandName());
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic monitor.");
- }
- } catch (InvalidParameterValueException e) {
- throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to delete traffic monitor.");
- }
+ try {
+ boolean result = _networkUsageService.deleteTrafficMonitor(this);
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic monitor.");
+ }
+ } catch (InvalidParameterValueException e) {
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete traffic monitor.");
+ }
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
index bb665fbfd58..32e0512a20f 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.usage;
-import org.apache.cloudstack.api.response.TrafficTypeResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.TrafficTypeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -73,7 +73,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic type");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic type");
}
}
diff --git a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
similarity index 91%
rename from server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java
rename to api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
index aa3c082ce81..13710f97490 100644
--- a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java
@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.api.commands;
+package org.apache.cloudstack.api.command.admin.usage;
import java.util.Date;
@@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.SuccessResponse;
-import com.cloud.server.ManagementServerExt;
import com.cloud.user.Account;
@APICommand(name = "generateUsageRecords", description="Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed", responseObject=SuccessResponse.class)
@@ -79,13 +78,12 @@ public class GenerateUsageRecordsCmd extends BaseCmd {
@Override
public void execute(){
- ManagementServerExt _mgrExt = (ManagementServerExt)_mgr;
- boolean result = _mgrExt.generateUsageRecords(this);
+ boolean result = _usageService.generateUsageRecords(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to generate usage records");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate usage records");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
new file mode 100644
index 00000000000..f4960dd0e08
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java
@@ -0,0 +1,126 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.admin.usage;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.UsageRecordResponse;
+import org.apache.cloudstack.usage.Usage;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listUsageRecords", description="Lists usage records for accounts", responseObject=UsageRecordResponse.class)
+public class GetUsageRecordsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(GetUsageRecordsCmd.class.getName());
+
+ private static final String s_name = "listusagerecordsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List usage records for the specified user.")
+ private String accountName;
+
+ @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
+ description="List usage records for the specified domain.")
+ private Long domainId;
+
+ @Parameter(name=ApiConstants.END_DATE, type=CommandType.DATE, required=true, description="End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.")
+ private Date endDate;
+
+ @Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, required=true, description="Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
+ private Date startDate;
+
+ @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
+ description="List usage records for the specified account")
+ private Long accountId;
+
+ @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
+ description="List usage records for specified project")
+ private Long projectId;
+
+ @Parameter(name=ApiConstants.TYPE, type=CommandType.LONG, description="List usage records for the specified usage type")
+ private Long usageType;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public Date getEndDate() {
+ return endDate;
+ }
+
+ public Date getStartDate() {
+ return startDate;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+
+ public Long getUsageType() {
+ return usageType;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List extends Usage> usageRecords = _usageService.getUsageRecords(this);
+ ListResponse response = new ListResponse();
+ List usageResponses = new ArrayList();
+ for(Usage usageRecord: usageRecords){
+ UsageRecordResponse usageResponse = _responseGenerator.createUsageResponse(usageRecord);
+ usageResponse.setObjectName("usagerecord");
+ usageResponses.add(usageResponse);
+ }
+
+ response.setResponses(usageResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
similarity index 79%
rename from server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
rename to api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
index 21ad339137a..e8e3b22c15b 100644
--- a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java
@@ -14,29 +14,29 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.api.commands;
+package org.apache.cloudstack.api.command.admin.usage;
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.host.Host;
-import com.cloud.network.NetworkUsageManager;
-import com.cloud.server.ManagementService;
-import org.apache.cloudstack.api.response.TrafficMonitorResponse;
-import com.cloud.utils.component.ComponentLocator;
+
@APICommand(name = "listTrafficMonitors", description="List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class)
public class ListTrafficMonitorsCmd extends BaseListCmd {
- public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
+ public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
private static final String s_name = "listtrafficmonitorsresponse";
/////////////////////////////////////////////////////
@@ -66,17 +66,15 @@ public class ListTrafficMonitorsCmd extends BaseListCmd {
@Override
public void execute(){
- ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
- NetworkUsageManager networkUsageMgr = locator.getManager(NetworkUsageManager.class);
- List extends Host> trafficMonitors = networkUsageMgr.listTrafficMonitors(this);
+ List extends Host> trafficMonitors = _networkUsageService.listTrafficMonitors(this);
ListResponse listResponse = new ListResponse();
List responses = new ArrayList();
for (Host trafficMonitor : trafficMonitors) {
- TrafficMonitorResponse response = networkUsageMgr.getApiResponse(trafficMonitor);
- response.setObjectName("trafficmonitor");
- response.setResponseName(getCommandName());
- responses.add(response);
+ TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor);
+ response.setObjectName("trafficmonitor");
+ response.setResponseName(getCommandName());
+ responses.add(response);
}
listResponse.setResponses(responses);
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
index 3cd00c02af7..14b69c39437 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java
@@ -19,12 +19,15 @@ package org.apache.cloudstack.api.command.admin.usage;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TrafficTypeImplementorResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
index 2cbb13df0d3..f239996a769 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java
@@ -20,15 +20,15 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
diff --git a/server/src/com/cloud/api/commands/ListUsageTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
similarity index 90%
rename from server/src/com/cloud/api/commands/ListUsageTypesCmd.java
rename to api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
index dfa5dc1bb20..bc029117350 100644
--- a/server/src/com/cloud/api/commands/ListUsageTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java
@@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.api.commands;
+package org.apache.cloudstack.api.command.admin.usage;
import java.util.List;
@@ -23,7 +23,6 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.ListResponse;
-import com.cloud.server.ManagementServerExt;
import org.apache.cloudstack.api.response.UsageTypeResponse;
import com.cloud.user.Account;
@@ -43,8 +42,7 @@ public class ListUsageTypesCmd extends BaseCmd {
@Override
public void execute() {
- ManagementServerExt _mgrExt = (ManagementServerExt)_mgr;
- List result = _mgrExt.listUsageTypes();
+ List result = _usageService.listUsageTypes();
ListResponse response = new ListResponse();
response.setResponses(result);
response.setResponseName(getCommandName());
diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
index 279c2b858d3..d3cf3f8434e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.usage;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.PhysicalNetworkTrafficType;
@@ -95,7 +95,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update traffic type");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
index 2045abf4e93..d1f72c45dd7 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@@ -64,6 +65,12 @@ public class CreateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.")
private String username;
+ @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
+ private String userUUID;
+
+ @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the User")
+ private Integer regionId;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -100,6 +107,14 @@ public class CreateUserCmd extends BaseCmd {
return username;
}
+ public String getUserUUID() {
+ return userUUID;
+ }
+
+ public Integer getRegionId() {
+ return regionId;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -131,13 +146,13 @@ public class CreateUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName());
- User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId());
+ User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID(), getRegionId());
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
index a43501e7641..e8f671de1b9 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java
@@ -16,15 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
+import javax.inject.Inject;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.SuccessResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserContext;
@@ -41,6 +45,11 @@ public class DeleteUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -49,6 +58,10 @@ public class DeleteUserCmd extends BaseCmd {
return id;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -71,12 +84,12 @@ public class DeleteUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
- boolean result = _accountService.deleteUser(this);
+ boolean result = _regionService.deleteUser(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
index f483e628928..95013ec30bc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java
@@ -16,15 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
+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.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -45,6 +49,11 @@ public class DisableUserCmd extends BaseAsyncCmd {
required=true, description="Disables user by user ID.")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -53,6 +62,10 @@ public class DisableUserCmd extends BaseAsyncCmd {
return id;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -86,13 +99,14 @@ public class DisableUserCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
- UserAccount user = _accountService.disableUser(getId());
+ UserAccount user = _regionService.disableUser(this);
+
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
index e444aa395d2..c1ba9003b05 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java
@@ -16,11 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+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 org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
@@ -39,7 +46,11 @@ public class EnableUserCmd extends BaseCmd {
required=true, description="Enables user by user ID.")
private Long id;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -48,6 +59,10 @@ public class EnableUserCmd extends BaseCmd {
return id;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -70,13 +85,14 @@ public class EnableUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
- UserAccount user = _accountService.enableUser(getId());
+ UserAccount user = _regionService.enableUser(this);
+
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
index 2ffe4ab245d..c7b7e09eee5 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java
@@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.UserAccount;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
index 3d68e2f48c9..c5c466c1f35 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java
@@ -16,14 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
@APICommand(name = "listUsers", description="Lists user accounts", responseObject=UserResponse.class)
public class ListUsersCmd extends BaseListAccountResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
index 622b4e9a023..dbe330317a0 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java
@@ -16,14 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
@@ -77,7 +78,7 @@ public class LockUserCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock user");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
index 06ffc537995..c92e65db66d 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java
@@ -16,14 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.RegisterResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
index 170d852ff58..ee59d07cb79 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java
@@ -16,11 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.user;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+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 org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
@@ -64,6 +71,11 @@ public class UpdateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="Unique username")
private String username;
+ @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
+ private Boolean isPropagate;
+
+ @Inject RegionService _regionService;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -104,6 +116,10 @@ public class UpdateUserCmd extends BaseCmd {
return username;
}
+ public Boolean getIsPropagate() {
+ return isPropagate;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -126,13 +142,14 @@ public class UpdateUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
- UserAccount user = _accountService.updateUser(this);
+ UserAccount user = _regionService.updateUser(this);
+
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update user");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
index c9717480e44..541da1ece50 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java
@@ -16,17 +16,21 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vlan;
-import org.apache.cloudstack.api.*;
-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.DomainResponse;
-import org.apache.cloudstack.api.response.PodResponse;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.Vlan;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -71,7 +75,7 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
description="optional parameter. Have to be specified for Direct Untagged vlan only.")
private Long podId;
- @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the VLAN IP range")
+ @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, description="the beginning IP address in the VLAN IP range")
private String startIp;
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. If not specified," +
@@ -90,6 +94,19 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
description="the physical network id")
private Long physicalNetworkId;
+ @Parameter(name=ApiConstants.START_IPV6, type=CommandType.STRING, description="the beginning IPv6 address in the IPv6 network range")
+ private String startIpv6;
+
+ @Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range")
+ private String endIpv6;
+
+ @Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
+ "for Shared networks and Isolated networks when it belongs to VPC")
+ private String ip6Gateway;
+
+ @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
+ private String ip6Cidr;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -137,6 +154,35 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
public Long getProjectId() {
return projectId;
}
+
+ public String getStartIpv6() {
+ if (startIpv6 == null) {
+ return null;
+ }
+ return startIpv6.toLowerCase();
+ }
+
+ public String getEndIpv6() {
+ if (endIpv6 == null) {
+ return null;
+ }
+ return endIpv6.toLowerCase();
+ }
+
+ public String getIp6Gateway() {
+ if (ip6Gateway == null) {
+ return null;
+ }
+ return ip6Gateway.toLowerCase();
+ }
+
+ public String getIp6Cidr() {
+ if (ip6Cidr == null) {
+ return null;
+ }
+ return ip6Cidr.toLowerCase();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -149,7 +195,6 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
return physicalNetworkId;
}
-
@Override
public String getCommandName() {
return s_name;
@@ -169,14 +214,14 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vlan ip range");
}
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
index f12b2175aef..6023b3d6dcd 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vlan;
-import org.apache.cloudstack.api.response.VlanIpRangeResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.SuccessResponse;
+import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteVlanIpRange", description="Creates a VLAN IP range.", responseObject=SuccessResponse.class)
@@ -70,7 +71,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vlan ip range");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
index 9b6b997c4b8..db6006a6f5c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java
@@ -20,19 +20,19 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PodResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.Vlan;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
index 3482ec756fb..8a75c66531c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java
@@ -19,16 +19,19 @@ package org.apache.cloudstack.api.command.admin.vm;
import java.util.List;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
-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.command.user.vm.DeployVMCmd;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@@ -101,14 +104,14 @@ public class AssignVMCmd extends BaseCmd {
try {
UserVm userVm = _userVmService.moveVMToUser(this);
if (userVm == null){
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm");
}
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0);
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
}catch (Exception e){
e.printStackTrace();
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm " + e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm " + e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
index 5bb694da655..ddba78ea083 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java
@@ -16,14 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vm;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
@@ -150,20 +153,20 @@ public class MigrateVMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm");
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
} catch (ManagementServerException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
} catch (VirtualMachineMigrationException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
index f8308614b89..13e755c5791 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java
@@ -16,14 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ResourceAllocationException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@@ -77,7 +78,7 @@ public class RecoverVMCmd extends BaseCmd {
recoverVmResponse.setResponseName(getCommandName());
this.setResponseObject(recoverVmResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
index 5bb76ab034b..9fd736f8543 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java
@@ -16,18 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
+import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -115,17 +115,17 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
} catch (InsufficientCapacityException ex){
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
if (result != null) {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway");
}
}
@@ -138,7 +138,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index 273f7c05233..3c7956b7d7e 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import java.util.List;
-
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
+import java.util.*;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.network.vpc.VpcOffering;
@@ -48,6 +52,10 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
description="services supported by the vpc offering")
private List supportedServices;
+ @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. " +
+ "If not specified, the provider for the service will be mapped to the default provider on the physical network")
+ private Map serviceProviderList;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -64,15 +72,38 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
return supportedServices;
}
+ public Map> getServiceProviders() {
+ Map> serviceProviderMap = null;
+ if (serviceProviderList != null && !serviceProviderList.isEmpty()) {
+ serviceProviderMap = new HashMap>();
+ Collection servicesCollection = serviceProviderList.values();
+ Iterator iter = servicesCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap services = (HashMap) iter.next();
+ String service = services.get("service");
+ String provider = services.get("provider");
+ List providerList = null;
+ if (serviceProviderMap.containsKey(service)) {
+ providerList = serviceProviderMap.get(service);
+ } else {
+ providerList = new ArrayList();
+ }
+ providerList.add(provider);
+ serviceProviderMap.put(service, providerList);
+ }
+ }
+
+ return serviceProviderMap;
+ }
@Override
public void create() throws ResourceAllocationException {
- VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices());
+ VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders());
if (vpcOff != null) {
this.setEntityId(vpcOff.getId());
this.setEntityUuid(vpcOff.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC offering");
}
}
@@ -84,7 +115,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC offering");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
index 4a1e8d05912..182a19e0622 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import org.apache.cloudstack.api.response.PrivateGatewayResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -87,7 +87,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete private gateway");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
index 231f2ee2955..9e2968e66fe 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import org.apache.cloudstack.api.response.VpcOfferingResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
@@ -71,7 +71,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC offering");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
index 65df48e3e1f..de61ee74b31 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.VpcOfferingResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.user.Account;
@@ -90,7 +94,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC offering");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC offering");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
index e49f2439288..5cc905227ab 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.zone;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -46,6 +46,12 @@ public class CreateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone")
private String dns2;
+ @Parameter(name=ApiConstants.IP6_DNS1, type=CommandType.STRING, description="the first DNS for IPv6 network in the Zone")
+ private String ip6Dns1;
+
+ @Parameter(name=ApiConstants.IP6_DNS2, type=CommandType.STRING, description="the second DNS for IPv6 network in the Zone")
+ private String ip6Dns2;
+
@Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone")
private String guestCidrAddress;
@@ -89,6 +95,14 @@ public class CreateZoneCmd extends BaseCmd {
return dns2;
}
+ public String getIp6Dns1() {
+ return ip6Dns1;
+ }
+
+ public String getIp6Dns2() {
+ return ip6Dns2;
+ }
+
public String getGuestCidrAddress() {
return guestCidrAddress;
}
@@ -156,7 +170,7 @@ public class CreateZoneCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a zone");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
index d09c7fff891..e3d14f729e3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.admin.zone;
-import org.apache.cloudstack.api.*;
-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.SuccessResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -71,7 +75,7 @@ public class DeleteZoneCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete zone");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
index 816befbd029..858457bf4fc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java
@@ -17,21 +17,20 @@
package org.apache.cloudstack.api.command.admin.zone;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ApiConstants;
-import com.cloud.user.Account;
-import com.cloud.event.EventTypes;
-import com.cloud.async.AsyncJob;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.BaseCmd;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
@APICommand(name = "markDefaultZoneForAccount", description="Marks a default zone for this account", responseObject=AccountResponse.class, since="4.0")
public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
@@ -109,7 +108,7 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd {
this.setResponseObject(response);
}
else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
index 0bfd1a31a0f..16c334eebc8 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java
@@ -19,11 +19,15 @@ package org.apache.cloudstack.api.command.admin.zone;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.api.*;
+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.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ZoneResponse;
import com.cloud.dc.DataCenter;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -44,6 +48,12 @@ public class UpdateZoneCmd extends BaseCmd {
@Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone")
private String dns2;
+ @Parameter(name=ApiConstants.IP6_DNS1, type=CommandType.STRING, description="the first DNS for IPv6 network in the Zone")
+ private String ip6Dns1;
+
+ @Parameter(name=ApiConstants.IP6_DNS2, type=CommandType.STRING, description="the second DNS for IPv6 network in the Zone")
+ private String ip6Dns2;
+
@Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone")
private String guestCidrAddress;
@@ -101,6 +111,14 @@ public class UpdateZoneCmd extends BaseCmd {
return id;
}
+ public String getIp6Dns1() {
+ return ip6Dns1;
+ }
+
+ public String getIp6Dns2() {
+ return ip6Dns2;
+ }
+
public String getInternalDns1() {
return internalDns1;
}
@@ -164,7 +182,7 @@ public class UpdateZoneCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update zone; internal error.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update zone; internal error.");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
index 889c3697515..ebc22723585 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.account;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
@@ -87,7 +91,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
index f9e967ad4c2..df6deae1887 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.account;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.user.project.DeleteProjectCmd;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
@@ -76,7 +80,7 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
index f679a5ae7d1..ebf2e4ba037 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java
@@ -16,21 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.account;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.UserResponse;
-
-import com.cloud.user.Account;
-import com.cloud.utils.Pair;
+import org.apache.log4j.Logger;
@APICommand(name = "listAccounts", description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class)
public class ListAccountsCmd extends BaseListDomainResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
index 2c279db64a8..c91e2f2b5d1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java
@@ -17,14 +17,13 @@
package org.apache.cloudstack.api.command.user.account;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
index 93bb2401d8f..406f782da51 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java
@@ -18,21 +18,21 @@ package org.apache.cloudstack.api.command.user.address;
import java.util.List;
-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.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -219,15 +219,15 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
this.setEntityId(ip.getId());
this.setEntityUuid(ip.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to allocate ip address");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address");
}
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientAddressCapacityException ex) {
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
}
@@ -249,7 +249,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
ipResponse.setResponseName(getCommandName());
this.setResponseObject(ipResponse);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index 20ccd89ba84..827111902ff 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.address;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientAddressCapacityException;
@@ -75,7 +79,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disassociate ip address");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disassociate ip address");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
index 06b08da6907..ac0f823c1f4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java
@@ -19,19 +19,19 @@ package org.apache.cloudstack.api.command.user.address;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.network.IpAddress;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
index e92721d77bf..f6e4f96ddb1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java
@@ -18,12 +18,16 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.List;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import com.cloud.async.AsyncJob;
import com.cloud.domain.Domain;
import com.cloud.event.EventTypes;
@@ -157,7 +161,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create AutoScale Policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create AutoScale Policy");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
index e3d47a09c7d..135c87717be 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java
@@ -18,14 +18,18 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.List;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
+import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -159,7 +163,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
}
}
@@ -182,7 +186,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd {
} finally {
if (!success || vmGroup == null) {
_autoScaleService.deleteAutoScaleVmGroup(getEntityId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
index 25bb03b778f..87d4466e79a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java
@@ -19,19 +19,19 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.HashMap;
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -56,7 +56,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
required = true, description = "availability zone for the auto deployed virtual machine")
private Long zoneId;
- @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class,
+ @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class,
required = true, description = "the service offering of the auto deployed virtual machine")
private Long serviceOfferingId;
@@ -231,7 +231,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
this.setEntityId(result.getId());
this.setEntityUuid(result.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
index 58926f2a4ff..3eff5d08e8b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java
@@ -17,17 +17,17 @@
package org.apache.cloudstack.api.command.user.autoscale;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ConditionResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -74,7 +74,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
this.setEntityId(condition.getId());
this.setEntityUuid(condition.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create condition.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create condition.");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
index 483a87ac892..f8b3595660b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScalePolicy;
@@ -92,7 +92,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale policy " + getId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete AutoScale Policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
index 1d78fe80395..d0107368e85 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
@@ -92,7 +92,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale vm group " + getId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
index e49f0c862a3..c55973c91d6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmProfile;
@@ -91,7 +91,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd {
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete autoscale vm profile " + getId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm profile");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
index a1fba2e3725..57e38f9ab1e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java
@@ -17,16 +17,16 @@
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.response.ConditionResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceInUseException;
@@ -57,14 +57,14 @@ public class DeleteConditionCmd extends BaseAsyncCmd {
result = _autoScaleService.deleteCondition(getId());
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
s_logger.warn("Failed to delete condition " + getId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete condition.");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition.");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
index 2aba82c2a93..5d2fb4bd18e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java
@@ -17,15 +17,15 @@
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
@@ -56,7 +56,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
index db7acdf5d98..5cb7e56058e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java
@@ -17,11 +17,15 @@
package org.apache.cloudstack.api.command.user.autoscale;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
@@ -52,7 +56,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
index 31621442252..8426db8c1f0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
-import org.apache.cloudstack.api.response.ConditionResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
+import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
+import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.as.AutoScalePolicy;
@APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
index 7561757fcab..5b3ee42e588 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
@@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.as.AutoScaleVmGroup;
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
index 7a88db3e7b9..8afdf028ed2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
@@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.TemplateResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.as.AutoScaleVmProfile;
@APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
index 0b3ffec040c..1c949232403 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java
@@ -20,16 +20,16 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.as.Condition;
@APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = CounterResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
index 66a38f34396..bd6790d67fc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java
@@ -21,13 +21,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.as.Counter;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
index 56d71078ece..fbe2be840dc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.List;
-import org.apache.cloudstack.api.response.ConditionResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
+import org.apache.cloudstack.api.response.ConditionResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScalePolicy;
@@ -68,7 +68,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale policy");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
index ea5b6a9f489..5acfb942f09 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java
@@ -19,12 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.List;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
+import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmGroup;
@@ -75,7 +79,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale VmGroup");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale VmGroup");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
index c8ef8b11198..34def9daca3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java
@@ -19,13 +19,17 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.Map;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.as.AutoScaleVmProfile;
@@ -73,7 +77,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale vm profile");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
index 129aeb85d24..eb862e62f47 100644
--- a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java
@@ -18,11 +18,11 @@ package org.apache.cloudstack.api.command.user.config;
import java.util.Map;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.response.CapabilitiesResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.CapabilitiesResponse;
import com.cloud.user.Account;
@APICommand(name = "listCapabilities", description="Lists capabilities", responseObject=CapabilitiesResponse.class)
@@ -52,6 +52,8 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
+ response.setApiLimitInterval((Integer)capabilities.get("apiLimitInterval"));
+ response.setApiLimitMax((Integer)capabilities.get("apiLimitMax"));
response.setObjectName("capability");
response.setResponseName(getCommandName());
this.setResponseObject(response);
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
index 4c432f35ebb..9cbc204b7c9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java
@@ -19,11 +19,11 @@ package org.apache.cloudstack.api.command.user.event;
import java.util.ArrayList;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.EventTypeResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
index 94205d13226..63fa194c8ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java
@@ -17,14 +17,14 @@
package org.apache.cloudstack.api.command.user.event;
import java.util.Date;
-import org.apache.log4j.Logger;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
@APICommand(name = "listEvents", description="A command to list events.", responseObject=EventResponse.class)
public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
new file mode 100644
index 00000000000..097b2c55f80
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java
@@ -0,0 +1,341 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.package org.apache.cloudstack.api.command.user.firewall;
+
+package org.apache.cloudstack.api.command.user.firewall;
+
+import java.util.ArrayList;
+import java.util.List;
+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.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.Network;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.utils.net.NetUtils;
+
+@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class)
+public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule {
+ public static final Logger s_logger = Logger.getLogger(CreateEgressFirewallRuleCmd.class.getName());
+
+ private static final String s_name = "createegressfirewallruleresponse";
+
+ // ///////////////////////////////////////////////////
+ // ////////////// API parameters /////////////////////
+ // ///////////////////////////////////////////////////
+
+ @Parameter (name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the network id of the port forwarding rule")
+ private Long networkId;
+
+ @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.")
+ private String protocol;
+
+ @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule")
+ private Integer publicStartPort;
+
+ @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule")
+ private Integer publicEndPort;
+
+ @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from")
+ private List cidrlist;
+
+ @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent")
+ private Integer icmpType;
+
+ @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message")
+ private Integer icmpCode;
+
+ @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user")
+ private String type;
+
+ // ///////////////////////////////////////////////////
+ // ///////////////// Accessors ///////////////////////
+ // ///////////////////////////////////////////////////
+
+ public Long getIpAddressId() {
+ return null;
+ }
+
+ @Override
+ public String getProtocol() {
+ return protocol.trim();
+ }
+
+ @Override
+ public List getSourceCidrList() {
+ if (cidrlist != null) {
+ return cidrlist;
+ } else {
+ List oneCidrList = new ArrayList();
+ oneCidrList.add(_networkService.getNetwork(networkId).getCidr());
+ return oneCidrList;
+ }
+ }
+
+ public Long getVpcId() {
+ Network network = _networkService.getNetwork(getNetworkId());
+ if (network == null) {
+ throw new InvalidParameterValueException("Invalid networkId is given");
+ }
+
+ Long vpcId = network.getVpcId();
+ return vpcId;
+ }
+
+
+
+ // ///////////////////////////////////////////////////
+ // ///////////// API Implementation///////////////////
+ // ///////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public void setSourceCidrList(List cidrs){
+ cidrlist = cidrs;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ UserContext callerContext = UserContext.current();
+ boolean success = false;
+ FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
+ try {
+ UserContext.current().setEventDetails("Rule Id: " + getEntityId());
+ success = _firewallService.applyEgressFirewallRules (rule, callerContext.getCaller());
+ // State is different after the rule is applied, so get new object here
+ rule = _entityMgr.findById(FirewallRule.class, getEntityId());
+ FirewallResponse fwResponse = new FirewallResponse();
+ if (rule != null) {
+ fwResponse = _responseGenerator.createFirewallResponse(rule);
+ setResponseObject(fwResponse);
+ }
+ fwResponse.setResponseName(getCommandName());
+ } finally {
+ if (!success || rule == null) {
+ _firewallService.revokeFirewallRule(getEntityId(), true);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create firewall rule");
+ }
+ }
+ }
+
+ @Override
+ public long getId() {
+ throw new UnsupportedOperationException("database id can only provided by VO objects");
+ }
+
+ @Override
+ public String getXid() {
+ // FIXME: We should allow for end user to specify Xid.
+ return null;
+ }
+
+ @Override
+ public Long getSourceIpAddressId() {
+ return null;
+ }
+
+ @Override
+ public Integer getSourcePortStart() {
+ if (publicStartPort != null) {
+ return publicStartPort.intValue();
+ }
+ return null;
+ }
+
+ @Override
+ public Integer getSourcePortEnd() {
+ if (publicEndPort == null) {
+ if (publicStartPort != null) {
+ return publicStartPort.intValue();
+ }
+ } else {
+ return publicEndPort.intValue();
+ }
+
+ return null;
+ }
+
+ @Override
+ public Purpose getPurpose() {
+ return Purpose.Firewall;
+ }
+
+ @Override
+ public State getState() {
+ throw new UnsupportedOperationException("Should never call me to find the state");
+ }
+
+ @Override
+ public long getNetworkId() {
+ return networkId;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ Account account = UserContext.current().getCaller();
+
+ if (account != null) {
+ return account.getId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ @Override
+ public long getDomainId() {
+ Network network =_networkService.getNetwork(networkId);
+ return network.getDomainId();
+ }
+
+ @Override
+ public void create() {
+ if (getSourceCidrList() != null) {
+ String guestCidr = _networkService.getNetwork(getNetworkId()).getCidr();
+
+ for (String cidr: getSourceCidrList()){
+ if (!NetUtils.isValidCIDR(cidr)){
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
+ }
+ if (cidr.equals(NetUtils.ALL_CIDRS)) {
+ continue;
+ }
+ if(!NetUtils.isNetworkAWithinNetworkB(cidr, guestCidr)) {
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, cidr + "is not within the guest cidr " + guestCidr);
+ }
+ }
+ }
+ if (getProtocol().equalsIgnoreCase(NetUtils.ALL_PROTO)) {
+ if (getSourcePortStart() != null && getSourcePortEnd() != null) {
+ throw new InvalidParameterValueException("Do not pass ports to protocol ALL, porotocol ALL do not require ports. Unable to create "
+ +"firewall rule for the network id=" + networkId);
+ }
+ }
+
+ if (getVpcId() != null ){
+ throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId +
+ " as firewall egress rule can be created only for non vpc networks.");
+ }
+
+ try {
+ FirewallRule result = _firewallService.createEgressFirewallRule(this);
+ setEntityId(result.getId());
+ } catch (NetworkRuleConflictException ex) {
+ s_logger.info("Network rule conflict: " + ex.getMessage());
+ s_logger.trace("Network Rule Conflict: ", ex);
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ }
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_FIREWALL_OPEN;
+ }
+
+ @Override
+ public String getEventDescription() {
+ Network network = _networkService.getNetwork(networkId);
+ return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol());
+ }
+
+
+ @Override
+ public long getAccountId() {
+ Network network = _networkService.getNetwork(networkId);
+ return network.getAccountId();
+ }
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ return getNetworkId();
+ }
+
+
+ @Override
+ public Integer getIcmpCode() {
+ if (icmpCode != null) {
+ return icmpCode;
+ } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+ return -1;
+ }
+ return null;
+ }
+
+ @Override
+ public Integer getIcmpType() {
+ if (icmpType != null) {
+ return icmpType;
+ } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) {
+ return -1;
+
+ }
+ return null;
+ }
+
+ @Override
+ public Long getRelated() {
+ return null;
+ }
+
+ @Override
+ public FirewallRuleType getType() {
+ if (type != null && type.equalsIgnoreCase("system")) {
+ return FirewallRuleType.System;
+ } else {
+ return FirewallRuleType.User;
+ }
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.FirewallRule;
+ }
+
+ @Override
+ public TrafficType getTrafficType() {
+ return TrafficType.Egress;
+ }
+
+ @Override
+ public String getUuid() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
index 7039b417ced..b7cb4712047 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-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.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -121,7 +121,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
try {
UserContext.current().setEventDetails("Rule Id: " + getEntityId());
- success = _firewallService.applyFirewallRules(rule.getSourceIpAddressId(), callerContext.getCaller());
+ success = _firewallService.applyIngressFirewallRules(rule.getSourceIpAddressId(), callerContext.getCaller());
// State is different after the rule is applied, so get new object here
rule = _entityMgr.findById(FirewallRule.class, getEntityId());
@@ -134,7 +134,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
} finally {
if (!success || rule == null) {
_firewallService.revokeFirewallRule(getEntityId(), true);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create firewall rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create firewall rule");
}
}
}
@@ -231,19 +231,19 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
if (getSourceCidrList() != null) {
for (String cidr: getSourceCidrList()){
if (!NetUtils.isValidCIDR(cidr)){
- throw new ServerApiException(BaseCmd.PARAM_ERROR, "Source cidrs formatting error " + cidr);
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
}
}
}
try {
- FirewallRule result = _firewallService.createFirewallRule(this);
+ FirewallRule result = _firewallService.createIngressFirewallRule(this);
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network Rule Conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
@@ -324,7 +324,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
@Override
public TrafficType getTrafficType() {
- return null;
+ return FirewallRule.TrafficType.Ingress;
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
index 1feefde9a1a..39ab812909d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java
@@ -18,14 +18,19 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.List;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -163,7 +168,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
UserContext.current().setEventDetails("Rule Id: " + getEntityId());
if (getOpenFirewall()) {
- success = success && _firewallService.applyFirewallRules(ipAddressId, callerContext.getCaller());
+ success = success && _firewallService.applyIngressFirewallRules(ipAddressId, callerContext.getCaller());
}
success = success && _rulesService.applyPortForwardingRules(ipAddressId, callerContext.getCaller());
@@ -185,7 +190,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
_rulesService.revokePortForwardingRule(getEntityId(), true);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply port forwarding rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply port forwarding rule");
}
}
}
@@ -302,7 +307,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " , ex);
s_logger.trace("Network Rule Conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
new file mode 100644
index 00000000000..0e1d48640bc
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java
@@ -0,0 +1,122 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.package org.apache.cloudstack.api.command.user.firewall;
+
+package org.apache.cloudstack.api.command.user.firewall;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.user.UserContext;
+
+@APICommand(name = "deleteEgressFirewallRule", description="Deletes an ggress firewall rule", responseObject=SuccessResponse.class)
+public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(DeleteEgressFirewallRuleCmd.class.getName());
+ private static final String s_name = "deleteegressfirewallruleresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class, required=true, description="the ID of the firewall rule")
+ private Long id;
+
+ // unexposed parameter needed for events logging
+ @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class, expose=false)
+ private Long ownerId;
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_FIREWALL_CLOSE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return ("Deleting egress firewall rule id=" + id);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ if (ownerId == null) {
+ FirewallRule rule = _entityMgr.findById(FirewallRule.class, id);
+ if (rule == null) {
+ throw new InvalidParameterValueException("Unable to find egress firewall rule by id");
+ } else {
+ ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId();
+ }
+ }
+ return ownerId;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException {
+ UserContext.current().setEventDetails("Rule Id: " + id);
+ boolean result = _firewallService.revokeFirewallRule(id, true);
+
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete egress firewall rule");
+ }
+ }
+
+
+ @Override
+ public String getSyncObjType() {
+ return BaseAsyncCmd.networkSyncObject;
+ }
+
+ @Override
+ public Long getSyncObjId() {
+ return _firewallService.getFirewallRule(id).getNetworkId();
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.FirewallRule;
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
index 5655b5e430f..b9008282978 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.firewall;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -95,7 +99,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete firewall rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete firewall rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
index 8f4d5996df8..838859585ad 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.firewall;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -97,7 +101,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete port forwarding rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete port forwarding rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
new file mode 100644
index 00000000000..b5eed754794
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java
@@ -0,0 +1,91 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.package org.apache.cloudstack.api.command.user.firewall;
+
+package org.apache.cloudstack.api.command.user.firewall;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import com.cloud.network.rules.FirewallRule;
+import com.cloud.utils.Pair;
+
+@APICommand(name = "listEgressFirewallRules", description="Lists all egress firewall rules for network id.", responseObject=FirewallResponse.class)
+public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd {
+ public static final Logger s_logger = Logger.getLogger(ListEgressFirewallRulesCmd.class.getName());
+ private static final String s_name = "listegressfirewallrulesresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class, description="Lists rule with the specified ID.")
+ private Long id;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, description="the id network network for the egress firwall services")
+ private Long networkId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getNetworkId() {
+ return networkId;
+ }
+
+ public FirewallRule.TrafficType getTrafficType () {
+ return FirewallRule.TrafficType.Egress;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ Pair, Integer> result = _firewallService.listFirewallRules(this);
+ ListResponse response = new ListResponse();
+ List fwResponses = new ArrayList();
+
+ for (FirewallRule fwRule : result.first()) {
+ FirewallResponse ruleData = _responseGenerator.createFirewallResponse(fwRule);
+ ruleData.setObjectName("firewallrule");
+ fwResponses.add(ruleData);
+ }
+ response.setResponses(fwResponses, result.second());
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
index 80581fb7d3b..c2aee55f51e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.FirewallResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;
@@ -56,6 +56,10 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd {
return ipAddressId;
}
+ public FirewallRule.TrafficType getTrafficType () {
+ return FirewallRule.TrafficType.Ingress;
+ }
+
public Long getId() {
return id;
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
index 665af44ad96..9fd4e450ea6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java
@@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.firewall;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
index a52ebb77257..2a8b9003fa8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.firewall;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.IpAddress;
import com.cloud.user.Account;
@@ -124,7 +124,7 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
// response.setResponseName(getName());
// this.setResponseObject(response);
// } else {
-// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update port forwarding rule");
+// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update port forwarding rule");
// }
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
index 3b4c4cd2c34..19d2341fd73 100644
--- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java
@@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.guest;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.storage.GuestOsCategory;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
index 3c145e9bd95..1b050b8960f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java
@@ -20,15 +20,15 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
-import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
+import org.apache.cloudstack.api.response.GuestOSCategoryResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.storage.GuestOS;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
index 1e154e2a07d..933ee8bde53 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
-import org.apache.cloudstack.api.response.TemplateResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.UserContext;
@@ -46,7 +46,7 @@ public class AttachIsoCmd extends BaseAsyncCmd {
required=true, description="the ID of the ISO file")
private Long id;
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class,
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
required=true, description="the ID of the virtual machine")
private Long virtualMachineId;
@@ -104,10 +104,10 @@ public class AttachIsoCmd extends BaseAsyncCmd {
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso");
}
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
index b449ff59180..89aa71f8ffd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java
@@ -16,11 +16,10 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
@APICommand(name = "copyIso", description="Copies an iso from one zone to another.", responseObject=TemplateResponse.class)
public class CopyIsoCmd extends CopyTemplateCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
index 44efbf88f2c..c8217759944 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.template.VirtualMachineTemplate;
@@ -112,7 +112,7 @@ public class DeleteIsoCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete iso");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
index eb1c6eed2d6..c04fba50295 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
-import org.apache.cloudstack.api.response.TemplateResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.vm.DeployVMCmd;
+import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.uservm.UserVm;
@@ -41,7 +41,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class,
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
required=true, description="The ID of the virtual machine")
private Long virtualMachineId;
@@ -91,7 +91,7 @@ public class DetachIsoCmd extends BaseAsyncCmd {
response.setResponseName(DeployVMCmd.getResultObjectName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach iso");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
index 5f8303ec320..08a15eece73 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ExtractResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InternalErrorException;
@@ -126,11 +130,11 @@ public class ExtractIsoCmd extends BaseAsyncCmd {
response.setObjectName("iso");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract iso");
}
} catch (InternalErrorException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
index 0ca711f4664..faa4f607edc 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java
@@ -16,8 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.log4j.Logger;
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index e6ccfff3449..1824612ebb0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -21,14 +21,14 @@ import java.util.List;
import java.util.Set;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
index 214d18de5cc..284d5530846 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java
@@ -18,16 +18,20 @@ package org.apache.cloudstack.api.command.user.iso;
import java.util.List;
-import org.apache.cloudstack.api.*;
-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.DomainResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.UserContext;
@@ -84,6 +88,10 @@ public class RegisterIsoCmd extends BaseCmd {
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="Register iso for the project")
private Long projectId;
+
+ @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING,
+ description="Image store uuid")
+ private String imageStoreUuid;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -136,6 +144,10 @@ public class RegisterIsoCmd extends BaseCmd {
public String getChecksum() {
return checksum;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -166,7 +178,7 @@ public class RegisterIsoCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
index f54f8a66daa..37294e3563a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java
@@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
-import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
@@ -72,7 +72,7 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update iso");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
index b7a2c5685e0..5e884df40f3 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java
@@ -16,11 +16,11 @@
// under the License.
package org.apache.cloudstack.api.command.user.iso;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
index 50ac52e025f..85062188ef2 100644
--- a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java
@@ -16,19 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.user.job;
-import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.ListResponse;
-import com.cloud.async.AsyncJob;
-import com.cloud.utils.Pair;
@APICommand(name = "listAsyncJobs", description="Lists all pending asynchronous jobs for the account.", responseObject=AsyncJobResponse.class)
public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
index 256d4ff5cc3..5d2ef6898c1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java
@@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.job;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AsyncJobResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "queryAsyncJobResult", description="Retrieves the current status of asynchronous job.", responseObject=AsyncJobResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
index 972673f4954..e0f9bcdd80d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java
@@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.List;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancer;
@@ -102,7 +102,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign load balancer rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
index c01e138c1d1..02b253a7c0c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java
@@ -19,22 +19,22 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.Map;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.LBStickinessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
-import com.cloud.network.rules.StickinessPolicy;
-import org.apache.cloudstack.api.response.LBStickinessResponse;
import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -129,7 +129,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
}
} finally {
if (!success || (policy == null)) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create stickiness policy ");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create stickiness policy ");
}
}
}
@@ -142,7 +142,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
index 4e76a6b676f..5f1d97b2803 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java
@@ -18,12 +18,10 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
@@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -244,7 +244,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
UserContext.current().setEventDetails("Rule Id: " + getEntityId());
if (getOpenFirewall()) {
- success = success && _firewallService.applyFirewallRules(getSourceIpAddressId(), callerContext.getCaller());
+ success = success && _firewallService.applyIngressFirewallRules(getSourceIpAddressId(), callerContext.getCaller());
}
// State might be different after the rule is applied, so get new object here
@@ -266,7 +266,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
// no need to apply the rule on the backend as it exists in the db only
_lbService.deleteLoadBalancerRule(getEntityId(), false);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create load balancer rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create load balancer rule");
}
}
}
@@ -283,10 +283,10 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
this.setEntityUuid(result.getUuid());
} catch (NetworkRuleConflictException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
} catch (InsufficientAddressCapacityException e) {
s_logger.warn("Exception: ", e);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
index 9329bd35aba..fc7be24d482 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java
@@ -16,20 +16,20 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
-import org.apache.cloudstack.api.response.LBStickinessResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.rules.LoadBalancer;
+import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -91,7 +91,7 @@ public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete load balancer stickiness policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer stickiness policy");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
index d53155f17b9..88fa400bb35 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -89,7 +93,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete load balancer");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
index 90708c0bfe0..9456a157f35 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java
@@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
index 374c6fb25e5..49ab42c32df 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java
@@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.uservm.UserVm;
@APICommand(name = "listLoadBalancerRuleInstances", description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
index d0d4e8db85c..e022cc78db0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
@@ -19,11 +19,9 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
@@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.LoadBalancer;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
index f56f06d15c5..92a05d6c9e6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java
@@ -18,13 +18,17 @@ package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.List;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancer;
@@ -98,7 +102,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
index 8a86f74260d..c2960579977 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.loadbalancer;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.LoadBalancerResponse;
import com.cloud.event.EventTypes;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account;
@@ -106,7 +110,7 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update load balancer rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load balancer rule");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
index 1ce3458dde3..4cb5288ceeb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java
@@ -18,18 +18,18 @@ package org.apache.cloudstack.api.command.user.nat;
import java.util.List;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-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.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -114,7 +114,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
UserContext.current().setEventDetails("Rule Id: "+ getEntityId());
if (getOpenFirewall()) {
- result = result && _firewallService.applyFirewallRules(ipAddressId, UserContext.current().getCaller());
+ result = result && _firewallService.applyIngressFirewallRules(ipAddressId, UserContext.current().getCaller());
}
result = result && _rulesService.applyStaticNatRules(ipAddressId, UserContext.current().getCaller());
@@ -132,7 +132,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
_rulesService.revokeStaticNatRule(getEntityId(), true);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Error in creating ip forwarding rule on the domr");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Error in creating ip forwarding rule on the domr");
}
}
}
@@ -151,7 +151,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta
this.setEntityUuid(rule.getUuid());
} catch (NetworkRuleConflictException e) {
s_logger.info("Unable to create Static Nat Rule due to ", e);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
index 6300a412d54..b736b03a62e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.nat;
-import org.apache.cloudstack.api.response.AccountResponse;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -78,7 +78,7 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete ip forwarding rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete ip forwarding rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
index fbd0b5ce900..9bd769aca1f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.nat;
-import org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd;
+import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InvalidParameterValueException;
@@ -86,7 +86,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable static nat");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable static nat");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
index 79a8e2bc9ff..ce6ea1663b9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java
@@ -16,17 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.nat;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.SuccessResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
@@ -114,12 +115,12 @@ public class EnableStaticNatCmd extends BaseCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable static nat");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable static nat");
}
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network Rule Conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
index e4aaff3e56f..776639b5f1e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
@@ -30,6 +28,8 @@ import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
index 16843b56d67..2e307018eed 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.NetworkResponse;
-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.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkACLResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -164,7 +164,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
} finally {
if (!success || rule == null) {
_networkACLService.revokeNetworkACL(getEntityId(), true);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network ACL");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL");
}
}
}
@@ -250,7 +250,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
if (getSourceCidrList() != null) {
for (String cidr: getSourceCidrList()){
if (!NetUtils.isValidCIDR(cidr)){
- throw new ServerApiException(BaseCmd.PARAM_ERROR, "Source cidrs formatting error " + cidr);
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr);
}
}
}
@@ -262,7 +262,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network Rule Conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
index 3b2608729a4..fc7bd9fdd3f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java
@@ -16,20 +16,21 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
-import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
@@ -112,6 +113,18 @@ public class CreateNetworkCmd extends BaseCmd {
description="the VPC network belongs to")
private Long vpcId;
+ @Parameter(name=ApiConstants.START_IPV6, type=CommandType.STRING, description="the beginning IPv6 address in the IPv6 network range")
+ private String startIpv6;
+
+ @Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range")
+ private String endIpv6;
+
+ @Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " +
+ "for Shared networks and Isolated networks when it belongs to VPC")
+ private String ip6Gateway;
+
+ @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64")
+ private String ip6Cidr;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -206,6 +219,34 @@ public class CreateNetworkCmd extends BaseCmd {
}
}
+ public String getStartIpv6() {
+ if (startIpv6 == null) {
+ return null;
+ }
+ return startIpv6.toLowerCase();
+ }
+
+ public String getEndIpv6() {
+ if (endIpv6 == null) {
+ return null;
+ }
+ return endIpv6.toLowerCase();
+ }
+
+ public String getIp6Gateway() {
+ if (ip6Gateway == null) {
+ return null;
+ }
+ return ip6Gateway.toLowerCase();
+ }
+
+ public String getIp6Cidr() {
+ if (ip6Cidr == null) {
+ return null;
+ }
+ return ip6Cidr.toLowerCase();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -233,7 +274,7 @@ public class CreateNetworkCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
}else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
index 4b078ed7fe3..2a2444b3e1b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java
@@ -16,17 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -99,7 +99,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network ACL");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
index df070ff8ecb..954146e0f87 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.Network;
@@ -68,7 +72,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
index f556ce1cbfd..d166974e7d1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
-import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.rules.FirewallRule;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
index 94bc71dc993..e2c970157a7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.NetworkOffering;
@APICommand(name = "listNetworkOfferings", description="Lists all available network offerings.", responseObject=NetworkOfferingResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index 1f366c223a6..afce0926e4d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.Network;
@APICommand(name = "listNetworks", description="Lists all available networks.", responseObject=NetworkResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
index ee9af3b0009..b054781b6c5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.IPAddressResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.IPAddressResponse;
-import org.apache.cloudstack.api.response.SuccessResponse;
-import org.apache.cloudstack.api.response.NetworkResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -90,7 +94,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 5ab8a6035ad..41aaaaada12 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.network;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -64,6 +64,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
description="network offering ID")
private Long networkOfferingId;
+ @Parameter(name=ApiConstants.GUEST_VM_CIDR, type=CommandType.STRING, description="CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR")
+ private String guestVmCidr;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -94,6 +97,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
}
return false;
}
+
+ private String getGuestVmCidr() {
+ return guestVmCidr;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -125,10 +132,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
Network result = null;
if (network.getVpcId() != null) {
result = _vpcService.updateVpcGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
} else {
result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr());
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr());
}
if (result != null) {
@@ -136,7 +143,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
index 7209429cfa0..eb48d814290 100644
--- a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java
@@ -19,15 +19,16 @@ package org.apache.cloudstack.api.command.user.offering;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.offering.DiskOffering;
@APICommand(name = "listDiskOfferings", description="Lists all available disk offerings.", responseObject=DiskOfferingResponse.class)
@@ -78,16 +79,8 @@ public class ListDiskOfferingsCmd extends BaseListCmd {
@Override
public void execute(){
- List extends DiskOffering> result = _mgr.searchForDiskOfferings(this);
- ListResponse response = new ListResponse();
- List diskOfferingResponses = new ArrayList();
- for (DiskOffering offering : result) {
- DiskOfferingResponse diskOffResp = _responseGenerator.createDiskOfferingResponse(offering);
- diskOffResp.setObjectName("diskoffering");
- diskOfferingResponses.add(diskOffResp);
- }
- response.setResponses(diskOfferingResponses);
+ ListResponse response = _queryService.searchForDiskOfferings(this);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
index 9fad577d8ad..ca16cdc7efe 100644
--- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java
@@ -16,20 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.offering;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
-import com.cloud.offering.ServiceOffering;
+
+import org.apache.log4j.Logger;
@APICommand(name = "listServiceOfferings", description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class)
public class ListServiceOfferingsCmd extends BaseListCmd {
@@ -102,17 +98,10 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
@Override
public void execute(){
- List extends ServiceOffering> offerings = _mgr.searchForServiceOfferings(this);
- ListResponse response = new ListResponse();
- List offeringResponses = new ArrayList();
- for (ServiceOffering offering : offerings) {
- ServiceOfferingResponse offeringResponse = _responseGenerator.createServiceOfferingResponse(offering);
- offeringResponse.setObjectName("serviceoffering");
- offeringResponses.add(offeringResponse);
- }
- response.setResponses(offeringResponses);
+ ListResponse response = _queryService.searchForServiceOfferings(this);
response.setResponseName(getCommandName());
this.setResponseObject(response);
+
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
index 6cc9387ac2b..95889fe4040 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ProjectResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
@@ -79,7 +83,7 @@ public class ActivateProjectCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to activate a project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to activate a project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
index 865f7a0aa99..7515f0513b5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
@@ -114,7 +118,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project");
}
}
@@ -126,7 +130,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd {
this.setEntityId(project.getId());
this.setEntityUuid(project.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
index fb41a7f14ef..9b61b699665 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.response.ProjectResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.projects.Project;
@@ -71,7 +71,7 @@ public class DeleteProjectCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
index 67c7cefc252..27d1b50ca30 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.response.ProjectInvitationResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProjectInvitationResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -72,7 +72,7 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete the project invitation");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete the project invitation");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
index 4157daa7b4a..6e8b2da5df6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java
@@ -16,15 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.response.ProjectResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
@APICommand(name = "listProjectInvitations", description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectInvitationResponse.class, since = "3.0.0")
public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
index 321a19fe62d..08cef101259 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java
@@ -21,14 +21,13 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
index 120e4fe0c55..e2f4bd6219b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ProjectResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
@@ -69,7 +73,7 @@ public class SuspendProjectCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to suspend a project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to suspend a project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
index bad117727e0..e475bc7b8ba 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
@@ -97,7 +97,7 @@ public class UpdateProjectCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update a project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update a project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
index 32e1a755484..f34814a4335 100644
--- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.project;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -92,7 +96,7 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to join the project");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to join the project");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
new file mode 100644
index 00000000000..07f93a4568a
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.region;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.RegionResponse;
+import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.region.RegionService;
+import org.apache.log4j.Logger;
+
+@APICommand(name = "listRegions", description="Lists Regions", responseObject=RegionResponse.class)
+public class ListRegionsCmd extends BaseListCmd {
+ public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName());
+
+ private static final String s_name = "listregionsresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, description="List Region by region ID.")
+ private Integer id;
+
+ @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.")
+ private String name;
+
+ @Inject RegionService _regionService;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Integer getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public void execute(){
+ List extends Region> result = _regionService.listRegions(this);
+ ListResponse response = new ListResponse();
+ List regionResponses = new ArrayList();
+ for (Region region : result) {
+ RegionResponse regionResponse = _responseGenerator.createRegionResponse(region);
+ regionResponse.setObjectName("region");
+ regionResponses.add(regionResponse);
+ }
+
+ response.setResponses(regionResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
index 0d62c18f55d..716addba2c9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java
@@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.CloudIdentifierResponse;
import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "getCloudIdentifier", description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class)
@@ -74,7 +75,7 @@ public class GetCloudIdentifierCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to get cloud identifier");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
index c1e29d3f37e..fffd3ade368 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java
@@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
import org.apache.cloudstack.api.response.HypervisorResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
index 12a8494bde8..191e9589a65 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java
@@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.configuration.ResourceLimit;
@APICommand(name = "listResourceLimits", description="Lists resource limits.", responseObject=ResourceLimitResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
index d2b6870f0ca..f6d3a98a05d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java
@@ -19,14 +19,18 @@ package org.apache.cloudstack.api.command.user.resource;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.*;
+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.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.cloudstack.api.response.ResourceCountResponse;
import com.cloud.configuration.ResourceCount;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -49,12 +53,17 @@ public class UpdateResourceCountCmd extends BaseCmd {
required=true, description="If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.")
private Long domainId;
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts" +
+ @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. If not specified will update all resource counts" +
"0 - Instance. Number of instances a user can create. " +
"1 - IP. Number of public IP addresses a user can own. " +
"2 - Volume. Number of disk volumes a user can create." +
"3 - Snapshot. Number of snapshots a user can create." +
- "4 - Template. Number of templates that a user can register/create.")
+ "4 - Template. Number of templates that a user can register/create." +
+ "5 - Project. Number of projects that a user can create." +
+ "6 - Network. Number of guest network a user can create." +
+ "7 - VPC. Number of VPC a user can create." +
+ "8 - CPU. Total number of CPU cores a user can use." +
+ "9 - Memory. Total Memory (in MB) a user can use." )
private Integer resourceType;
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
@@ -123,7 +132,7 @@ public class UpdateResourceCountCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recalculate resource counts");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recalculate resource counts");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
index 262d12dc264..0039f6293f7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.resource;
-import org.apache.cloudstack.api.*;
-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.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.configuration.ResourceLimit;
import com.cloud.user.UserContext;
@@ -50,11 +54,15 @@ public class UpdateResourceLimitCmd extends BaseCmd {
@Parameter(name=ApiConstants.MAX, type=CommandType.LONG, description=" Maximum resource limit.")
private Long max;
- @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, required=true, description="Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. " +
+ @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, required=true, description="Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8 and 9. 0 - Instance. Number of instances a user can create. " +
"1 - IP. Number of public IP addresses a user can own. " +
"2 - Volume. Number of disk volumes a user can create." +
"3 - Snapshot. Number of snapshots a user can create." +
- "4 - Template. Number of templates that a user can register/create.")
+ "4 - Template. Number of templates that a user can register/create." +
+ "6 - Network. Number of guest network a user can create." +
+ "7 - VPC. Number of VPC a user can create." +
+ "8 - CPU. Total number of CPU cores a user can use." +
+ "9 - Memory. Total Memory (in MB) a user can use." )
private Integer resourceType;
/////////////////////////////////////////////////////
@@ -100,7 +108,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update resource limit");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update resource limit");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
index acafcbe19a9..74eb5c7cea5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java
@@ -22,13 +22,18 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
-import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
+import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -206,7 +211,7 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules);
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
index abd20fcc81d..22e88c23103 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java
@@ -22,18 +22,18 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -210,7 +210,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
if(cidrList != null){
for(String cidr : cidrList ){
if (!NetUtils.isValidCIDR(cidr)){
- throw new ServerApiException(BaseCmd.PARAM_ERROR, cidr + " is an Invalid CIDR ");
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, cidr + " is an Invalid CIDR ");
}
}
}
@@ -219,7 +219,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
index c494355e15e..839afb2c220 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java
@@ -16,16 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.securitygroup;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.security.SecurityGroup;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
@@ -116,7 +117,7 @@ public class CreateSecurityGroupCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create security group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create security group");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
index 15a00253b63..aa6ec2d384f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java
@@ -16,17 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.securitygroup;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.user.UserContext;
@@ -120,11 +121,11 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete security group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete security group");
}
} catch (ResourceInUseException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
index cf1ab84bad0..670124d5e30 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java
@@ -16,15 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.user.securitygroup;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
index 53d8fcf59c7..8e7f2ec1be9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.securitygroup;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.security.SecurityGroup;
@@ -88,7 +92,7 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group egress rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group egress rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
index 1f56dee9bca..1d450647c8e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.securitygroup;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SecurityGroupRuleResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.network.security.SecurityGroup;
@@ -92,7 +92,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group ingress rule");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
index 14f46540cc3..95d76599f70 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java
@@ -16,14 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.user.snapshot;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -152,7 +157,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
this.setEntityId(snapshot.getId());
this.setEntityUuid(snapshot.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot");
}
}
@@ -165,7 +170,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId);
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
index cafb79e0523..5a9ea2a073d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.snapshot;
-import org.apache.cloudstack.api.*;
-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.SnapshotPolicyResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.projects.Project;
@@ -126,7 +130,7 @@ public class CreateSnapshotPolicyCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot policy");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
index 6def8730cbd..6f37af8b4b8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.snapshot;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.storage.Snapshot;
@@ -94,7 +98,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
index 17f28d931ea..5a75ea06c24 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java
@@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.user.snapshot;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.SnapshotPolicyResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
@APICommand(name = "deleteSnapshotPolicies", description="Deletes snapshot policies for the account.", responseObject=SuccessResponse.class)
@@ -80,7 +81,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot policy");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot policy");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
index 647c503a445..f1c60105961 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java
@@ -20,15 +20,16 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.storage.snapshot.SnapshotPolicy;
+import com.cloud.utils.Pair;
@APICommand(name = "listSnapshotPolicies", description="Lists snapshot policies.", responseObject=SnapshotPolicyResponse.class)
public class ListSnapshotPoliciesCmd extends BaseListCmd {
@@ -63,15 +64,15 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd {
@Override
public void execute(){
- List extends SnapshotPolicy> result = _snapshotService.listPoliciesforVolume(this);
+ Pair, Integer> result = _snapshotService.listPoliciesforVolume(this);
ListResponse response = new ListResponse();
List policyResponses = new ArrayList();
- for (SnapshotPolicy policy : result) {
+ for (SnapshotPolicy policy : result.first()) {
SnapshotPolicyResponse policyResponse = _responseGenerator.createSnapshotPolicyResponse(policy);
policyResponse.setObjectName("snapshotpolicy");
policyResponses.add(policyResponse);
}
- response.setResponses(policyResponses);
+ response.setResponses(policyResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index 5c6e79c9170..17f20aeb0d0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.snapshot;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.storage.Snapshot;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
index bade8572f82..56bec7eacd7 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java
@@ -17,14 +17,14 @@
package org.apache.cloudstack.api.command.user.ssh;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.SSHKeyPair;
import com.cloud.user.UserContext;
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
index 9b6d403f48e..b05a675af62 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.ssh;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.user.UserContext;
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
index 27013dfd5f6..e1788ce9f88 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java
@@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.SSHKeyPair;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
index 2f08692f09b..b05c6b18c75 100644
--- a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.ssh;
-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.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.SSHKeyPair;
import com.cloud.user.UserContext;
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
index 54338bd24e2..63e2788b77c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java
@@ -23,15 +23,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag;
import com.cloud.server.ResourceTag.TaggedResourceType;
@@ -115,7 +115,7 @@ public class CreateTagsCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create tags");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create tags");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
index cf2ea9ec1cb..084a5142aa1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java
@@ -23,15 +23,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag.TaggedResourceType;
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank")
@@ -106,7 +106,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete tags");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete tags");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
index c6461a75e28..a4f05821244 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java
@@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.template;
import java.util.List;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -50,7 +50,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
required=true, description="ID of the zone the template is being copied to.")
private Long destZoneId;
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="Template ID.")
private Long id;
@@ -133,11 +133,11 @@ public class CopyTemplateCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to copy template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template");
}
} catch (StorageUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
index e72b49b4e4d..ba1f924fe02 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java
@@ -20,16 +20,20 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -235,33 +239,23 @@ import com.cloud.user.UserContext;
@Override
public void create() throws ResourceAllocationException {
- if (isBareMetal()) {
- _bareMetalVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
- /*Baremetal creates template record after taking image proceeded, use vmId as entity id and uuid here*/
- this.setEntityId(vmId);
- this.setEntityUuid(vmId.toString());
+ VirtualMachineTemplate template = null;
+ template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+ if (template != null) {
+ this.setEntityId(template.getId());
+ this.setEntityUuid(template.getUuid());
} else {
- VirtualMachineTemplate template = null;
- template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
- if (template != null) {
- this.setEntityId(template.getId());
- this.setEntityUuid(template.getUuid());
- } else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
- "Failed to create a template");
- }
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
+ "Failed to create a template");
}
+
}
@Override
public void execute() {
UserContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
VirtualMachineTemplate template = null;
- if (isBareMetal()) {
- template = _bareMetalVmService.createPrivateTemplate(this);
- } else {
- template = _userVmService.createPrivateTemplate(this);
- }
+ template = this._templateService.createPrivateTemplate(this);
if (template != null){
List templateResponses;
@@ -277,7 +271,7 @@ import com.cloud.user.UserContext;
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
index 26f3e841f68..1f030a56591 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java
@@ -16,13 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.template;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.template.VirtualMachineTemplate;
@@ -38,7 +43,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the template")
private Long id;
@@ -109,7 +114,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete template");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
index 521293cb275..9a2dee30bcb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java
@@ -16,13 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.template;
-import org.apache.cloudstack.api.*;
-import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.ExtractResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InternalErrorException;
@@ -40,7 +45,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class,
+ @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class,
required=true, description="the ID of the template")
private Long id;
@@ -126,11 +131,11 @@ public class ExtractTemplateCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template");
}
} catch (InternalErrorException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
index 7446195d5fb..d727a334c82 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java
@@ -16,8 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.user.template;
-import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.log4j.Logger;
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index a1464ccdc4e..c48534e0bd1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -20,17 +20,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
-import com.cloud.storage.template.TemplateInfo;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
index b3677b9d3a1..c9da0c28cd6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java
@@ -21,19 +21,20 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.DomainResponse;
-import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
+import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.template.VirtualMachineTemplate;
@@ -109,7 +110,11 @@ public class RegisterTemplateCmd extends BaseCmd {
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="Register template for the project")
private Long projectId;
-
+
+ @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING,
+ description="Image store uuid")
+ private String imageStoreUuid;
+
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.")
protected Map details;
@@ -188,6 +193,10 @@ public class RegisterTemplateCmd extends BaseCmd {
public String getTemplateTag() {
return templateTag;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
public Map getDetails() {
if (details == null || details.isEmpty()) {
@@ -233,11 +242,11 @@ public class RegisterTemplateCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template");
}
} catch (URISyntaxException ex1) {
s_logger.info(ex1);
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ex1.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex1.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
index 01ea200293e..3987dbedc3e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java
@@ -16,13 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.template;
-import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.TemplateResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
@@ -73,7 +73,7 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
index 8f3e660bd1a..e44969e1313 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java
@@ -16,11 +16,11 @@
// under the License.
package org.apache.cloudstack.api.command.user.template;
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
new file mode 100644
index 00000000000..43340008e16
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
@@ -0,0 +1,121 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "addNicToVirtualMachine", description="Adds VM to specified network by creating a NIC", responseObject=UserVmResponse.class)
+
+public class AddNicToVMCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class);
+ private static final String s_name = "addnictovirtualmachineresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+ required=true, description="Virtual Machine ID")
+ private Long vmId;
+
+ @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class,
+ required=true, description="Network ID")
+ private Long netId;
+
+ @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="IP Address for the new network")
+ private String ipaddr;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getNetworkId() {
+ return netId;
+ }
+
+ public String getIpAddress() {
+ return ipaddr;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public static String getResultObjectName() {
+ return "virtualmachine";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NIC_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Adding network " + getNetworkId() + " to user vm: " + getVmId();
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm vm = _responseGenerator.findUserVmById(getVmId());
+ if (vm == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return vm.getAccountId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId());
+ UserVm result = _userVmService.addNicToVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet details = EnumSet.copyOf(dc);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to vm. Refer to server logs for details.");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
old mode 100644
new mode 100755
index e675c83dd6f..0ac6476cf43
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -24,11 +24,13 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.api.*;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand;
-
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.HostResponse;
@@ -39,6 +41,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType;
@@ -51,6 +55,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.template.VirtualMachineTemplate;
@@ -146,15 +151,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
"Mutually exclusive with securitygroupids parameter")
private List securityGroupNameList;
- @ACL(checkKeyAccess=true)
- @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class},
+ @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP,
description = "ip to network mapping. Can't be specified with networkIds parameter." +
- " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
+ " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
private Map ipToNetworkList;
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network")
private String ipAddress;
+ @Parameter(name=ApiConstants.IP6_ADDRESS, type=CommandType.STRING, description="the ipv6 address for default vm's network")
+ private String ip6Address;
+
@Parameter(name=ApiConstants.KEYBOARD, type=CommandType.STRING, description="an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
private String keyboard;
@@ -245,7 +252,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
public List getNetworkIds() {
if (ipToNetworkList != null) {
- if (networkIds != null || ipAddress != null) {
+ if (networkIds != null || ipAddress != null || getIp6Address() != null) {
throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress");
} else {
List networks = new ArrayList();
@@ -272,13 +279,13 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
return startVm == null ? true : startVm;
}
- private Map getIpToNetworkMap() {
- if ((networkIds != null || ipAddress != null) && ipToNetworkList != null) {
+ private Map getIpToNetworkMap() {
+ if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) {
throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter");
}
- LinkedHashMap ipToNetworkMap = null;
+ LinkedHashMap ipToNetworkMap = null;
if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) {
- ipToNetworkMap = new LinkedHashMap();
+ ipToNetworkMap = new LinkedHashMap();
Collection ipsCollection = ipToNetworkList.values();
Iterator iter = ipsCollection.iterator();
while (iter.hasNext()) {
@@ -295,13 +302,25 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
}
}
String requestedIp = (String) ips.get("ip");
- ipToNetworkMap.put(networkId, requestedIp);
+ String requestedIpv6 = (String) ips.get("ipv6");
+ if (requestedIpv6 != null) {
+ requestedIpv6 = requestedIpv6.toLowerCase();
+ }
+ IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6);
+ ipToNetworkMap.put(networkId, addrs);
}
}
return ipToNetworkMap;
}
+ public String getIp6Address() {
+ if (ip6Address == null) {
+ return null;
+ }
+ return ip6Address.toLowerCase();
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -357,21 +376,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
if (getStartVm()) {
try {
UserContext.current().setEventDetails("Vm Id: "+getEntityId());
- if (getHypervisor() == HypervisorType.BareMetal) {
- result = _bareMetalVmService.startVirtualMachine(this);
- } else {
- result = _userVmService.startVirtualMachine(this);
- }
+ result = _userVmService.startVirtualMachine(this);
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
- s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ s_logger.info(ex.getMessage(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
} else {
result = _userVmService.getUserVm(getEntityId());
@@ -382,7 +397,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
}
}
@@ -426,27 +441,24 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
}
UserVm vm = null;
- if (getHypervisor() == HypervisorType.BareMetal) {
- vm = _bareMetalVmService.createVirtualMachine(this);
- } else {
- if (zone.getNetworkType() == NetworkType.Basic) {
- if (getNetworkIds() != null) {
- throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
- } else {
- vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
- displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
- }
+ IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address());
+ if (zone.getNetworkType() == NetworkType.Basic) {
+ if (getNetworkIds() != null) {
+ throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
} else {
- if (zone.isSecurityGroupEnabled()) {
- vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
- owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
- } else {
- if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
- throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
- }
- vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
- diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard);
+ vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
+ displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard);
+ }
+ } else {
+ if (zone.isSecurityGroupEnabled()) {
+ vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
+ owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard);
+ } else {
+ if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
+ throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
}
+ vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
+ diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard);
}
}
@@ -454,18 +466,19 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
setEntityId(vm.getId());
setEntityUuid(vm.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
}
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
- s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ s_logger.trace(ex.getMessage(), ex);
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
+
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
index db830d1a188..567768dee13 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -93,18 +97,14 @@ public class DestroyVMCmd extends BaseAsyncCmd {
public void execute() throws ResourceUnavailableException, ConcurrentOperationException{
UserContext.current().setEventDetails("Vm Id: "+getId());
UserVm result;
- if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) {
- result = _bareMetalVmService.destroyVm(this);
- } else {
- result = _userVmService.destroyVm(this);
- }
+ result = _userVmService.destroyVm(this);
if (result != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName("virtualmachine");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
index cd3a5609d8c..839f9378db5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java
@@ -19,13 +19,13 @@ package org.apache.cloudstack.api.command.user.vm;
import java.security.InvalidParameterException;
import org.apache.cloudstack.api.APICommand;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.GetVMPasswordResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
index b74c8e70f13..30f03b88995 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
@@ -20,14 +20,11 @@ import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
-
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.IsoVmResponse;
@@ -39,6 +36,7 @@ import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.exception.InvalidParameterValueException;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
index 45ebc287913..6838b9613db 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientCapacityException;
@@ -96,18 +96,14 @@ public class RebootVMCmd extends BaseAsyncCmd {
public void execute() throws ResourceUnavailableException, InsufficientCapacityException{
UserContext.current().setEventDetails("Vm Id: "+getId());
UserVm result;
- if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) {
- result = _bareMetalVmService.rebootVirtualMachine(this);
- } else {
- result = _userVmService.rebootVirtualMachine(this);
- }
+ result = _userVmService.rebootVirtualMachine(this);
if (result !=null){
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot vm instance");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
new file mode 100644
index 00000000000..b1a870ec8f6
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java
@@ -0,0 +1,115 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.NicResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "removeNicFromVirtualMachine", description="Removes VM from specified network by deleting a NIC", responseObject=UserVmResponse.class)
+
+public class RemoveNicFromVMCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmd.class);
+ private static final String s_name = "removenicfromvirtualmachineresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+ required=true, description="Virtual Machine ID")
+ private Long vmId;
+
+ @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType=NicResponse.class,
+ required=true, description="NIC ID")
+ private Long nicId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getNicId() {
+ return nicId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public static String getResultObjectName() {
+ return "virtualmachine";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NIC_DELETE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Removing NIC " + getNicId() + " from user vm: " + getVmId();
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm vm = _responseGenerator.findUserVmById(getVmId());
+ if (vm == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return vm.getAccountId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
+ UserVm result = _userVmService.removeNicFromVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet details = EnumSet.copyOf(dc);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
index a4c2b3772e9..80f3e852ea6 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java
@@ -16,15 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InsufficientCapacityException;
@@ -116,7 +116,7 @@ public class ResetVMPasswordCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset vm password");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
new file mode 100644
index 00000000000..3d1da155fcf
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
@@ -0,0 +1,151 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vm;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import com.cloud.async.AsyncJob;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceUnavailableException;
+
+@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " +
+ "The virtual machine must be in a \"Stopped\" state. [async]")
+public class ResetVMSSHKeyCmd extends BaseAsyncCmd {
+
+ public static final Logger s_logger = Logger.getLogger(ResetVMSSHKeyCmd.class.getName());
+
+ private static final String s_name = "resetSSHKeyforvirtualmachineresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
+ private Long id;
+
+ @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, required = true, description = "name of the ssh key pair used to login to the virtual machine")
+ private String name;
+
+
+ //Owner information
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.")
+ private String accountName;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.")
+ private Long domainId;
+
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key")
+ private Long projectId;
+
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public String getName() {
+ return name;
+ }
+
+
+ public Long getId() {
+ return id;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+
+ public Long getProjectId() {
+ return projectId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_RESETSSHKEY;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "resetting SSHKey for vm: " + getId();
+ }
+
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.VirtualMachine;
+ }
+
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm vm = _responseGenerator.findUserVmById(getId());
+ if (vm != null) {
+ return vm.getAccountId();
+ }
+
+ return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
+ }
+
+ public Long getInstanceId() {
+ return getId();
+ }
+
+
+ @Override
+ public void execute() throws ResourceUnavailableException,
+ InsufficientCapacityException {
+
+ UserContext.current().setEventDetails("Vm Id: " + getId());
+ UserVm result = _userVmService.resetVMSSHKey(this);
+
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm SSHKey");
+ }
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
index 9b2452e355d..9c33f97c317 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -34,7 +35,7 @@ import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
-@APICommand(name = "restoreVirtualMachine", description="Restore a VM to original template or specific snapshot", responseObject=UserVmResponse.class, since="3.0.0")
+@APICommand(name = "restoreVirtualMachine", description="Restore a VM to original template or new template", responseObject=UserVmResponse.class, since="3.0.0")
public class RestoreVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class);
private static final String s_name = "restorevmresponse";
@@ -43,6 +44,9 @@ public class RestoreVMCmd extends BaseAsyncCmd {
required=true, description="Virtual Machine ID")
private Long vmId;
+ @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, description="an optional template Id to restore vm from the new template")
+ private Long templateId;
+
@Override
public String getEventType() {
return EventTypes.EVENT_VM_RESTORE;
@@ -64,7 +68,7 @@ public class RestoreVMCmd extends BaseAsyncCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId());
}
}
@@ -85,4 +89,8 @@ public class RestoreVMCmd extends BaseAsyncCmd {
public long getVmId() {
return vmId;
}
+
+ public Long getTemplateId() {
+ return templateId;
+ }
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
index 36199d13c24..3012780cb81 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java
@@ -16,13 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.cloudstack.api.*;
-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.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -114,28 +117,24 @@ public class StartVMCmd extends BaseAsyncCmd {
UserContext.current().setEventDetails("Vm Id: " + getId());
UserVm result ;
- if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) {
- result = _bareMetalVmService.startVirtualMachine(this);
- } else {
- result = _userVmService.startVirtualMachine(this);
- }
+ result = _userVmService.startVirtualMachine(this);
if (result != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start a vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm");
}
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (StorageUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ExecutionException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
index 8e589060520..d66c33422bf 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java
@@ -16,11 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
@@ -109,18 +114,14 @@ public class StopVMCmd extends BaseAsyncCmd {
UserContext.current().setEventDetails("Vm Id: " + getId());
UserVm result;
- if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) {
- result = _bareMetalVmService.stopVirtualMachine(getId(), isForced());
- } else {
- result = _userVmService.stopVirtualMachine(getId(), isForced());
- }
+ result = _userVmService.stopVirtualMachine(getId(), isForced());
if (result != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java
new file mode 100644
index 00000000000..07518c90928
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java
@@ -0,0 +1,115 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vm;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+
+import org.apache.log4j.Logger;
+
+import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.NicResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+
+@APICommand(name = "updateDefaultNicForVirtualMachine", description="Changes the default NIC on a VM", responseObject=UserVmResponse.class)
+
+public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmd.class);
+ private static final String s_name = "updatedefaultnicforvirtualmachineresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class,
+ required=true, description="Virtual Machine ID")
+ private Long vmId;
+
+ @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType=NicResponse.class,
+ required=true, description="NIC ID")
+ private Long nicId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getNicId() {
+ return nicId;
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ public static String getResultObjectName() {
+ return "virtualmachine";
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_NIC_UPDATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Updating NIC " + getNicId() + " on user vm: " + getVmId();
+ }
+
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm vm = _responseGenerator.findUserVmById(getVmId());
+ if (vm == null) {
+ return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked
+ }
+ return vm.getAccountId();
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId());
+ UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this);
+ ArrayList dc = new ArrayList();
+ dc.add(VMDetails.valueOf("nics"));
+ EnumSet details = EnumSet.copyOf(dc);
+ if (result != null){
+ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default nic for VM. Refer to server logs for details.");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index 7f1e7efdc1a..ff8fff1c19f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.GuestOSResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
@@ -126,7 +126,7 @@ public class UpdateVMCmd extends BaseCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index f2c3882bd3c..6719b8f0682 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
-import org.apache.cloudstack.api.*;
+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.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-
-import org.apache.cloudstack.api.response.DiskOfferingResponse;
-import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@@ -44,7 +48,7 @@ public class UpgradeVMCmd extends BaseCmd {
required=true, description="The ID of the virtual machine")
private Long id;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
required=true, description="the service offering ID to apply to the virtual machine")
private Long serviceOfferingId;
@@ -98,7 +102,7 @@ public class UpgradeVMCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade vm");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
index 9c2c6027ac9..bcb7bdaebbd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java
@@ -16,14 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.vmgroup;
-import org.apache.cloudstack.api.*;
-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.DomainResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.UserContext;
import com.cloud.vm.InstanceGroup;
@@ -99,7 +102,7 @@ public class CreateVMGroupCmd extends BaseCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vm instance group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
index 47c2f764db6..641b6ced232 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java
@@ -16,13 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vmgroup;
-import org.apache.cloudstack.api.*;
-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.InstanceGroupResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.user.Account;
import com.cloud.vm.InstanceGroup;
@@ -73,7 +76,7 @@ public class DeleteVMGroupCmd extends BaseCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vm group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
index 8a581b02e12..5a7ce273ede 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java
@@ -16,14 +16,13 @@
// under the License.
package org.apache.cloudstack.api.command.user.vmgroup;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.log4j.Logger;
@APICommand(name = "listInstanceGroups", description="Lists vm groups", responseObject=InstanceGroupResponse.class)
public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
index 09313c0f797..83a1a1d0e0b 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java
@@ -16,11 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.vmgroup;
-import org.apache.cloudstack.api.*;
+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.InstanceGroupResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.InstanceGroupResponse;
import com.cloud.user.Account;
import com.cloud.vm.InstanceGroup;
@@ -80,7 +84,7 @@ public class UpdateVMGroupCmd extends BaseCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm instance group");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm instance group");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
new file mode 100644
index 00000000000..f0dbf16b250
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
@@ -0,0 +1,125 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class)
+public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
+
+ public static final Logger s_logger = Logger
+ .getLogger(CreateVMSnapshotCmd.class.getName());
+ private static final String s_name = "createvmsnapshotresponse";
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType=UserVmResponse.class, description = "The ID of the vm")
+ private Long vmId;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The discription of the snapshot")
+ private String description;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot")
+ private String displayName;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true")
+ private Boolean snapshotMemory;
+
+ public Boolean snapshotMemory() {
+ if (snapshotMemory == null) {
+ return false;
+ } else {
+ return snapshotMemory;
+ }
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(),getDisplayName(),getDescription(),snapshotMemory());
+ if (vmsnapshot != null) {
+ this.setEntityId(vmsnapshot.getId());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
+ "Failed to create vm snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating snapshot for VM: " + getVmId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_CREATE;
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("VM Id: " + getVmId());
+ VMSnapshot result = _vmSnapshotService.creatVMSnapshot(getVmId(),getEntityId());
+ if (result != null) {
+ VMSnapshotResponse response = _responseGenerator
+ .createVMSnapshotResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(
+ ApiErrorCode.INTERNAL_ERROR,
+ "Failed to create vm snapshot due to an internal error creating snapshot for vm "
+ + getVmId());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm userVM = _userVmService.getUserVm(vmId);
+ return userVM.getAccountId();
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
new file mode 100644
index 00000000000..a2b2c08b381
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
@@ -0,0 +1,85 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name="deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class)
+public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(DeleteVMSnapshotCmd.class.getName());
+ private static final String s_name = "deletevmsnapshotresponse";
+
+ @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class,
+ required=true, description="The ID of the VM snapshot")
+ private Long id;
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getId());
+ if (vmSnapshot != null) {
+ return vmSnapshot.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("vmsnapshot id: " + getId());
+ boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Delete VM snapshot: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_DELETE;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
new file mode 100644
index 00000000000..936d348950d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name="listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class)
+public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd {
+
+ private static final String s_name = "listvmsnapshotresponse";
+
+ @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class,
+ description="The ID of the VM snapshot")
+ private Long id;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine snapshot")
+ private String state;
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType=UserVmResponse.class, description = "the ID of the vm")
+ private Long vmId;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name or display name")
+ private String vmSnapshotName;
+
+ public String getState() {
+ return state;
+ }
+
+ public String getVmSnapshotName() {
+ return vmSnapshotName;
+ }
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void execute() {
+ List extends VMSnapshot> result = _vmSnapshotService
+ .listVMSnapshots(this);
+ ListResponse response = new ListResponse();
+ List snapshotResponses = new ArrayList();
+ for (VMSnapshot r : result) {
+ VMSnapshotResponse vmSnapshotResponse = _responseGenerator
+ .createVMSnapshotResponse(r);
+ vmSnapshotResponse.setObjectName("vmSnapshot");
+ snapshotResponses.add(vmSnapshotResponse);
+ }
+ response.setResponses(snapshotResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
new file mode 100644
index 00000000000..d7b4599d6c4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
@@ -0,0 +1,92 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "revertToSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class)
+public class RevertToSnapshotCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(RevertToSnapshotCmd.class.getName());
+ private static final String s_name = "reverttosnapshotresponse";
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
+ private Long vmSnapShotId;
+
+ public Long getVmSnapShotId() {
+ return vmSnapShotId;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
+ if (vmSnapshot != null) {
+ return vmSnapshot.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+ UserContext.current().setEventDetails(
+ "vmsnapshot id: " + getVmSnapShotId());
+ UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(
+ "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Revert from VM snapshot: " + getVmSnapShotId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
index e48e4e43093..e577e35795e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
@@ -16,16 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.response.UserVmResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.storage.Volume;
@@ -119,13 +119,13 @@ public class AttachVolumeCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
- Volume result = _userVmService.attachVolumeToVM(this);
+ Volume result = _volumeService.attachVolumeToVM(this);
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
index 04541b9fda7..5db06bcd47f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -16,15 +16,20 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.response.*;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.SnapshotResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceAllocationException;
@@ -148,19 +153,19 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException{
- Volume volume = _storageService.allocVolume(this);
+ Volume volume = this._volumeService.allocVolume(this);
if (volume != null) {
this.setEntityId(volume.getId());
this.setEntityUuid(volume.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create volume");
}
}
@Override
public void execute(){
UserContext.current().setEventDetails("Volume Id: "+getEntityId()+((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId()));
- Volume volume = _storageService.createVolume(this);
+ Volume volume = _volumeService.createVolume(this);
if (volume != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(volume);
//FIXME - have to be moved to ApiResponseHelper
@@ -179,7 +184,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
index 2b2e94cab6b..394b0092123 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
@@ -16,15 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.response.VolumeResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseCmd;
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.SuccessResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.storage.Volume;
import com.cloud.user.Account;
@@ -79,12 +80,12 @@ public class DeleteVolumeCmd extends BaseCmd {
@Override
public void execute() throws ConcurrentOperationException {
UserContext.current().setEventDetails("Volume Id: "+getId());
- boolean result = _storageService.deleteVolume(id, UserContext.current().getCaller());
+ boolean result = this._volumeService.deleteVolume(id, UserContext.current().getCaller());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete volume");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
index c8ecddea699..9a5929eccca 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.VolumeResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.storage.Volume;
@@ -126,13 +130,13 @@ public class DetachVolumeCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId());
- Volume result = _userVmService.detachVolumeFromVM(this);
+ Volume result = _volumeService.detachVolumeFromVM(this);
if (result != null){
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
response.setResponseName("volume");
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
index 43b25a83663..b86155b2a6c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java
@@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.volume;
import java.net.URISyntaxException;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.Parameter;
-import org.apache.cloudstack.api.ServerApiException;
-import org.apache.cloudstack.api.response.ExtractResponse;
import com.cloud.async.AsyncJob;
import com.cloud.dc.DataCenter;
import com.cloud.event.EventTypes;
@@ -148,11 +148,11 @@ public class ExtractVolumeCmd extends BaseAsyncCmd {
response.setUrl(uploadInfo.getUploadUrl());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume");
}
} catch (URISyntaxException ex) {
s_logger.info(ex);
- throw new ServerApiException(BaseCmd.PARAM_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage());
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
index 9ba4f346869..4c78eedeb08 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
@@ -16,13 +16,18 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.response.*;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.PodResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
index 30e672ada1b..287241a8d90 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java
@@ -16,14 +16,15 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.storage.Volume;
@@ -91,14 +92,14 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
public void execute(){
Volume result;
try {
- result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId());
+ result = _volumeService.migrateVolume(this);
if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
} catch (ConcurrentOperationException e) {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: ");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume: ");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
new file mode 100644
index 00000000000..955727a7d82
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
@@ -0,0 +1,146 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.volume;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DiskOfferingResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.async.AsyncJob;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.PermissionDeniedException;
+import com.cloud.projects.Project;
+import com.cloud.storage.Volume;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+
+
+@APICommand(name="resizeVolume", description="Resizes a volume", responseObject=VolumeResponse.class)
+public class ResizeVolumeCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger.getLogger(ResizeVolumeCmd.class.getName());
+
+ private static final String s_name = "resizevolumeresponse";
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ /////////////////////////////////////////////////////
+
+ @Parameter(name=ApiConstants.ID, entityType=VolumeResponse.class, type=CommandType.UUID, description="the ID of the disk volume")
+ private Long id;
+
+ @Parameter(name=ApiConstants.SIZE, type=CommandType.LONG, required=false, description="New volume size in G")
+ private Long size;
+
+ @Parameter(name=ApiConstants.SHRINK_OK, type=CommandType.BOOLEAN, required=false, description="Verify OK to Shrink")
+ private boolean shrinkOk;
+
+ @Parameter(name=ApiConstants.DISK_OFFERING_ID, entityType=DiskOfferingResponse.class, type=CommandType.UUID, required=false, description="new disk offering id")
+ private Long newDiskOfferingId;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getEntityId() {
+ return id;
+ }
+
+ public Long getSize() {
+ return size;
+ }
+
+ public boolean getShrinkOk() {
+ return shrinkOk;
+ }
+
+ public Long getNewDiskOfferingId() {
+ return newDiskOfferingId;
+ }
+
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public AsyncJob.Type getInstanceType() {
+ return AsyncJob.Type.Volume;
+ }
+
+ public static String getResultObjectName() {
+ return "volume";
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+
+ Volume volume = _entityMgr.findById(Volume.class, getEntityId());
+ if (volume == null) {
+ throw new InvalidParameterValueException("Unable to find volume by id=" + id);
+ }
+
+ Account account = _accountService.getAccount(volume.getAccountId());
+ //Can resize volumes for enabled projects/accounts only
+ if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+ Project project = _projectService.findByProjectAccountId(volume.getAccountId());
+ if (project.getState() != Project.State.Active) {
+ throw new PermissionDeniedException("Can't add resources to project id=" + project.getId() + " in state=" + project.getState() + " as it's no longer active");
+ }
+ } else if (account.getState() == Account.State.disabled) {
+ throw new PermissionDeniedException("The owner of volume " + id + " is disabled: " + account);
+ }
+
+ return volume.getAccountId();
+ }
+
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VOLUME_RESIZE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Volume Id: " + getEntityId() + " to size " + getSize() + "G" ;
+ }
+
+ @Override
+ public void execute(){
+ UserContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
+ Volume volume = _volumeService.resizeVolume(this);
+ if (volume != null) {
+ VolumeResponse response = _responseGenerator.createVolumeResponse(volume);
+ //FIXME - have to be moved to ApiResponseHelper
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume");
+ }
+ }
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
index 4167ffd6460..3b00ba0d4bb 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.volume;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.VolumeResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -63,6 +67,10 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this volume")
private String checksum;
+
+ @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING,
+ description="Image store uuid")
+ private String imageStoreUuid;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -95,6 +103,10 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
public String getChecksum() {
return checksum;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -106,13 +118,13 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException {
- Volume volume = _storageService.uploadVolume(this);
+ Volume volume = _volumeService.uploadVolume(this);
if (volume != null){
VolumeResponse response = _responseGenerator.createVolumeResponse(volume);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload volume");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
index 96de56a5be5..76a76d6ddb0 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java
@@ -16,16 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpc;
-import org.apache.cloudstack.api.response.PrivateGatewayResponse;
-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.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -71,7 +72,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
} catch (NetworkRuleConflictException ex) {
s_logger.info("Network rule conflict: " + ex.getMessage());
s_logger.trace("Network rule conflict: ", ex);
- throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage());
}
}
@@ -105,7 +106,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{
} finally {
if (!success || route == null) {
_vpcService.revokeStaticRoute(getEntityId());
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create static route");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create static route");
}
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
index 8a2e1f641fb..04a77888d9d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java
@@ -16,19 +16,19 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpc;
-import org.apache.cloudstack.api.response.VpcResponse;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.cloudstack.api.response.ProjectResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.api.response.VpcOfferingResponse;
-import org.apache.log4j.Logger;
-
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseAsyncCreateCmd;
-import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ProjectResponse;
+import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@@ -126,7 +126,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
this.setEntityId(vpc.getId());
this.setEntityUuid(vpc.getUuid());
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC");
}
}
@@ -139,14 +139,14 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
s_logger.trace(ex);
- throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
if (vpc != null) {
@@ -154,7 +154,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
index c9e4463db14..e43412a19f8 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java
@@ -16,13 +16,17 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpc;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
@@ -95,7 +99,7 @@ public class DeleteStaticRouteCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete static route");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete static route");
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
index ed4e754f736..18866beb06d 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java
@@ -16,12 +16,16 @@
// under the License.
package org.apache.cloudstack.api.command.user.vpc;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.log4j.Logger;
-import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
@@ -71,14 +75,14 @@ public class DeleteVPCCmd extends BaseAsyncCmd{
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC");
}
}catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) {
s_logger.warn("Exception: ", ex);
- throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage());
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
index 08da25df279..12b58224fca 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java
@@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
-import org.apache.cloudstack.api.response.VpcResponse;
-import org.apache.log4j.Logger;
-
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.utils.Pair;
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
index e9fada0a314..ab69d4a3ef4 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java
@@ -18,16 +18,18 @@ package org.apache.cloudstack.api.command.user.vpc;
import java.util.ArrayList;
import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+
import com.cloud.network.vpc.StaticRoute;
import com.cloud.utils.Pair;
-import org.apache.cloudstack.api.response.VpcResponse;
@APICommand(name = "listStaticRoutes", description="Lists all static routes", responseObject=StaticRouteResponse.class)
public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd {
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
index f776302d3c1..9aef26f016c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java
@@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.user.vpc;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.vpc.VpcOffering;
@APICommand(name = "listVPCOfferings", description="Lists VPC offerings", responseObject=VpcOfferingResponse.class)
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
index 6d3c8bd06c7..b6bc68f9f4e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java
@@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.vpc;
import java.util.ArrayList;
import java.util.List;
-import org.apache.cloudstack.api.response.VpcResponse;
-import org.apache.cloudstack.api.response.ZoneResponse;
-import org.apache.cloudstack.api.response.VpcOfferingResponse;
-import org.apache.cloudstack.api.response.DomainResponse;
-import org.apache.cloudstack.api.response.ListResponse;
-import org.apache.log4j.Logger;
-
+import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
-import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.VpcOfferingResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.log4j.Logger;
+
import com.cloud.network.vpc.Vpc;
@@ -64,15 +64,6 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{
, description="list by ID of the VPC offering")
private Long VpcOffId;
- @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list by account associated with the VPC. " +
- "Must be used with the domainId parameter.")
- private String accountName;
-
- @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class,
- description="list by domain ID associated with the VPC. " +
- "If used with the account parameter returns the VPC associated with the account for the specified domain.")
- private Long domainId;
-
@Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING,
description="list VPC supporting certain services")
private List